Skip to content

Instantly share code, notes, and snippets.

View jtrobman's full-sized avatar
💭
Hello world.

Jason Trobman jtrobman

💭
Hello world.
View GitHub Profile
@jtrobman
jtrobman / quote.sh
Created July 19, 2013 19:06
Bash script that uses the Yahoo Finance API to get stock quotes.
#!/bin/bash
# http://www.jarloo.com/yahoo_finance/
if [ "$1" == "all" ]
then
echo $(date +'%Y%m%d %H:%M') $(curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=aapl&f=l1,c');
echo $(date +'%Y%m%d %H:%M') $(curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=msft&f=l1,c');
echo $(date +'%Y%m%d %H:%M') $(curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=yhoo&f=l1,c');
else
echo $(date +'%Y%m%d %H:%M') $(curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s='+$1+'&f=l1,c');
@jtrobman
jtrobman / gist:7661586
Last active December 29, 2015 11:09
Apache config to render all Drupal files from www except CSS and JS.
ProxyPassMatch .+/files/(css|js)/.+ !
ProxyPassMatch ^/sites/(.+)/files/(.+)$ http://www.$1/sites/$1/files/$2
@jtrobman
jtrobman / apns
Created May 5, 2014 13:44
create the pem file for apple push notification service
To use the Apple Push Notification Service, you need to download your iOS Certificate from the Apple Developer site and import them into your Mac keychain. Next step, export the private key as key.p12 and the cert as cert.p12 then run these shell commands.
openssl pkcs12 -clcerts -nokeys -out apns-cert.pem -in cert.p12
openssl pkcs12 -nocerts -out apns-key.pem -in key.p12
openssl rsa -in apns-key.pem -out apns-key-noenc.pem
cat apns-cert.pem apns-key-noenc.pem > apns.pem
@jtrobman
jtrobman / build_acquia.sh
Created May 20, 2014 19:43
CI with Jenkins, Github and Acquia
#!/bin/bash
if [ -z $acquia_dev_server ]; then
acquia_dev_server="dev"
fi
echo "***********************************************"
echo "Configuration"
echo "***********************************************"
echo "site = $site"
@jtrobman
jtrobman / apachemem.sh
Created May 28, 2014 18:46
Average Apache Process Memory Usage
#!/bin/bash
# https://www.goettner.net/2012/average-apache-process-memory-usage/
ps aux | grep apache2 | grep -v pts | awk '{ tot += $6; procs += 1; print $2,$6,$11 } END { print "TOTAL: ",tot,"/",procs,"=",tot/procs }'
@jtrobman
jtrobman / git_set_email.sh
Created October 30, 2015 20:09
Set your git email on a bunch of directories at once.
#!/bin/bash
# FIRST
# cd to the directory where you keep your codez
# SECOND
# loop over all the directories that contain a git repo
find . -name '.git' -type d -prune | while read d; do
cd $d/..
git config user.email "[email protected]"
openssl req -new -newkey rsa:2048 -nodes -keyout private.key -out site_com.csr