A Public Notebook

not a wiki!

8VF9NHWYY9V8J4N8LTS4VYZ

last edit to this page: 2020-08-14

[1~[4~
what is here: small crystals of information i have found useful to have around, easily accessible, where i know where to find it, with a minimal loading time, on a static page.
jump past the page directory
jump past the code section

the page directory


The «lines of code» section

LaTeX

Math-mode spacing characters in increasing whitespaceyness order: \! (negative) \, \: \; \ \quad \qquad

{\centering\includegraphics[width=\textwidth, height=20mm]{filename}}

$$ x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a} = \frac{2c}{-b \pm \sqrt{b^2 - 4ac}} $$

\noindent\rule{\textwidth}{0.4pt}

Math

x = (−b ± sqrt(b×b − 4×a×c)) ÷ (2×a) = (2c) ÷ (-b ± sqrt(b×b − 4×a×c))

(gnu octave) pkg load symbolic \ syms x1 x2 x3 \ A=[-2 6 0 ; 8 5 3 ; 1 9 -1 ; 3 1 1] \ x=[x1 ; x2 ; x3] \ A*x \ ans = (sym 4x1 matrix) \ ⎡ -2⋅x₁ + 6⋅x₂ ⎤ \ ⎢8⋅x₁ + 5⋅x₂ + 3⋅x₃⎥ \ ⎢ x₁ + 9⋅x₂ - x₃ ⎥ \ ⎣ 3⋅x₁ + x₂ + x₃ ⎦

Bash

Prompts:

HISTFILESIZE=20000

LS_COLORS='di=0;34:*.zip=0;91:*.bz2=0;91:*.gz=0;91:*.xz=0;91:*.tar=0;31:ex=0;32:ln=0;36'

echo database_backup_`date +%Y-%m-%d`.sqldump

for (( i=1; $i < 19; i++ )) ; do echo $i ; done

for f in foo bar baz ; do echo $f.qux ; done

for DIR in `cat list_of_directories` ; do mkdir --parents $DIR ; done

STARTTIME=$(date +%s) ; sleep 1 ; ENDTIME=$(date +%s) ; TOTALTIME=$(( $ENDTIME - $STARTTIME )) ; echo $TOTALTIME

A=0; B=1; if ((A != 0 || B != 0)) ; then echo l ; else echo O; fi

ls -l | awk '{Z+=$5};END{print Z}'

Vim & regexen

verymagic→ \v \m \M \V ←verynotmagic

HTML

Minimal preamble:
<!DOCTYPE html><html lang=en><meta charset=utf-8>
<meta name=viewport content="width=device-width, initial-scale=1"/>
<title> . </title><body>

<time datetime="1970-01-01 00:00">epoch</time>

XML's always-available entities: &lt; &amp; &gt; &apos; &quot;

CSS margin and padding: margin is outside the element, padding is inside. shorthand option order (same for both): top right bottom left | top right&left bottom | top&bottom right&left | all. Observe the difference: margin r&l of 2em padding r&l of 2em

Styling tables to be responsive on mobile:
table { display: block; white-space: nowrap; overflow-x: auto; table-layout: fixed; }
The “table-layout:fixed” isn't necessary, but it's nice for tables in general: it makes the table's columns' widths depend only on the first row, not the entire contents of the table; tables are otherwise very weird.

youtube-dl

youtube-dl --console-title --limit-rate 800K -o "%(upload_date)s %(title)s %(id)s.%(ext)s"

PHP

Checking command-line args: if (isset($GLOBALS['argv'][1])) { $arg1 = $GLOBALS['argv'][1]; } else { echo "error\n"; die(); }

Other

systemctl reboot ; systemctl poweroff

HIGH:MEDIUM:!aNULL:!MD5:!SEED:!IDEA:!EDH:!RC4

Perl

#!/usr/bin/perl
binmode(STDOUT, ':utf8'); binmode(STDIN, ':utf8'); binmode(STDERR, ':utf8');
use feature qw(say);

Factorial, sometimes useful: sub fac{return 1if$_[0]==0;return$_[0]*fac($_[0]-1);}

perl -mMIME::QuotedPrint -n -e 'print MIME::QuotedPrint::decode_qp($_);' < in.quotprint > out

perl -E "opendir(my $dh, '.') || die qq($!); for(1,2){ readdir($dh); } my $i = 0; foreach (sort readdir($dh)) { $i += 2; my $j = 1000-$i; my $si = sprintf('%03d.png',$i); my $sj = sprintf('%03d.png', $j); say qq(copy $_ $si); say qq(copy $_ $sj); }"

Loop control: next for another iteration of this loop now, including re-evaluating the conditional; last to exit this loop, ignoring any continue block; redo to redo the loop block but not the conditional, ignoring continue; a continue block is executed before the conditional of the loop, like the third part of a C for loop.

Fedora upgrade

sudo dnf --refresh upgrade
sudo dnf system-upgrade download --releasever 29
sudo dnf system-upgrade reboot

getfedora.org/keys/ rpmfusion.org/keys

Run cpan -r after upgrading Fedora to recompile all dynamically loaded Perl modules (for a new Encode.so etc.).

Backup key

CLI printing

lp -d "HP-LaserJet-P2015" -o media=a4 file.txt

That particular printer does 79 chars per line before wrapping, and ~65 lines per page. CR-LFs become two newlines, just LF is a single newline. Some Latin-1 characters outside ASCII have been printed, unsure about required encoding. Changes fi and fl sequences into fi and fl ligatures.

Ripping optical discs with dd

dd if=/dev/sr0 of=image.iso bs=1M status=progress

Letters and characters

12345678901234567890123456789012345678901234567890123456789012345678901234567890

− minus | — em-dash | – en-dash

! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~

! " # $ % & ' ( ) * + , - . / : ; < = > ? @ [ \ ] ^ _ ` { | } ~

⊨ U+22A8 \models &#8872;

þ Þ ð Ð Č č Š š Ž ž ʃ Ʃ ʒ Ʒ ç ŋ Ŋ

ɕ ɟ ɡ ɣ ɦ ɬ ɸ ɹ ɾ ʋ ʎ ʑ ʔ ʕ β θ χ

ʰ ʲ ʷ ˣ ˥ ˦ ˧ ˨ ˩ ː ˈ ˌ

ø ɛ œ æ ɶ ɪ ʏ ɨ ʉ ə ɵ ɐ ɯ ɤ ʌ ɔ ɑ ɒ

U+0361 o͡o U+035C o͜o

middot: · bullet: • dot-operator (sdot): ⋅

█ ▄ ▀ U+2588 U+2584 U+2580

α β γ δ ε ζ η θ ι κ λ μ ν ξ ο π ρ σ τ υ φ χ ψ ω (ς)
Α Β Γ Δ Ε Ζ Η Θ Ι Κ Λ Μ Ν Ξ Ο Π Ρ Σ Τ Υ Φ Χ Ψ Ω

ABEKMHOPCTYX АВЕКМНОРСТУХ

Ϙ ϙ Ϟ ϟ ‽

абвгґдеёжзийклмнопрстуфхцчшщъыьэюя


learning in progress


hosting by SDF <3
(end document)