Skip to content

Instantly share code, notes, and snippets.

@wiedehopf
wiedehopf / Commands for management:
Last active December 14, 2019 09:34
readsb template systemd service
# enable start of all instances system startup:
systemctl enable readsb.service
# start/restart all instances:
systemctl restart readsb
# stop all:
systemctl stop readsb
# restart individual:
@wiedehopf
wiedehopf / script.sh
Created January 2, 2021 11:05 — forked from sergeycherepanov/script.sh
shallow update not allowed
Here's what I ended up doing - it worked perfectly. Note that I was moving from my old host (Bitbucket) to my new one (Gitlab). My comments are above the commands:
# First, shallow-clone the old repo to the depth we want to keep
git clone --depth=50 https://...@bitbucket.org/....git
# Go into the directory of the clone
cd clonedrepo
# Once in the clone's repo directory, remove the old origin
git remote remove origin
@wiedehopf
wiedehopf / example.md
Last active June 16, 2024 18:01
Haproxy: Ugly bash script to update ACL entries without reloading haproxy

This would be in the haproxy config:

acl whitelist src -f /etc/haproxy/whitelist.txt

Then you could update the file and then to update haproxy without restarting it using the update-table.sh script:

./update-table.sh whitelist.txt
import asyncio
import traceback
import time
import zlib
import ujson
import sys
def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)
set cmdheight=2
set number
"set t_Co=256
colorscheme default
set bg=dark
set undofile
set undodir=$HOME/.vim/undo
set undolevels=1000
set undoreload=10000
#!/bin/bash
set -e
function mainpid() {
systemctl show --property MainPID haproxy | cut -d= -f2
}
while sleep 0.15; do
OLDPID=$(mainpid)
@wiedehopf
wiedehopf / sendterm.sh
Last active August 23, 2022 22:34
haproxy SIGTERM test
#!/bin/bash
set -e
function mainpid() {
cat /run/haproxy.pid || true
}
cycles=0
while sleep "0.01"; do
@wiedehopf
wiedehopf / run-haproxy.sh
Last active September 8, 2022 15:33
haproxy sigterm test
#!/bin/bash
OUTPUT=run-haproxy.log
echo writing log to $OUTPUT
run=0
while sleep 0.00001; do
echo Run $(( ++run )): starting haproxy
echo ---------------------------------------------------
/usr/local/sbin/haproxy -W -f /etc/haproxy/haproxy.cfg -p /run/haproxy.pid -S /run/haproxy-master.sock
@wiedehopf
wiedehopf / gist:9fcf92fffd1fb848ef1ea616dc1d1918
Last active October 14, 2023 10:19
wow simming short explanation
https://www.curseforge.com/wow/addons/wowsimsexporter
For search in curseforge app: wowSims Exporter
Ingame type /wse
Export spec / gear
Download sim:
https://github.com/wowsims/wotlk/releases ---> https://github.com/wowsims/wotlk/releases/download/v0.1.41/wowsimwotlk-windows.exe.zip
Extract, copy exe to desktop or wherever you want it.
@wiedehopf
wiedehopf / bash_lock.md
Last active June 16, 2024 17:48
bash lock flock

Protecting a bash script against concurrent execution.

This is very simple and easy in bash and probably fine in sh (not tested). The lockfile is never deleted but that is not an issue.

exec 9>>mylockfile

if ! flock --exclusive --nonblock 9; then
 echo "$(date -u +"%FT%T.%3NZ") $$: scriptname will wait for lock"