Instantly share code, notes, and snippets.

View ssh_config
# Put in ~/.ssh/config
Host *
ControlMaster auto
ControlPath ~/.ssh/%r@%h:%p
ControlPersist yes
ServerAliveInterval 30
View url_to_pdf.sh
#!/bin/bash
google-chrome --headless --disable-gpu --print-to-pdf="$PDF_NAME" "$URL"
View client.sh
#!/bin/bash
sudo apt install -y tor
# get hostname from /var/lib/tor/ssh/hostname on the server
torsocks ssh user@xxxxyyyyzzzzaaaa.onion
View bluetooth_off.sh
#!/bin/bash
rfkill block bluetooth
View fstab
# https://blog.ubuntu.com/2016/01/20/data-driven-analysis-tmp-on-tmpfs
# In /etc/fstab:
tmpfs /tmp tmpfs rw,size=128m,noexec,nosuid 0 0
View rescan_hd.sh
#!/bin/bash
echo "- - -" > sudo tee /sys/class/scsi_host/*/scan
View sysctl.conf
# put in /etc/sysctl.conf
net.core.default_qdisc=fq
net.ipv4.tcp_congestion_control=bbr
View Golang_Flame_Graphs.md
package main

import "runtime/pprof"

func main() {
	pprof.StartCPUProfile(os.Stderr)
	defer pprof.StopCPUProfile()

  // ...
View place_to_gps.sh
#!/bin/bash
place="$1"
curl "https://www.google.com/maps/place/${place}" -L -s --compressed |
grep -Po 'cacheResponse.+?\]' |
tr '[],()' ' ' |
awk '{print $4","$3}'
View battery_low.sh
#!/bin/bash
# "low" = lower than 60 because my chinese battery dies at 51%
cat /sys/class/power_supply/BAT0/uevent |
awk -F = '/_FULL=/{full=$2} /_NOW=/{now=$2} END{if(now/full < 0.6){print "Bettery " 100*now/full "%"}}' |
xargs notify-send