Skip to content

Instantly share code, notes, and snippets.

@bwhmather
bwhmather / reload
Last active April 5, 2023 09:45
Restart a process when a command changes in the current directory
#!/usr/bin/sh
while true; do
reset;
"$@" &
PID=$!;
inotifywait -e MODIFY --recursive .;
kill $PID;
wait $PID;
done

Keybase proof

I hereby claim:

  • I am bwhmather on github.
  • I am bwhmather (https://keybase.io/bwhmather) on keybase.
  • I have a public key ASBri6MY1RlNTLY4Sy34gaGLuRtf2-Hx7vGtZLwa85Covgo

To claim this, I am signing this object:

@bwhmather
bwhmather / rerun
Last active February 26, 2022 10:33
Run a command when a file changes in the current directory
#!/usr/bin/sh
while true; do
reset;
"$@";
inotifywait -e MODIFY --recursive .;
done
@bwhmather
bwhmather / xcf2png
Created January 9, 2014 23:52
simple script for converting from xcf to png using gimp
#!/usr/bin/env python
from subprocess import call
from sys import argv
from os.path import abspath
# encode + decode required for python 3
# TODO make sure that scheme escapes in the same way as c
infile = abspath(argv[1]).encode('unicode_escape').decode('utf-8')
outfile = abspath(argv[2]).encode('unicode_escape').decode('utf-8')