Things
Minor stuff i think of as useful for people who happen to be the not me kind of person.
sitnol.sh
Send SIGHALT or SIGCONT to all user-processes, except SSH and everything that runs on a TTY. Good to run on LID events, stops f***ing flash shit from producing entropy.
#!/bin/sh
uids="$(cat /etc/passwd | egrep ":x:[0-9]{4,}" | cut -d ":" -f 3 | tr "\n" " ")"
#pids="$(ps U "${uids:0:-1}" -o pid | tr "\n" " ")"
pids="$(ps U "${uids:0:-1}" | egrep -v "(ssh)|(PID TTY)" | cut -d " " -f 1 | tr "\n" " ")"
if [ "$1" == "close" ]; then
for p in a $pids; do
if [[ "$p" =~ ^[0-9]+$ ]]; then
logger "Stopping $p"
kill -STOP $p
fi
done
else
for p in a $pids; do
if [[ "$p" =~ ^[0-9]+$ ]]; then
logger "Starting $p"
kill -CONT $p
fi
done
fi
If it doesn't work change the cut parameter "-f 1" to "-f 2".
rdbks
Simple backup script using rsync. Set a list of directories to back up within the script. Each directory can have a file ".exclude" with a list of thing to exclude from backup (rsync notation).
https://gist.github.com/0mark/6282320** Things
Minor stuff i think of as useful for people who happen to be the not me kind of person.
*** sitnol.sh
Send SIGHALT or SIGCONT to all user-processes, except SSH and everything that runs on a TTY. Good to run on LID events, stops f***ing flash shit from producing entropy.
[code]
#!/bin/sh
uids="$(cat /etc/passwd | egrep ":x:[0-9]{4,}" | cut -d ":" -f 3 | tr "\n" " ")"
#pids="$(ps U "${uids:0:-1}" -o pid | tr "\n" " ")"
pids="$(ps U "${uids:0:-1}" | egrep -v "(ssh)|(PID TTY)" | cut -d " " -f 1 | tr "\n" " ")"
if [ "$1" == "close" ]; then
for p in a $pids; do
if [[ "$p" =~ ^[0-9]+$ ]]; then
logger "Stopping $p"
kill -STOP $p
fi
done
else
for p in a $pids; do
if [[ "$p" =~ ^[0-9]+$ ]]; then
logger "Starting $p"
kill -CONT $p
fi
done
fi
[/code]
If it doesn't work change the cut parameter "-f 1" to "-f 2".
*** dmount
Simple script to mount/unmount things using dmenu.
https://gist.github.com/0mark/6282407
*** rdbks
Simple backup script using rsync. Set a list of directories to back up within the script. Each directory can have a file ".exclude" with a list of thing to exclude from backup (rsync notation).
https://gist.github.com/0mark/6282320