This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# http://serverfault.com/a/767361/33170 | |
displays=`ps aux | grep Xvnc | grep -v 'grep\|sed' | sed -r 's|.*(Xvnc :[0-9]*).*|\1|' | cut -d' ' -f 2` | |
limit=30 | |
date | |
echo "Checking for inactive sessions!" | |
while read -r d; do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# project name is first argument | |
PROJECTNAME=$1 | |
shift | |
if [ -z "$PROJECTNAME" ]; then | |
echo "You gotta specify a name for your project, you big dummy!" | |
exit 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Note: This gist is superseded by an improved script: | |
# https://github.com/mnebuerquo/virtuous-python | |
# Run a python script, and manage the virtualenv for me so I don't have to | |
# https://gist.github.com/mnebuerquo/4da76a007d18964dc3f7ce43e213b46f | |
# Run: ./run app.py [--argument --other file --whatever] | |
# Test: ./run --test [<--more-pytest-args-here>] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# mongodb is in a private network somewhere, host is a machine which can connect | |
# after running this script, you can connect to mongo at localhost | |
MONGO=$1 | |
HOST=$2 | |
ssh -fnN \ | |
-L 27017:$MONGO:27017 \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://stackoverflow.com/a/19647596/5114 | |
def flatten_dict(dd, separator='_', prefix=''): | |
return { prefix + separator + k if prefix else k : v | |
for kk, vv in dd.items() | |
for k, v in flatten_dict(vv, separator, kk).items() | |
} if isinstance(dd, dict) else { prefix : dd } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $(id -u) -ne 0 ]; then | |
echo "Nope. Simon didn't say so!" | |
exit 1; | |
fi | |
if [ -z "$1" ]; then | |
echo "What's my name? Say my name, bitch!" | |
exit 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Install docker on machine, add a user to the docker group. | |
# first, find out if we're sudo | |
if [ $(id -u) -ne 0 ]; then | |
echo "Nope. Simon didn't say so."; | |
exit 1; | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# find out if we're sudo | |
if [ $(id -u) -ne 0 ]; then | |
echo "Nope. Simon didn't say so."; | |
exit 1; | |
fi | |
target="/dev/md0" | |
mountpoint="/data" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# rotate mongodb | |
# https://stackoverflow.com/a/8396266/5114 | |
/var/log/mongo/*.log { | |
daily | |
rotate 30 | |
compress | |
dateext | |
missingok | |
notifempty | |
sharedscripts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# first, find out if we're sudo | |
if [ $(id -u) -ne 0 ]; then | |
echo "Nope. Simon didn't say so."; | |
exit 1; | |
fi | |
for user in $(cut -f1 -d: /etc/passwd); do | |
crons=$(crontab -u $user -l 2>/dev/null | grep -v '^#') |
OlderNewer