Skip to content

Instantly share code, notes, and snippets.

Cole Tierney putnamhill

Block or report user

Report or block putnamhill

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
putnamhill /
Last active Jun 1, 2019
bash snippets - these are mostly just notes for myself; some I've found and some I've made
# add a remote url to an existing remote
git remote set-url origin --push --add another:repo.git
# check locally for internet access
netstat -nrf inet | grep -q ^default && \
echo internet is up || \
echo internet is down
# search LDAP for login name with wildcards
ldapsearch -x -LLL uid='cTiern*' uid | sed -n 's/^uid:[[:blank:]]//p' | uniq
usage() {
cat <<EOT
Usage: ${0##*/} [-l] [-h] pattern [arg2] ...
Prints lines containing a BRE pattern, after stripping binary data.
Sort of like strings command followed by grep, only better.
If no file paths are specified after the pattern, paths are
read from stdin (tip: feed with find).
on listReadOnlyVolumes
return shell_cmd_list("mount | sed -n 's/^\/dev\/.* on \(\/.*\) (.*read-only.*/\1/p'")
on nonEmptyFolderExists atPosixPath
rslt = shell_cmd_list("ls " &qq(atPosixPath) &" 2>/dev/null")
return count(rslt) > 0
on directoryExists atPosixPath
putnamhill /
Created Jun 13, 2012
This script prints the version of adobe director used to create a file. Now detects director file versions 6, 7, 8, 8.5 (or 9.0), 10.1, 11.5.0r593,, and 12.
#!/usr/bin/perl -w
use constant IFFTYPES => qw( RIFX XFIR );
use constant DIRTYPES => qw( MV93 39VM MC95 );
use constant {
INT_SIZE => 4,
use Getopt::Long;
#use diagnostics;
putnamhill /
Last active Oct 8, 2015
A bash version of the CLSID generator for Adobe Director MOA classes.
# - A bash version of the CLSID generator for Adobe Director MOA classes.
openssl rand -hex 16 | awk '{
printf "DEFINE_GUID(CLSID(CRegister), 0x%sL, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s);\n",
substr($0, 1, 8), substr($0, 9, 4), substr($0, 13, 4), substr($0, 17, 2),
substr($0, 19, 2), substr($0, 21, 2), substr($0, 23, 2), substr($0, 25, 2),
substr($0, 27, 2), substr($0, 29, 2), substr($0, 31, 2)
}' | \
putnamhill /
Created Nov 1, 2012
an email notifier that listens for finger connections from the mail server
# usage:
# sudo nohup notifymail 2>&1 >/dev/null
# to see if it is already running
# ps ax | egrep ' (sh /Users/colet/bin/[n]otifymail)|([n]c -l 79)$'
[ $(whoami) != 'root' ] && echo must be root && exit
# first clean up any old related processes
putnamhill / win2003-ntp.txt
Last active Dec 16, 2015
Configuring ntp on Windows 2003 using the command prompt. Use stratum two servers if possible:
View win2003-ntp.txt
net stop w32time
w32tm /unregister
w32tm /register
net time /setsntp:",0x1,0x1"
net start w32time
putnamhill / smtp-test
Last active Dec 18, 2015
smtp commands to test email between two servers via telnet
View smtp-test
telnet 25
Connected to
Escape character is '^]'.
220 running My Bitchin Mail Server 1.0.0
250 hello (
250 2.1.5 sender OK
putnamhill / mysql-notes
Last active Sep 29, 2016
Creating a new user with the mysql client and set some privileges for all the tables of a database.
View mysql-notes
CREATE USER 'someuser'@'localhost' IDENTIFIED BY 'cleartext-password';
GRANT SELECT,INSERT,UPDATE,DELETE ON `database`.* TO 'someuser'@'localhost';
putnamhill /
Created Jul 31, 2013
A simple bash stop watch.
START=$(date +%s)
read -s -n1 -p $'Press a key when done.\n'
ELAPSED_SECONDS=$(bc <<< "scale=10; ($(date +%s) - $START)")
if [ $ELAPSED_SECONDS -gt 60 ]; then
echo -n "$ELAPSED_MINUTES minutes "
You can’t perform that action at this time.