Skip to content

Instantly share code, notes, and snippets.

View pwenzel's full-sized avatar

Paul Wenzel pwenzel

View GitHub Profile
@pwenzel
pwenzel / header-uname.php
Created November 20, 2012 16:08
Output Server Hostname as HTTP Header
<?php
// return host name from server for debugging purposes
header('X-App-Host: served from ' . php_uname('n'));
@pwenzel
pwenzel / screenshot-responsive.sh
Created November 7, 2012 00:06
Capture Screenshots of Multiple Sizes
for w in 320 640 960;
do webkit2png -Fs 1 -W $w -o $w$(date +%Y%m%d-%H%M%S) "http://mediaqueri.es";
done
@pwenzel
pwenzel / box_autologin_using_expect.sh
Created November 4, 2012 16:42
Mount Box.net via WebDAV using Expect
#!/usr/bin/expect
# set variables
set username [email protected]
set password changeme
set certificate_accept y
spawn mount -t davfs https://www.box.com/dav/ /mnt/box.net/
# Look for username prompt
expect "username:"
@pwenzel
pwenzel / internet_radio_stream_aliases.sh
Created October 23, 2012 15:16
Internet Radio Streams Via Command Line
# 1. Install mplayer command line (via Brew, Macports, or APT)
# 2. Add the following aliases to ~/.profile
# 3. Type `source ~/.profile`
# 3. Type `news` or `current` to listen in your terminal
alias news="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/news.pls" # MPR News
alias current="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/the_current.pls" # The Current
alias classical="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/classical.pls" # Classical MPR
alias localcurrent="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/local.pls" # Local Current
alias heartland="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/radio_heartland.pls" # MPR Radio Heartland
@pwenzel
pwenzel / .ackrc
Created September 11, 2012 17:12
.ackrc
# add .tpl for smarty files
--type-set=smarty=.tpl
--type-set=tpl=.tpl
# plain text CSV files
--type-set=csv=.txt,.csv,.tsv
# CSS/LESS
--type-set=css=.css,.less
@pwenzel
pwenzel / require_all_helper.php
Created August 23, 2012 17:07
Recursively include all PHP files
<?php
/**
* Scan the api path, recursively including all PHP files
*
* @param string $dir
* @param int $depth (optional)
*/
protected function _require_all($dir, $depth=0) {
if ($depth > $this->max_scan_depth) {
@pwenzel
pwenzel / git deploy
Last active October 7, 2015 06:07
Git Deploy Alias
# Push changes from development branch into production
# Add to .git/config
[alias]
deploy = !sh -c 'git checkout master && git merge development && git checkout development && git push --all'
@pwenzel
pwenzel / git-log-to-tsv.sh
Created June 6, 2012 20:53
Git Log to Tab-Delimited CSV File
# Local Dates:
git log --date=local --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.local.tsv.txt
# ISO Dates:
git log --date=iso --pretty=format:"%h%x09%an%x09%ad%x09%s" > commits.iso.tsv.txt
@pwenzel
pwenzel / akamai_cache_test.sh
Created May 16, 2012 14:06
Test Akamai Headers
# http://mesmor.com/2012/03/18/akamai-pragma-debug-headers/
alias akacurl='curl -v -s -o /dev/null -H "accept-encoding: gzip" -H "Pragma: akamai-x-get-cache-key" -H "Pragma: akamai-x-cache-on" -H "Pragma: akamai-x-cache-remote-on" -H "Pragma: akamai-x-get-true-cache-key" ';
akacurl http://example.com/akamai-test-object.html;
@pwenzel
pwenzel / post-receive
Created April 23, 2012 01:33
hooks/post-receive deploy script
#!/bin/sh
GIT_WORK_TREE=/home/username/webapps/django/myproject git checkout -f
GIT_WORK_TREE=/home/username/webapps/django/myproject git reset --hard