Skip to content

Instantly share code, notes, and snippets.

View mrpatrick's full-sized avatar

Patrick Tully mrpatrick

View GitHub Profile
@mrpatrick
mrpatrick / rackspace_statuspageio.sh
Created July 3, 2014 22:30
Get the status of Rackspace-ORD and set them on StatusPage.io Components
#!/bin/bash
# Set from statuspage.io
PAGE_ID=""
AUTH_TOKEN=""
# Set from statuspage.io Component ID's
COMP_SERVERS_NEXT=""
COMP_SERVERS_FIRST=""
COMP_LOAD_BALANCERS=""
@mrpatrick
mrpatrick / sed-tsv2mod_rewrite
Created September 5, 2014 19:39
sed command to create mod_rewrite rules from tab delimited spreadsheet.
cat redirects.tsv | sed -e 's/\(^\/\)\([a-zA-Z0-9\/!#$&-;=?%-_a-z~]*\)\(\t*\)\(.*\)/RewriteRule ^\/?\2$\4 [L,R=302]/'
@mrpatrick
mrpatrick / harvest_backup.worker
Created September 15, 2014 15:56
daily_harvest mysql backups automated on iron.io (worker file). http://workshop.avatarnewyork.com/project/daily-harvest/
# define the runtime language
runtime "python"
stack "python-2.7"
full_remote_build true
# includes
dir "Harvest"
file "harvest.json"
file "mysql.json"
@mrpatrick
mrpatrick / harvest_email.worker
Created September 15, 2014 16:15
daily_harvest email report automated on iron.io (worker file). http://workshop.avatarnewyork.com/project/daily-harvest/
# define the runtime language
runtime "python"
stack "python-2.7"
full_remote_build true
# includes
dir "Harvest"
file "harvest.json"
file "mailgun.json"
file "recipients.json"
$ mysqldump -u user -p'password' db-name foo | ssh user@remote.box.com mysql -u user -p'password' db-name foo
@mrpatrick
mrpatrick / force_git_pointer.sh
Last active August 29, 2015 14:23
Force branch pointer for current release
git branch -f stage release-v1.0.1
git push -f origin stage
@mrpatrick
mrpatrick / bad_robots_access_logs.sh
Created July 1, 2015 14:47
Find all robot user agents in logs, sort by hits
cat access_log | awk -F\" '{print $6}' | sort | uniq -c | sort -n |grep bot
# On branch master
git checkout gh-pages
git checkout master -- myplugin.js
git commit -m "Update myplugin.js from master"
@mrpatrick
mrpatrick / rest_drupal_pwd.sh
Created July 8, 2015 13:27
reset drupal admin password
drush upwd admin --password="s3cr3t"
@mrpatrick
mrpatrick / gzip_uncompressed_file_size.sh
Created July 22, 2015 15:52
find uncompressed file size. The first line returns the uncompressed file size in bytes
#!/bin/bash
time zcat test.gz| wc -c