Compare commits

...

3 Commits

Author SHA1 Message Date
nemirwen 499a8bfb7e gdb, git, strace 2 years ago
nemirwen 753b7cb2ee Group XKB tips + custom XKB type 2 years ago
nemirwen c4aaaa3bc5 Group openssl tricks 2 years ago
  1. 119
      how_to

119
how_to

@ -985,8 +985,23 @@ ssh:
ssh -R 2222:localhost:22 <user>@<server> ssh -R 2222:localhost:22 <user>@<server>
from server: from server:
ssh -p 2222 <user>@127.0.0.1 ssh -p 2222 <user>@127.0.0.1
X11 forwarding (with wayland):
Transfer files without using ssh/scp: Remote:
sudo pacman -S xorg-xauth
/etc/ssh/sshd_config
X11Forwarding yes
# (default values)
AllowTcpForwarding yes
X11UseLocalhost yes
X11DisplayOffset 10
sudo sv restart sshd
Client:
sudo pacman -S xorg-xauth xorg-xwayland
# Restart sway
ssh -X <user>@<remote>
openssl:
Transfer files without using ssh/scp:
# Credits: @Chapoline, @britaliope # Credits: @Chapoline, @britaliope
Server-side (untars in current directory): Server-side (untars in current directory):
# directory # directory
@ -1000,6 +1015,32 @@ Transfer files without using ssh/scp:
gzip <file> -c | openssl enc -aes-256-cbc -e -iter 1000 | nc <ip> 1234 -q 1 gzip <file> -c | openssl enc -aes-256-cbc -e -iter 1000 | nc <ip> 1234 -q 1
# Both need the same passphrase in stdin # Both need the same passphrase in stdin
Manual IMAP connection:
# https://www.atmail.com/blog/imap-101-manual-imap-sessions/
# https://stackoverflow.com/questions/14959461/how-to-talk-to-imap-server-in-shell-via-openssl
# https://gist.github.com/fedir/1d8f8fb8a5f80090705ef7793936216a²
$ openssl s_client -connect <imap server>:993 -crlf [-quiet]
$ openssl s_client -connect <imap server>:143 -crlf -starttls imap [-quiet]
# IMAP needs an incrementing prefix before each command
A1 login <login> "<password>"
# list everything
A2 list "" "*"
# list everything under a particular prefix
A3 list "INBOX" "*"
# Or:
# (will print current UIDVALIDITY (useful for fixing mbsync))
A4 select inbox
A99 logout
Check SSL/TLS certificate expiration date:
echo | openssl s_client -servername <name.example.tld> -connect <example.tld>:443 2>/dev/null | openssl x509 -noout -dates
Add a CA to the system trust store (archlinux):
# https://wiki.archlinux.org/title/Transport_Layer_Security#Trust_management
sudo cp cacert.crt /etc/ca-certificates/trust-source/anchors/cacert.crt
sudo update-ca-trust extract
Run MSVC on linux with Wine: Run MSVC on linux with Wine:
As seen on the internet, not tested: As seen on the internet, not tested:
@ -1028,10 +1069,46 @@ Run studiotax on wine:
wine ./StudioTax2017Install.exe /extract wine ./StudioTax2017Install.exe /extract
msiexec /i StudioTax.msi msiexec /i StudioTax.msi
Easily switch to russian phonetic keyboard: Xkb:
Easily switch to russian phonetic keyboard:
setxkbmap fr,ru -variant ,phonetic -option grp:shift_caps_toggle setxkbmap fr,ru -variant ,phonetic -option grp:shift_caps_toggle
man xkeyboard-config # get list of possible toggles man xkeyboard-config # get list of possible toggles
Customisation notes:
- https://web.archive.org/web/20190724015820/http://pascal.tsu.ru/en/xkb
- https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/docs/README.enhancing?ref_type=heads
- https://xkbcommon.org/doc/current/group__state.html#consumed-modifiers
- https://xkbcommon.org/doc/current/user-configuration.html
- https://xkbcommon.org/doc/current/user-configuration.html#autotoc_md16
- https://xkbcommon.org/doc/current/rule-file-format.html
- https://www.charvolant.org/doug/xkb/html/xkb.html
- https://medium.com/@damko/a-simple-humble-but-comprehensive-guide-to-xkb-for-linux-6f1ad5e13450
- https://github.com/isti115/dotfiles/blob/master/.config/xkb/symbols/Lenovo-Y50
- https://unix.stackexchange.com/a/101417
- https://delapouite.com/ramblings/xkb-walkthrough/
- https://github.com/xkbcommon/libxkbcommon/issues/17
- https://stackoverflow.com/a/45042841
Libxkbcommon is more flexible and modern in term of looking to ~/.xkb
and ~/.config/xkb as well as /usr/share/X11/xkb for config, but
unfortunately X11(?) isn't, and will only look into the system path.
Except for a single `custom` layout left free:
- https://blog.nemirwen.me/posts/fr-oss-ansi-xkb-layout
- https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/merge_requests/189/diffs
Also while libxkbcommon seems to rely more on rules files, X11 and so
setxkbmap seems to rely more on the xml descriptors. (supposition)
Also xorg's XKB rules syntax doesn't have %S or %H for recursive includes
`strace` is a very good tool to debug this mess.
Most people on the internet seem to rely on editing existing layout,
which feels icky to me.
Custom key type for Ctrl+Alt as AltGr:
- https://unix.stackexchange.com/a/187495
Image/photo sorting with feh: Image/photo sorting with feh:
feh --action1 'mv -v %F "/path/to/target/"%N' \ feh --action1 'mv -v %F "/path/to/target/"%N' \
--action[2-9] [...] /dir/to/sort --action[2-9] [...] /dir/to/sort
@ -1140,24 +1217,6 @@ Mounting .bin/.cue image files:
$ bchunk file.bin file.cue output $ bchunk file.bin file.cue output
$ sudo mount output01.iso /mnt -o loop,ro $ sudo mount output01.iso /mnt -o loop,ro
Manual IMAP connection:
# https://www.atmail.com/blog/imap-101-manual-imap-sessions/
# https://stackoverflow.com/questions/14959461/how-to-talk-to-imap-server-in-shell-via-openssl
# https://gist.github.com/fedir/1d8f8fb8a5f80090705ef7793936216a²
$ openssl s_client -connect <imap server>:993 -crlf [-quiet]
$ openssl s_client -connect <imap server>:143 -crlf -starttls imap [-quiet]
# IMAP needs an incrementing prefix before each command
A1 login <login> "<password>"
# list everything
A2 list "" "*"
# list everything under a particular prefix
A3 list "INBOX" "*"
# Or:
# (will print current UIDVALIDITY (useful for fixing mbsync))
A4 select inbox
A99 logout
gdb tricks: gdb tricks:
Easily print attributes of array elements: Easily print attributes of array elements:
# https://agateau.com/2008/gdb-trick-the-poor-man-loop # https://agateau.com/2008/gdb-trick-the-poor-man-loop
@ -1171,6 +1230,11 @@ gdb tricks:
(gdb) while ($i < <length>) (gdb) while ($i < <length>)
> print foo[$i++].attribute > print foo[$i++].attribute
> end > end
Dynamic printf:
# Breakpoint that prints instead of stopping
# https://sourceware.org/gdb/current/onlinedocs/gdb.html/Dynamic-Printf.html
# https://developers.redhat.com/articles/2021/10/13/printf-style-debugging-using-gdb-part-2
(gdb) dprintf meow.c:42,"foo:%d bar:%s\n", number, string
Non-standard zsh cd trick: Non-standard zsh cd trick:
# https://dataswamp.org/~solene/2020-09-04-cd-command.html # https://dataswamp.org/~solene/2020-09-04-cd-command.html
@ -1189,6 +1253,12 @@ Git:
git config url."git@example.org:user/".pushInsteadOf "https://example.org/user/" git config url."git@example.org:user/".pushInsteadOf "https://example.org/user/"
Prevent git from trying to auto-detect user name and email: Prevent git from trying to auto-detect user name and email:
user.useConfigOnly = true user.useConfigOnly = true
Revert a rebase after continue/commit:
# https://stackoverflow.com/a/135614
# Find last sane state (prefixed with "commit:" instead of "rebase:"
git reflog
# /!\ Be careful to either your modifications or remember what you did
git reset --hard 'HEAD@{<n>}'
Setup a midi synth: Setup a midi synth:
# http://www.tedfelix.com/linux/linux-midi.html # http://www.tedfelix.com/linux/linux-midi.html
@ -1351,9 +1421,6 @@ Jupyter:
jupyter nbconvert --clear-output \ jupyter nbconvert --clear-output \
--to notebook --output=my_notebook_no_out my_notebook.ipynb --to notebook --output=my_notebook_no_out my_notebook.ipynb
Check SSL/TLS certificate expiration date:
echo | openssl s_client -servername <name.example.tld> -connect <example.tld>:443 2>/dev/null | openssl x509 -noout -dates
List files in chronological order with ls: List files in chronological order with ls:
# https://shkspr.mobi/blog/2020/12/anatomy-of-an-ls-command/ # https://shkspr.mobi/blog/2020/12/anatomy-of-an-ls-command/
ls -trhgGN --color=always | cut -d" " -f3- ls -trhgGN --color=always | cut -d" " -f3-
@ -1363,3 +1430,7 @@ Change default java environment (archlinux):
archlinux-java status archlinux-java status
# Example # Example
archlinux set java-18-openjdk archlinux set java-18-openjdk
strace:
print all file access:
strace -yy -f -e trace=file -- <bin>

Loading…
Cancel
Save