Skip to content

Instantly share code, notes, and snippets.

View skyebook's full-sized avatar

Skye Book skyebook

View GitHub Profile
@skyebook
skyebook / gist:2038029
Created March 14, 2012 17:21
PostGIS GDAL Setup
/usr/bin/ld: cannot find -ldgal
/dev/zero: file not recognized: File format not recognized
collect2: ld returned 1 exit status
@skyebook
skyebook / gist:2039034
Created March 14, 2012 19:53
PostGIS r9499 Regression Test
develop@develop-VirtualBox:~/src/postgis$ make check
/usr/bin/perl utils/svn_repo_revision.pl
Not updating existing rev file at 9499
for s in liblwgeom libpgcommon postgis regress raster topology loader utils extensions; do \
echo "---- Making all in ${s}"; \
make -C ${s} all || exit 1; \
done;
---- Making all in liblwgeom
make[1]: Entering directory `/home/develop/src/postgis/liblwgeom'
WARNING: Lexer not generated. Run 'make parse' to manually build lexer/parser.
@skyebook
skyebook / gist:3152659
Created July 20, 2012 19:13
Mercator Meters Per Pixel
public static final double EARTH_CIRCUMFERENCE = 637279.82;
public double getMetersPerPixelAt(LatLon latLon, int zoomLevel){
//S=C*cos(y)/2^(z+8)
double latCos = Math.cos(Math.toDegrees(latLon.getLat()));
System.out.println("latCos " + latCos);
double result = EARTH_CIRCUMFERENCE*latCos;
return result/Math.pow(2, zoomLevel+8);
}
@skyebook
skyebook / gist:3231657
Created August 1, 2012 23:52
Post Body to Javascript Fail
function doRequest(request, headers, http_method, request_body, successCallback, failureCallback){
$.ajax({
url: api+request,
headers: headers,
data:JSON.stringify(request_body),
//data:request_body,
processData:false,
type: http_method,
contentType: "application/json",
error: function(XMLHttpRequest, textStatus, errorThrown){
@skyebook
skyebook / gist:3288293
Created August 7, 2012 18:50
wp_options cleanser
<?php
/**
* Remove expired transients from the wp_options table.
* This script cycles through a number of expired transients until it doesn't find anymore.
* Our wp_options tables has over 2 million stale entries at time of writing, this limiting is really needed
* @author Skye Book
*/
$user = "";
$pass = "";
@skyebook
skyebook / backup_postgres.sh
Last active April 16, 2016 13:20
Backup OpenShift PostgreSQL Database
#!/bin/bash
# Backs up the OpenShift PostgreSQL database for this application
# by Skye Book <skye.book@gmail.com>
NOW="$(date +"%Y-%m-%d")"
FILENAME="$OPENSHIFT_DATA_DIR/$OPENSHIFT_APP_NAME.$NOW.backup.sql.gz"
pg_dump $OPENSHIFT_APP_NAME | gzip > $FILENAME
skyebookpro:Party skyebook$ rhc app restart -a MPCParty
Password: ************
Problem reported from server. Response code was 500.
Re-run with -d for more information.
RESULT:
Node execution failure (invalid exit code from node). If the problem persists please contact Red Hat support.
skyebookpro:Party skyebook$ rhc app force-stop -a MPCParty
@skyebook
skyebook / gist:3698357
Created September 11, 2012 13:12
Delete WordPress transients
DELETE FROM `wp_options` WHERE `option_name` LIKE '_transient_%'
@skyebook
skyebook / gist:3701793
Created September 11, 2012 20:33
Migrate to new git repository and keep history
# Go to the new repository
cd /path/to/new
# Add the original repository as a remote
git remote add original /path/to/old
# Get the original's branch and merge it into yours
git fetch original/master
git merge original/master
@skyebook
skyebook / gist:3701879
Created September 11, 2012 20:43
Git merge with theirs strategy
# Use the 'theirs' strategy option during a git merge
git merge -Xtheirs original/master