Skip to content

Instantly share code, notes, and snippets.

ryanbarrett /
Created Jan 11, 2017
Generate Passwords from the list of EFF dice passwords
import sys
import argparse
import random
import re
argparser = argparse.ArgumentParser(
description='Arguments that may be parsed.', epilog="Use good passwords")
argparser.add_argument('--words', default=5, type=int,
help='Number of words to return. e.g. --words 5 (default)')
argparser.add_argument('--filename', default='eff_large_wordlist.txt', type=str,
ryanbarrett / check_ssl_certificate
Last active Nov 11, 2016
nagios check_ssl_certificate
View check_ssl_certificate
#!/usr/bin/perl -w
# check_ssl_certificate
# Nagios script to check ssl certificate expirations
# Copyright (c) 2006-2008 David Alden <>
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
ryanbarrett /
Last active Jul 21, 2016
Nagios script to check file size with human readable input and output (in python). Similar to ./ -F file.txt -s 5000000,10000000
import argparse,os
#Return OK, Warning, or Critical for nagios to parse.
argparser = argparse.ArgumentParser(description='Nagios script to check file size with human readable input and output (in python). Similar to ./ -F file.txt -s 5000000,10000000',epilog="Thanks, Hope you like it. -Ryan")
argparser.add_argument('--missingfileok','-m',action='store_true',help='If the file does not exist return OK.')
argparser.add_argument('--file','-f',type=str,required=True,help='Pass in full path and file name i.e. --file /test/123/filename.txt ')
argparser.add_argument('--critical','-c',type=str,required=True,help='K,M, or G, defaults to bytes')
argparser.add_argument('--warning','-w',type=str,required=True,help='K,M, or G, defaults to bytes')
args = argparser.parse_args()
suffixes = ['K', 'M', 'G', 'T']
ryanbarrett / .screenrc.prettyping
Created Jun 1, 2016
using denilsonsa/prettyping to ping 8 network nodes and display in one terminal session. (Screen version 4.03.01 (GNU) 28-Jun-15)
View .screenrc.prettyping
startup_message off
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{..G}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a"
screen -t host0 0 /home/user/bin/prettyping host0
screen -t host1 1 /home/user/bin/prettyping host1
screen -t host2 2 /home/user/bin/prettyping host2
screen -t host3 3 /home/user/bin/prettyping host3
screen -t host4 4 /home/user/bin/prettyping host4
ryanbarrett / .screenrc
Last active Jun 11, 2016 — forked from jbeluch/.screenrc
Basic .screenrc
View .screenrc
startup_message off
hardstatus on
hardstatus alwayslastline
hardstatus string "%{..B}%n %t %=%{..B} %H %{..B} %m/%d %C%a"
defscrollback 30000
screen -t bash0 0
screen -t bash1 1
screen -t pypthon 2 python
View gist:f850f734d68ab98e7059
#Tried this, It did not work:
# Put at bottom of /etc/sysctl.conf:
net.ipv6.conf.all.disable_ipv6 = 1
net.ipv6.conf.default.disable_ipv6 = 1
net.ipv6.conf.lo.disable_ipv6 = 1
# Then run:
sudo sysctl -p
View Grep History Function .bashrc
# Add to ~/.bashrc, ~/.profile, or similar
# Usage:
# $gh nano
# Returns:
# 50 nano .bashrc
function gh { history | grep $1; }
ryanbarrett /
Created Jul 2, 2015
Crontab; start a program if it is not running
if ps -ef | grep -v grep | grep ; then
exit 0
~/scripts/ >> /dev/null &
echo "Restarting, it was not running." | wall
exit 0
import argparse
argparser = argparse.ArgumentParser(description='Arguments that may be parsed.',epilog="The Epilog")
argparser.add_argument('--test',action='store_true',help='Simulate the Run')
argparser.add_argument('--dir','-d',type=str,required=True,help='Required variable "dir" with the following text as its value. i.e. --dir /test/123/ ')
argparser.add_argument('--optionaldefault','-o',default="the default value",type=str,help='Creates a variable "optionaldefault" ')
argparser.add_argument('--integer','-i',default=0,type=int,help='Creates a variable "integer" with the value 0 if nothing is specified.')
args = argparser.parse_args()
ryanbarrett / btsync
Last active Jan 3, 2016
Bittorrent Sync btsync Ubuntu Autostart script init.d To Export config file sample: ./btsync --dump-sample-config > sync.conf
View btsync
#! /bin/sh
# /etc/init.d/btsync
# Carry out specific functions when asked to by the system
case "$1" in
/etc/btsync/btsync --config /etc/btsync/sync.conf