sudo apt install git stow ripgrep aspell htop
git clone --recursive [email protected]:andschwa/dotfiles.git
cd dotfiles
./install.sh
sudo sed -i "s/%sudo ALL=(ALL:ALL)/%sudo ALL=(ALL) NOPASSWD:/g" /etc/sudoers
sudo sed -i "s/Prompt=lts/Prompt=normal/g" /etc/update-manager/release-upgrades
sudo do-release-upgrade
sudo add-apt-repository ppa:git-core/ppa
sudo add-apt-repository ppa:ubuntu-elisp/ppa
sudo apt update
sudo apt install git emacs-snapshot stow ripgrep aspell xorg
sudo apt install dos2unix shellcheck ppa-purge
E.g. Cascadia Code
mkdir ~/.local/share/fonts
mv Cascadia.ttf ~/.local/share/fonts
fc-cache -f -v
# Use X410 Display: https://x410.dev/cookbook/wsl/using-x410-with-wsl2/
export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0
# Scale Emacs GUI: https://www.emacswiki.org/emacs/SetFonts#toc4
export GDK_SCALE=2 GTK_THEME=Adwaita
# Move all Windows paths to the end of PATH
IFS=':' read -ra paths <<< "$PATH"
for dir in "${paths[@]}"; do
if [[ $dir == /mnt/* ]]; then
path_back "$dir"
fi
done
# Fix WSL Time: https://github.com/microsoft/WSL/issues/4245
sudo hwclock -s
This are needed to support X apps (like Emacs) even though the X server is forwarded. Specifically this fixes the clipboard.
sudo apt install xorg
sudo swapon --show
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
sudo cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o rw,size=8G tmpfs /mnt/ramdisk
Also undoes git rerere
recorded resolution.
git checkout -m
git log -G<pattern>
# sorted
git log --format='%aN' | sort -u -k 2
# by commit count
git shortlog -sne
Just add a second URL to the desired remote in .git/config
.
git update-index --assume-unchanged <file>
git commit --fixup :/foo
git merge-base topic master
git merge-base --fork-point topic
[url "ssh://[email protected]/"]
insteadOf = https://github.com/
- -v
- verbose
- -N
- no command
- -T
- no TTY
Here we want to access the local port (on the client) and have the traffic tunneled to the remote host and port on the server’s side.
ssh -v -N -T -L <local port>:<remote host>:<remote port> <server>
Here we want to access the local port (on the server) and have the traffic tunneled to the remote host and port on the client’s side.
ssh -v -N -T -R <local port>:<remote host>:<remote port> <server>
sudo apt install sshguard
sudo journalctl -u sshguard
- to TTY
- ctrl+alt+(F1|F2|F3)
- and back
- alt+(F7|F8|F9)
# New tool:
ss
# Old tool:
netstat -tulpn
nslookup andschwa.com
/msg nickserv identify andschwa <password>
/msg nickserv release/recover andschwa <password>
Use ShellCheck
or the website.
Read the Bash Guide and Bash Pitfalls.
# POSIX-compliant
command -v foo >/dev/null 2>&1 || { echo >&2 "Missing foo"; exit 1; }
# Caches path with Bash
hash foo 2>/dev/null || { echo >&2 "Missing foo"; exit 1; }
[[ (-e foo) && ! (-e bar) ]] && echo "foo exists but not bar"
while :; do
case $1 in
-h|--help)
cat << EOF
Usage:
foo [-f|--files] <file1,file2,...>
foo [-h|--help]
Prints this help.
EOF
exit
;;
-f|--files)
if [[ -n $2 ]]; then
IFS=$',' read -r -a files <<< "$2"
shift
else
exit 2
fi
;;
--)
shift
break
;;
-?*)
echo "Unknown option: $1"
exit 1
;;
*)
break
esac
shift
done
while read from to; do
find . -name "*.cmake" -or -name "CMakeLists.txt" | xargs sed -i "s/$from/$to/g"
done < replacements.txt
Any-Thing | Get-Member
Get-Command | Select-String "Invoke*"
Any-Thing | where {$_.Property -gt 3}
ls env:
Remove-Module
- $@
- The file name of the target of the rule.
- $<
- The name of the first prerequisite.
- $^
- The names of all the prerequisites, with spaces between them.
autoconf -vfi
./configure
make
Some projects will generate an ld
configuration file in
/etc/ld.so.conf.d/
, so update the cache with sudo ldconfig -v
.