Skip to content

Instantly share code, notes, and snippets.

View waynegraham's full-sized avatar

Wayne Graham waynegraham

View GitHub Profile
@waynegraham
waynegraham / gist:8804121
Last active August 29, 2015 13:56
Disable OPCache in Mamp
cd /Applications/MAMP/conf
find . -name '*.ini' | xargs sed -i.bak 's/opcache.enable_cli=1/opcache.enable_cli=0/g'
@waynegraham
waynegraham / gist:9213901
Created February 25, 2014 17:40
Convert 4326 to 900913
var degrees2meters = function(lon,lat) {
var x = lon * 20037508.34 / 180;
var y = Math.log(Math.tan((90 + lat) * Math.PI / 360)) / (Math.PI / 180);
y = y * 20037508.34 / 180;
return [x, y]
}
x = 39.954119;
y = -75.162482;
@waynegraham
waynegraham / gist:9412783
Created March 7, 2014 14:47
Git Log Report
git log --author="Wayne Graham" --pretty=tformat: --numstat | gawk '{ add += $1 ; subs += $2 ; loc += $1 - $2 } END { printf "added lines: %s removed lines : %s total lines: %s\n",add,subs,loc }' -
@waynegraham
waynegraham / post-receive
Last active August 29, 2015 13:57
Deploy jekyll site with post-recieve hook

Make sure user's public key (id_rsa.pub) is in the ~/.ssh/authorized_keys.

laptop$ ssh deployer@example.com
server$ mkdir -p /usr/local/projects/[project_name]/shared/[project_name].git
server$ cd /usr/local/projects/[project_name]/shared/[project_name].git
server$ git --bare init
server$ touch hooks/post-receive
server$ mkdir -p /usr/local/projects/[project_name]/current
#! /usr/bin/env bash
# declare servers to clear the cache on
servers=('sdsv1' 'sdsv2' 'sdsv3')
LOG_FILE="/usr/local/projects/quandu-cocoon/shared/cache_cleared.log"
logit()
{
echo "[`date`] - ${*}" >> ${LOG_FILE}
}
@waynegraham
waynegraham / gist:9936072
Created April 2, 2014 15:07
subversion differences in last file that was modified
svn diff < "$(svn st | tail -1 | awk '{print $2}')"
@waynegraham
waynegraham / gist:ebb331835676cd5cecad
Last active August 29, 2015 14:01
Neatline select points and centroid
-- for a point
SELECT AsText(GeometryN(GeomFromText(AsText(coverage)), 1))
FROM omeka_neatline_records
WHERE id = 562;
-- for geometry
SELECT AsText(centroid(GeometryN(GeomFromText(AsText(coverage)), 1)))
FROM omeka_neatline_records
WHERE id = 571;
@waynegraham
waynegraham / gist:8d89c92246f0bb96ee78
Created May 15, 2014 15:25
Calculate map_focus from coverage for neatline
UPDATE omeka_neatline_records
SET map_focus = concat(X(coverage), ', ', Y(coverage))
, map_zoom = 8
WHERE exhibit_id = 21;
@waynegraham
waynegraham / gist:f85ab5591998c269e10a
Created June 3, 2014 15:43
Add unversioned files to subversion (svn) repository
svn add $(svn st|grep ^\?|cut -c2-)
svn status | grep '\?' | awk '{print $2}' | xargs svn add
svn add . --force
svn add *
@waynegraham
waynegraham / loader.sh
Created June 6, 2014 17:18
Bash for crontab to push geotiffs to geoserver
#! /usr/bin/env bash
shopt -s nullglob
TIFFS="/usr/local/projects/faculty_neatline/tiffs/*.tif"
WORK_DIR='/tmp'
GS_USER=""
GS_PASS=""
GS_SERVER=""
GS_WORKSPACE="neatline"