Using CSV File as data storage and access

Thanks adamchainz!

You can use “CSV” table storage in (at least) these database backends:

However these will be slow though. Changes to CSV based tables require a lot of parsing and re-saving.

It’s probably better to import the CSV into a table with an optimized storage engine, and export it again later. django-import-export can help with that: https://pypi.org/project/django-import-export/

Source: Using CSV File as data storage and access

Adding parenthesis around highlighted text in Vim

Lovely, lovely vim

The command

c()<Esc>P

Explanation

If you want to put the word under the cursor in to brackets this is viwc()<Esc>P.

viw will visually select all charactrs in a word.

c() will cchange the selection and drops you into insert mode, where you type the literal characters ( ). Also, c automatically copies the original content to your yank buffer (clip board).

With <Esc>P you return Escback from insert to normal mode and Paste the previous content.

Source: Adding parenthesis around highlighted text in Vim

My little printer-friendly CSS

Here is my little “Printer friendly CSS” that I add to each and every page using Simple Custom CSS and JS

/* override styles when printing */
@media print {
	@page {
		margin: 2cm; 
		@top-center {
			font-family: sans-serif;
			font-weight: bold;
			font-size: 2em;
			content: counter(page);
		}
	}
	/* target the first page only */
	@page :first { margin-top: 6cm; }
	/* target left (even-numbered) pages only */
	@page :left { margin-right: 2cm; }
	/* target right (odd-numbered) pages only */
	@page :right { margin-left: 2cm; }
	
	
	body {
		font-size: 16pt;
		line-height: 1.2;
		/*margin: 1cm;*/
		color: #000;
		background-color: #fff;
		border: 1mm black;
	}
	/* header, */
	footer, aside, nav, form, iframe, .menu, .hero, .adslot, .header-bottom, .site-header, .header-middle {
		display: none;
	}
	
	h2.entry-title {
		font-size: 32pt;
	}
	
	/* page breaks before main header */
	h1 {
		break-before: page; 
	}
	/* don't break tables and pictures*/ 
	table, img, svg {
		break-inside: avoid;
	}
	
	/* avoid too small text */
	body,p {
		font-size: 16pt;
		line-height: 1.2;
	}
	article {
		width: 100%;
		/* no columns please 
		** column-width: 19cm;
		** column-gap: 0.5cm;
		*/
	}
	
	/* no background images */
	* {
		background-image: none !important;
	}
	
	 /* styling links */
	a {
		font-size: 80%;
	}
	a::after {
		content: " (" attr(href) ")";
		overflow-wrap: break-word;
	}
	
	
	/* don't display unimportang pictures */
	/* img, svg {
	**	display: none !important;
	** }
	*/
	
	/* make picture big */
	img.print, svg.print {
		display: block;
		max-width: 100%;
	}
	
	/* don't show comments */
	#comments {
		display: none;
	}
	
	/* don't show tables of contents */
	.wp-block-uagb-table-of-contents, .advgb-toc {
		display: none;
	}
}

I use it with News-box theme but it should work fine with any other “pretty modern” theme.

I started reading How to Create Printer-friendly Pages with CSS (local copy)

This css one liner can define how your site looks on a device with dark mode set in the browser settings.

@media (prefers-color-scheme: dark)

Or if your main style is dark mode, you can define how the light mode will look.

@media (prefers-color-scheme: light)
Source: CSS only dark mode without JS – Simon Dalvai