Skip to content

Instantly share code, notes, and snippets.

View chriseaton's full-sized avatar
🐢
Soup

Christopher Eaton chriseaton

🐢
Soup
View GitHub Profile
@chriseaton
chriseaton / tun-ssh-socks-tunnel-close.sh
Last active June 16, 2026 12:16
Use tun2socks fork to run all traffic over an SSH socks tunnel.
#!/bin/bash
PORT=27893
INTERNET_INTERFACE=$(nmcli -t -f DEVICE,STATE device status | awk -F: '$2 == "connected" && $1 != "tun0" && $1 != "lo" {print $1; exit}')
INTERFACE="tun0"
INTERFACE_CIDR="198.18.0.1/15"
INTERFACE_GATEWAY="198.18.0.1"
SSH_HOST="<my ssh host>"
SSH_IP=$(getent hosts "$SSH_HOST" | awk '{print $1}')
#disable tun route
@chriseaton
chriseaton / socks-ssh-tunnel-close.sh
Created June 11, 2026 11:54
Open and close a SOCKS proxy over an SSH tunnel. Update gnome settings to use the SOCKS proxy (or not when closed).
#!/bin/bash
PORT=27893
# Turn off proxy
gsettings set org.gnome.system.proxy mode 'none'
# Fetch all matching PIDs into an array
# -f matches full command arguments
readarray -t TUNNEL_PIDS < <(pgrep -f "ssh -D ${PORT} -N -f")

Programmatic Naming Convention Cheat Sheet

This cheatsheet is, shockingly, for programmers using programming languages to program.
Below are examples of the best naming conventions used in the programming world.

Note

You may have different thoughts on this, but they are wrong.

It's time to get with the program... ☜(⌒▽⌒)☞
These are the naming conventions that have bubbled-up through the decades as the most proficient and ideal, which is why they are some common today.

# use grep to search the output of the file for specific terms.
# the `-n` flag will output line numbers to the left of matches.
cat some.log | grep -n "Looking for..."
# you can then use the line number to find the entries on and around the entry.
# Note the line-number is used, as well as a count to includes a number of lines after.
# In this example, we're looking at lines starting at 3176101 and the +10 lines after.
sed -n '3176101,+10p' app.log