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
#!/usr/bin/env python | |
from optparse import OptionParser | |
import redis | |
def main(): | |
parser = OptionParser() | |
parser.add_option("-d", "--database", default=0, help="target redis database, default is 0", dest="database") | |
parser.add_option("-a", "--address", default="127.0.0.1", help="target redis host, default is 127.0.0.1") | |
parser.add_option("-p", "--port", default=6379, help="target redis host, default is 127.0.0.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
cat > /tmp/iptables.generic <<EOF | |
*filter | |
:INPUT DROP [0:0] | |
:FORWARD ACCEPT [0:0] | |
:OUTPUT ACCEPT [0:0] | |
:LOGGING - [0:0] | |
-A INPUT -i lo -j ACCEPT | |
-A INPUT -d 127.0.0.0/8 ! -i lo -j REJECT --reject-with icmp-port-unreachable | |
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP |
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
#!/usr/bin/env bash | |
##This is very crude.. but its enough for me [meh] | |
# contents of this text file is a youtube URL per line.. EG: | |
#-- | |
#cat listofvideos.txt | |
#https://www.youtube.com/watch?v=RrLAaDCPc3I | |
#-- | |
fileVideoList=listofvideos.txt |
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
#!/usr/bin/env bash | |
# DESC: simple monitoring of directory growth.. does a du and informs you the diff on a loop | |
# defaults to 300 second loop | |
# USAGE: this_script.sh "/some/directory/to/watch" is the directory to watch | |
# sample output: | |
#Fri May 13 13:12:06 BST 2016: thing grew by 132 | |
#Fri May 13 13:17:07 BST 2016: thing grew by 83 | |
#Fri May 13 13:37:07 BST 2016: thing shunk by 1575 | |
#Fri May 13 13:42:07 BST 2016: thing grew by 596 |
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
#!/usr/bin/env bash | |
convert_to_lower (){ | |
IN="$1" | |
tr '[:upper:]' '[:lower:]' <<< "$IN" | |
} | |
clipboard_output(){ | |
#graps clipboard and prints to stdout |
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
#!/usr/bin/env bash | |
PATH=$PATH:/usr/bin/ | |
# how to long to keep backups for (in days) | |
KEEP=150 | |
# Where to keep them | |
BACKUP_PATH="/root/mysql_backups/sql" | |
host="localhost" |
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
#!/usr/bin/env bash | |
# I use this on servers hosting multiple containers. | |
# It lets me reasonably easily manage ports without typing too much | |
# Works on openvz and lxc... nothing really magical | |
# Beware the spoof detection ranges.. if you expect legit traffic from one of these networks the modify it | |
# There are a few bugs but generally this works well.. YMMV -david | |
#public IP on my host (eth0) | |
IP1=178.62.XX.XX |
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
#!/usr/bin/env bash | |
if [ "X$1" == X ]; then | |
echo "prepares a new container does the following:" | |
echo "- installs ssh keys from $KEYS" | |
echo "- sets random root passwords" | |
echo "- deletes the 'ubuntu' user" | |
echo | |
echo "usage: 'lxc-prep <container_name>'" | |
echo |
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
#!/usr/bin/env bash | |
#who gets alerted | |
DEST=your@email.com | |
#from address | |
FROM="noreply@server.example.org" | |
#directory to monitor | |
DIR=/www |
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
#!/usr/bin/env bash | |
# This script allows me to run a crontab at a random point in the next hour. | |
# WHY? | |
# Using something like a little delay can also stop ALL the servers hammering a proxy at once for example. | |
# ...or if something breaks I don't take the entire cluster down at once | |
# Do the task at some random point within the next X minutes: | |
X=60 |