Skip to content

Instantly share code, notes, and snippets.

View sdomi's full-sized avatar
I Hate The New New GitHub UI

Dominique Liberda sdomi

I Hate The New New GitHub UI
View GitHub Profile
sdomi /
Last active March 2, 2024 18:15

Magical Linux internet sharing: The Tutorial

The following tutorial assumes that you want to provide the interwebs to a PC connected via eth0 to your host, and that your host is connected to the world via wlan0.

  1. Set up the local IP address
# ifconfig eth0

or, if you're using ip:

# ip a a dev eth0
sdomi / gist:be43a82b5fb1d5a61d57194fbe842ba8
Created July 25, 2019 20:23
4chan image dumper w/ following links
from bs4 import BeautifulSoup
import urllib.request
import sys
import re
import os
arg = sys.argv[1]
opener = urllib.request.build_opener()
sdomi /
Created October 17, 2018 20:08
Automatic XPI version patcher
if [[ -f $1 ]]; then
echo "XPI Patcher by reds"
mkdir "$1_tmp"; cd "$1_tmp";
unzip ../$1
sed '/<em:targetApplication>$/,/<\/em:targetApplication/!{//!b};d' install.rdf | sed '/<\/Description>$/,/<\/\/RDF/!{//!b};d' > install_.rdf
echo "
<!-- Firefox -->
sdomi /
Created May 27, 2018 21:59
Fujitsu LifeBook P1610 run-before-touchscreen-perl-driver commands. Yay!
stty -F /dev/ttyS0 9600 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke
setserial /dev/ttyS0 port 0x0220 irq 4 autoconfig
xsetwacom --set "Wacom Bamboo Connect Pen stylus" MapToOutput 1280x1024+0+0
while true; do
sudo evtest --query /dev/input/event2 EV_KEY KEY_LEFTMETA
if [[ $? == 10 ]]; then
xdotool mousedown 1
xdotool mouseup 1
sdomi /
Created May 19, 2018 11:19
script for measuring raspberry pi's GPU and CPU temp (requires superuser for gpu)
cpu=$(cat /sys/class/thermal/thermal_zone0/temp)
cpureal=$(echo $cpu | cut -c 1-2).$(echo $cpu | cut -c 3-6)\'C
gpu=$(vcgencmd measure_temp | cut -c 6-11)
echo "CPU: $cpureal | GPU: $gpu"
sdomi / isnetup
Created May 16, 2018 15:48
magic internet checker in bash
# has interweb come back up? know today with this one simple trick!
if ! [[ $ip ]]; then
while true; do
if ping -c 1 $ip &> /dev/null; then
notify-send --urgency=critical --icon=firefox "Internet is back up!"
background = default default
frame = white default
window_title = white default
directory = cyan default bold
selected_directory = black green
playlist = white default bold
selected_playlist = black green
file = white default
selected_file = black green
marked_file = white default bold