Skip to content

Instantly share code, notes, and snippets.

View rcoup's full-sized avatar

Robert Coup rcoup

View GitHub Profile
@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 / rsync_parallel.sh
Created April 10, 2013 21:52
Parallel-ise an rsync transfer when you want multiple concurrent transfers happening,
#!/bin/bash
set -e
# Usage:
# rsync_parallel.sh [--parallel=N] [rsync args...]
#
# Options:
# --parallel=N Use N parallel processes for transfer. Defaults to 10.
#
# Notes:
@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 <[email protected]>
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
@rcoup
rcoup / weird.py
Last active December 18, 2015 03:19
__getattr__ plus @Property is NOT INTUITIVE
class Test(object):
@property
def x(self):
print "property-x"
return 7
def y(self):
return 8
a = 9