Skip to content

Instantly share code, notes, and snippets.

View rcoup's full-sized avatar

Robert Coup rcoup

View GitHub Profile
@rcoup
rcoup / ephemeral-setup.sh
Created August 7, 2012 22:49 — forked from alq666/bootstrap.sh
Raid0 bootstrap for ephemeral EC2 disks
# On EC2, /mnt is usually already on
mounted=$(mount | grep /mnt | wc -l)
if [ $mounted -eq 1 ]; then
umount -l /mnt
fi
# Install mdadm and xfsprogs unattended
DEBIAN_FRONTEND=noninteractive apt-get -y install mdadm xfsprogs
# Create a RAID0 volume with 256KiB stripes, ignore what's already on the device
@rcoup
rcoup / test1-fd.xml
Created October 1, 2012 19:41
ESRI FileGDB/FGDB API - Null/Empty Geometries Test
<esri:DataElement xsi:type='esri:DEFeatureDataset' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:esri='http://www.esri.com/schemas/ArcGIS/10.1'>
<CatalogPath>\test1</CatalogPath>
<Name>test1</Name>
<ChildrenExpanded>false</ChildrenExpanded>
<DatasetType>esriDTFeatureDataset</DatasetType>
<Versioned>false</Versioned>
<CanVersion>false</CanVersion>
<Extent xsi:nil="true"/>
<SpatialReference xsi:type='esri:ProjectedCoordinateSystem'>
<WKT>PROJCS["WGS_1984_UTM_Zone_20N",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",-63.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0],AUTHORITY["EPSG",32620]]</WKT>
@rcoup
rcoup / pg_comparator.diff
Created December 3, 2012 21:29
pg_comparator: #1011286 Hash collisions cause more errors
--- ../2.1/pg_comparator-2.1.1/pg_comparator 2012-08-20 21:15:10.000000000 +1200
+++ pg_comparator 2012-12-04 10:28:33.120672197 +1300
@@ -2148,6 +2148,24 @@
dbh_serialize($dbh, $db); # async_wait if needed
}
+sub elementwise_compare
+{
+ my ($xref, $yref) = @_;
+
@rcoup
rcoup / gist:4323780
Created December 18, 2012 00:28
table_version.ver_get_lds_survey_non_bdy_marks_diff()
bde_db=# \df+ table_version.ver_get_lds_survey_non_bdy_marks_diff
List of functions
Schema|Name|Result data type|Argument data types|Type|Volatility|Owner|Language|Source code|Description
table_version|ver_get_lds_survey_non_bdy_marks_diff|TABLE(_diff_action character, id integer, name character varying, "order" integer, nominal_accuracy numeric, date_last_adjusted timestamp without time zone, shape geometry)|p_revision1 integer, p_revision2 integer|normal|volatile|bde_dba|plpgsql|
DECLARE
v_revision1 INTEGER;
v_revision2 INTEGER;
v_temp INTEGER;
v_base_version INTEGER;
v_revision_table TEXT;
@rcoup
rcoup / gist:4780273
Last active December 12, 2015 13:39
Selenium Async JS execution idea?
class BaseTestCase(TestCase):
def __init__(self, *args, **kwargs):
super(BaseTestCase, self).__init__(*args, **kwargs)
self._script_id = 0
def my_sync_test(self):
result = self.js("""
var result = {foo: [1,2,3]};
testDone(result);
""")
@rcoup
rcoup / gist:4991063
Last active December 13, 2015 23:19
gdal relativeToVRT resolution for symlinks

/path/to/data/foo.vrt:

<VRTDataset rasterXSize="512" rasterYSize="512">
  <GeoTransform>440720.0, 60.0, 0.0, 3751320.0, 0.0, -60.0</GeoTransform>
  <VRTRasterBand dataType="Byte" band="1">
    <ColorInterp>Gray</ColorInterp>
    <SimpleSource>
      <SourceFilename relativeToVRT="1">images/utm.tif</SourceFilename>
 1
@rcoup
rcoup / response1.xml
Created February 28, 2013 22:07
Geoserver - MultiPolygon vs MultiSurface responses for same request
@rcoup
rcoup / pr-1889.patch
Created April 15, 2013 23:34
Squashed patch for https://github.com/mapbox/tilemill/pull/1889 (Export to mbtiles with bounds that cross the anti-meridian)
From 209281e89e5130813186ac3cbc345b15353aea3b Mon Sep 17 00:00:00 2001
From: Ryan Lewis <ryansname@gmail.com>
Date: Thu, 31 Jan 2013 17:08:34 +1300
Subject: [PATCH] Let users export mbtiles that cross the anti meridian by
writing to the file multiple times with different bounds.
* Only applies to mbtiles exports
* Doesn't allow saving projects across the anti-meridian (since loading errors out)
---
commands/export.bones | 216 +++++++++++++++------------
@rcoup
rcoup / test_pool.cpp
Created May 7, 2013 20:21
Test case for Mapnik #1823
/*
Test case for Mapnik #1823
*/
#include <postgis/postgis_datasource.hpp>
#include <mapnik/params.hpp>
#include <iostream>
#include <mapnik/map.hpp>
using namespace mapnik;
@rcoup
rcoup / pg-connection-check-http.py
Last active December 17, 2015 12:29
A Simple PostgreSQL connection checker implemented as a HTTP server.
#!/usr/bin/env python
"""
A Simple PostgreSQL connection checker implemented as a HTTP server.
Helps with things like Amazon ELB with a slightly more nuanced check than a TCP
socket. You can pass in a DSN string, or inherit/use the environment variables
(see the psql man page).
See http://initd.org/psycopg/docs/module.html#psycopg2.connect for details on