diff --git a/basics/column.md b/basics/column.md new file mode 100644 index 0000000..b855ef4 --- /dev/null +++ b/basics/column.md @@ -0,0 +1,36 @@ +--- +title: "column" +tags: [ "basics", "format", "json" ] +--- + +Put output into column. + +```bash +du -h /etc/* | column +``` + +Reformat file with an explicit separator (`-s`): + +```bash +column -ts: /etc/passwd +``` + +Give columns names (`-N`), so you can hide some (`-H`): + +```bash +column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID /etc/passwd +``` + +Reorder with `-O` (unspecified items remain): + + +```bash +column -ts: -N User,PW,UID,GID,Description,Home,shell -H PW,GID -O User,Description,shell /etc/passwd +``` + +Output to json format with `-J`: + +```bash +column -J -ts: -H PW,GID,shell -N User,PW,UID,GID,Description,Home,shell /etc/passwd +``` + diff --git a/data/recfiles.md b/data/recfiles.md new file mode 100644 index 0000000..fe3e1e3 --- /dev/null +++ b/data/recfiles.md @@ -0,0 +1,51 @@ +--- +title: "Recfiles" +tags: [ "data", "database" ] +--- + +Create a database of board games: + +```bash +database=games.rec +touch $database + +entry="Name: Vojvodina" +recins --record "$record" $database +``` + +Create, read, update, and delete: + +```bash +for g in Saboter Carcassonne Chess; do + recins -r "Name: $g" -r "Played: yes" $database +done + +query=Carc +recsel --quick=Carc $database +recsel -q $query $database + +query=sabat +recsel --case-insensitive -q "$query" --print=Name $database + +query=chess +recsel -i -q "$query" -p Name $database + +new_field=Played +value=no + +recset -f "$new_field" --set-add="$value" $database +recsel $database + +value=yes +recset -iq $query -f "$new_field" --set=$value $database + +recset -f "$new_field" --delete $database +recsel $database +``` + +- [Extended example](recfiles/extended.md) + +# Resources + +- [Recfiles for gemini capsules](gemini://tilde.town/~dozens/gemlog/21.gmi) + diff --git a/data/recfiles/extended.md b/data/recfiles/extended.md new file mode 100644 index 0000000..eb0310c --- /dev/null +++ b/data/recfiles/extended.md @@ -0,0 +1,118 @@ +--- +title: "Recfiles Extended Example" +tags: [ "data", "database", "recfiles" ] +--- + +## Create + +Make a database for your boardgames, specifying only one field and value: + +```bash +database=games.rec +n=Name +g=Vojvodina +touch $database +recins -f $n --value $g $database +recsel $database +``` + +Insert a few more, with the estimated playtime: + +```bash +recins -f Name -v Saboter -f Playtime -v 30 $database +recins -f Name -v Chess -f Playtime -v 30 $database +``` + +View all games, or select one by number: + +```bash +recsel $database +recsel -n 0 $database +``` + +Each game should note whether or not you have played it yet, so you can add that field and set the default to `yes`. + +```bash +f=played +v=yes +recset -f $f -a $v $database +``` + +...but the field is wrong, it should have a capital letter: + +```bash +new_field=Played +recset -f $f --rename $new_field +``` + +## Read + +Check how many records the database has: + +```bash +recinf $database +``` + +Look at just the games you've never played: + +```bash +recsel --expression="Played = 'no'" $database +``` + +Print how many, then just print the names: + +```bash +recsel -e "Played = 'no'" --count $database +recsel -e "Played = 'no'" --print=Name $database +``` + +## Update + +To change a game's `Played` field from `no` to `yes`, use `recset` to specify the number, and change that field. + +```bash +num=0 +f=Played +value=yes +recsel --number=$num $database +recset --number=$num -f $f --set=$value $database +``` + +Find all games with a playtime of `30`, and set the field `Max_Players` to `4`. + +```bash +recset -e "Playtime = 40" -f Max_Players --set 50 games.rec +``` + +This doesn't work, because that field does not exist. +You can `--set-add` the field, to add it wherever it does not exist. + +```bash +recset -e "Playtime = 40" -f Max_Players --set-add 50 games.rec +``` + +## Delete + +Remove `Played` record from first game: + +```bash +num=0 +recset --number=$num -f Played --delete $database +``` + +You can comment the line instead of deleting it: + +```bash +num=1 +recset --number=$num -f Played --delete $database +recsel $database +cat $database +``` + +Delete an entire record: + +```bash +num=2 +recdel --number=$num $database +``` + diff --git a/distros/arch/Maintenance.md b/distros/arch/Maintenance.md new file mode 100644 index 0000000..0a8c0a1 --- /dev/null +++ b/distros/arch/Maintenance.md @@ -0,0 +1,53 @@ +--- +title: "Maintenance" +tags: [ "arch" ] +--- + +# Package Cache + +Clean the cache of old packages in `/var/cachepacman/pkg/`: + +```bash +ls /var/cache/pacman/pkg/ | wc -l +sudo pacman -Sc +ls /var/cache/pacman/pkg/ | wc -l +``` +And the same for `yay` (with `-Yc` to remove old dependencies): + +```bash +ls ~/.cache/yay/ | wc -l +yay -Sc +yay -Yc +ls ~/.cache/yay/ | wc -l +``` + +# New Configs + +If you chance a configuration file, such as `/etc/environment`, and `pacman` wants to update the file, it will place `/etc/environment.pacnew`. + +Check the new files, then look at the difference between the `pacman` version, and your version. + +```bash +sudo find /etc/ /var/ /usr/ -name "*.pacnew" +diff /etc/pacman.d/mirrorlist* +``` + +Either, + +- Update the files manually, + +```bash +sudo -e /etc/pacman.d/mirrorlist +sudo rm /etc/pacman.d/mirrorlist.pacnew +``` + +Or, + +- use a tool like `pacdiff` to view the changes next to each other, and select them with `vim`. + + +```bash +sudo pacman -S pacman-contrib +sudo pacdiff +``` + diff --git a/hardware/keyboard.md b/hardware/keyboard.md new file mode 100644 index 0000000..4f93722 --- /dev/null +++ b/hardware/keyboard.md @@ -0,0 +1,65 @@ +--- +title: "keyboard" +tags: [ "Documentation", "keyboard", "vim" ] +--- + +# System-Wide Capslock and Escape Swap + +This works everywhere, including in a bare-ass tty. + +Select a keymap, and create a new custom map. + +```bash +su root + +basemap=/usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz +newmap=/usr/share/kbd/keymaps/custom.map.gz + +gunzip -c $basemap | \ + sed 's/Caps_Lock/\n/g;s/Escape/Caps_Lock/g;s/\n/Escape/g' | \ + gzip > $newmap +``` + +Tell the system to use this keymap at startup by naming it in the `rc.conf` file: + +```bash +echo "KEYMAP=$newmap" >> /etc/rc.conf + +cat /etc/rc.conf +reboot +``` + +# Set Layout with X Display + +Set layout to British English. + +```bash +setxkbmap -layout gb +``` + +Or Polish with: + +```bash +setxkbmap -layout pl +``` + +| Language | short | +|:--------|:------| +| Polish | pl | +| Serbian | rs | + +Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout. + +```bash +setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle +``` + +## Alt_GR + +Remap, e.g., the right Windows key, to Alt_Gr. + +``` + key {[ ISO_Level3_Shift ]}; +``` + + diff --git a/hardware/keyboard/keyboard.md b/hardware/keyboard/keyboard.md deleted file mode 100644 index fc17ca1..0000000 --- a/hardware/keyboard/keyboard.md +++ /dev/null @@ -1,68 +0,0 @@ ---- -title: "keyboard" -tags: [ "Documentation", "keyboard" ] ---- -# Set Layout with X Display - -Set layout to British English. - -```bash -setxkbmap -layout gb -``` - -Or Polish with: - -```bash -setxkbmap -layout pl -``` - -| Language | short | -|:--------|:------| -| Polish | pl | -| Serbian | rs | - -Set 'alt + shift', as the command which cycles through the British English, Polish and Serbian keyboard layout. - -```bash -setxkbmap -layout gb,pl,rs -option grp:alt_shift_toggle -``` - -## Alt_GR - -Remap, e.g., the right Windows key, to Alt_Gr. - -``` - key {[ ISO_Level3_Shift ]}; -``` - -# Set TTY Keymap - -Copy your keymap, e.g. if it's polish-1, then: - -```bash -cp /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz /usr/share/kbd/keymaps/*custom*.map.gz -``` - -Then change that map: - -```bash -sudo vim /usr/share/kbd/keymaps/custom.map.gz -``` - ---- - -You can switch Escape and Caps Lock with a single line: - -```bash -sudo sh -c "gunzip -c /usr/share/kbd/keymaps/i386/qwerty/pl1.map.gz | sed 's/ Escape/ PLACEHOLDER/ ; s/Caps_Lock/Escape/g ; s/PLACEHOLDER/Caps_Lock/' | gzip > /usr/share/kbd/keymaps/custom.map.gz" -``` - ---- - -Change the default keyboard mapping to the custom map: - -```bash -echo 'KEYMAP="/usr/share/kbd/keymaps/*custom*.map.gz"' | sudo tee /etc/vconsole.conf -``` - -Reboot to have changes take effect. diff --git a/hardware/keyboard/unicode-characters b/hardware/keyboard/unicode-characters deleted file mode 100644 index f8c1396..0000000 --- a/hardware/keyboard/unicode-characters +++ /dev/null @@ -1,37 +0,0 @@ - ☢ ☣ s ☠ ⚠ - radioactive sign biohazard sign skull and crossbones warning sign - ☤ ⚕ ⚚ † - caduceus staff of aesculapius staff of hermes dagger - ☯ ⚖ ☮ ⚘ - yin yang scales peace flower - ⚔ ☭ ⚒ ⚓ - crossed swords hammer and sickle hammer and pick anchor - ⚛ ⚜ ⚡ ⚶ - atom symbol fleur-de-lis lightning vesta - ☥ ✠ ✙ ✞ - ankh cross cross cross - ✟ ✧ ⋆ ★ - cross diamond star star - ☆ ✪ ✫ ✬ - star star star star - ✭ ✮ ✯ ✰ - star star star star -≪ - ☸ ✵ ❂ ☘ - wheel of dharma star sun shamrock - ♡ ♥ ❤ ⚘ - heart heart big heart flower - ❀ ❃ ❁ ✼ - flower flower flower flower - ☀ ✌ ♫ ♪ - sun V sign music note / melody music note / melody - ☃ ❄ ❅ ❆ - snowman snowflake snowflake snowflake - ☕ ☂ ❦ ✈ - cofee umbrella floral heart / leaf airplane - ♕ ♛ ♖ ♜ -white king / crown black king / crown white rook / tower black rook / tower - ☁ ☾ - cloud waning crescent moon - -