Skip to content

Instantly share code, notes, and snippets.

View perguth's full-sized avatar

Per Guth perguth

View GitHub Profile
@perguth
perguth / sslh.cfg
Created April 19, 2024 11:46
sslh.cfg
# /etc/sslh/sslh.cfg or /etc/sslh.cfg
verbose: true;
foreground: true;
inetd: false;
numeric: true;
#transparent: true; # ygg stops working when enabled
timeout: 900; # TCP default
user: "sslh";
pidfile: "/var/run/sslh.pid";
#!/bin/bash
# Convert all JPGs and PNGs in a directory and its
# subdirectories into WEBP images.
# converting JPEG images
find $1 -type f -and \( -iname "*.jpg" -o -iname "*.jpeg" \) \
-exec bash -c '
webp_path=$(sed 's/\.[^.]*$/.webp/' <<< "$0");
if [ ! -f "$webp_path" ]; then
# https://rgxg.github.io/
$ rgxg cidr '200::/7'
0?[23][0-9A-Fa-f]{2}((:(:[0-9A-Fa-f]{1,4}){1,6}|::|:[0-9A-Fa-f]{1,4}(:(:[0-9A-Fa-f]{1,4}){1,5}|::|:[0-9A-Fa-f]{1,4}(:(:[0-9A-Fa-f]{1,4}){1,4}|::|:[0-9A-Fa-f]{1,4}(:(:[0-9A-Fa-f]{1,4}){1,3}|::|:[0-9A-Fa-f]{1,4}(:(:[0-9A-Fa-f]{1,4}){1,2}|::|:[0-9A-Fa-f]{1,4}(::[0-9A-Fa-f]{1,4}|::|:[0-9A-Fa-f]{1,4}(::|:[0-9A-Fa-f]{1,4})))))))|(:(:[0-9A-Fa-f]{1,4}){0,4}|:[0-9A-Fa-f]{1,4}(:(:[0-9A-Fa-f]{1,4}){0,3}|:[0-9A-Fa-f]{1,4}(:(:[0-9A-Fa-f]{1,4}){0,2}|:[0-9A-Fa-f]{1,4}(:(:[0-9A-Fa-f]{1,4})?|:[0-9A-Fa-f]{1,4}(:|:[0-9A-Fa-f]{1,4}))))):(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])(\.(25[0-5]|2[0-4][0-9]|1[0-9]{2}|[1-9]?[0-9])){3})
### Keybase proof
I hereby claim:
* I am perguth on github.
* I am perguth (https://keybase.io/perguth) on keybase.
* I have a public key ASD3o_J-jMaLeKSggjQSgtldX8rQ6LSnINuqT-WFNriRcgo
To claim this, I am signing this object:
@perguth
perguth / sslh
Last active December 12, 2019 19:25
Configures the port multiplexer `sslh`.
# Configures the port multiplexer sslh
# https://github.com/yrutschle/sslh
# Place in /etc/defaults/sslh
RUN=no
DAEMON=/usr/sbin/sslh
DAEMON_OPTS="--user sslh --listen [201:6779:c497:82f:68fd:188d:4338:1234]:443 --listen 0.0.0.0:443 --tls 127.0.0.1:4443 --anyprot 127.0.0.1:44478 --pidfile /var/run/sslh/sslh.pid"
@perguth
perguth / shell
Created December 12, 2019 11:36
Shared terminal start script.
#!/bin/sh
# Place in `/usr/local/bin/shell`
# Starts a terminal session that is shared among endpoints.
/usr/bin/tmux new -A -s session1
@perguth
perguth / theia
Last active May 6, 2020 10:15
👩‍💻 Start Theia in the current directory and open browser window.
#!/bin/sh
# Start Theia in the current directory and open browser window.
# Theia configuration will be stored under ~/.theia
previousInstance=$(docker ps -q --filter ancestor=theiaide/theia:next --format="{{.ID}}")
if [ "$previousInstance" ]; then
docker kill $previousInstance > /dev/null
fi
@perguth
perguth / nano
Last active May 26, 2022 13:33
⏲️📝 Back ups every file that gets touched by `nano`.
#!/bin/sh
# Back ups every file that gets touched by `nano`.
# Install by:
# 1. `sudo mv /bin/nano /bin/nano-real`
# 2. Put this file in `/usr/local/bin` and make it executable.
# 3. Set your user:
backupFolder=$HOME/.system-changes
currentFolder=$(pwd)
eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
export PATH="$PATH:`yarn global bin`"
export MOSH_TITLE_NOPREFIX=1
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export PATH=$GOPATH/bin:/usr/local/go/bin:$PATH
export PATH=$PATH:~/.cargo/bin
@perguth
perguth / index.html
Last active August 16, 2019 14:56
Some website starter.
<!doctype html>
<title>My website</title>
<!-- Validate your own here: https://validator.w3.org/ -->
<main>
<h1>My website</h1>
<p>Some texts.</p>
</main>