Skip to content

Instantly share code, notes, and snippets.

View rcoup's full-sized avatar

Robert Coup rcoup

View GitHub Profile
@springmeyer
springmeyer / perf-guide.md
Last active October 6, 2015 05:38
Basics of performance profiling for users that want fast programs
@mapbutcher
mapbutcher / gist:5623849
Last active December 17, 2015 14:19
Python class which uses mapnik to create a static map based upon a coordinate.
import mapnik
from shapely.geometry import *
class StaticMap:
srs = '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +no_defs'
wgs = '+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs'
stylesheet = 'REA_Bright_Local.xml'
markername = 'rea.png'
exportpath = 'output/'
@joshed-io
joshed-io / keen_io_zrank.rb
Last active December 18, 2015 17:09
A simple Ruby script illustrating how to implement Redis-style ZRANK on the result of a Keen IO group_by query
# Example Keen IO API response for a count, grouped by an 'entry' field
keen_result = [
{
"entry" => "Apple",
"result" => 15
},
{
"entry" => "Orange",
"result" => 10
},
@fogonwater
fogonwater / README.md
Last active December 30, 2015 19:49
Uncertain carto styles
@max-mapper
max-mapper / readme.md
Created September 28, 2011 02:01
SLEEP - syncable.org

Your API does REST, but can it SLEEP?

SLEEP (Syncable Lightweight Event Emitting Persistence) is an emerging standard for distributed data sync using HTTP and JSON. A generalized version of CouchDB's much lauded built-in replication, SLEEP extends the REST architecture to define a way in which databases can offer syncable JSON APIs that foster open data innovation by allowing developers to replicate entire databases over the net.


SLEEP comes from the Apache CouchDB project which is now widely known for it's multi-master streaming HTTP + JSON replication. This is possible in part because of the CouchDB _changes feed, which is a particular API that lets you see if there have been any changes made to the database since last time you synchronized. CouchDB can efficiently implement the _changes feed because of one subtle difference between it and most other databases: it stores a history of all changes that happen to the database, including deletes.

If you synchronize data from a remote source and then the

@dunkelstern
dunkelstern / giphycat.py
Created March 8, 2016 17:15
Use the inline image functionality of iTerm2 3.0 to display an animated gif from giphy search
#!/usr/bin/python
from __future__ import print_function
import urllib
import json
import sys
import base64
search = urllib.quote(sys.argv[1])
json_data = urllib.urlopen("http://api.giphy.com/v1/gifs/search?q={searchterm}&api_key=dc6zaTOxFJmzC&limit=1".format(searchterm=search)).read()
@rcoup
rcoup / blocksync.py
Last active January 17, 2023 03:25
Block device sync between remote hosts. Based off http://www.bouncybouncy.net/programs/blocksync.py
#!/usr/bin/env python
"""
Synchronise block devices over the network
Copyright 2006-2008 Justin Azoff <justin@bouncybouncy.net>
Copyright 2011 Robert Coup <robert@coup.net.nz>
License: GPL
Getting started:
@epicserve
epicserve / ubuntu-server-django-guide.rst
Last active June 9, 2023 00:38
Ubuntu Server Setup Guide for Django Websites
@mattn
mattn / dump.vim
Created December 6, 2011 13:18 — forked from ynkdir/dump.vim
google-calendar-holiday
scriptencoding utf-8
let s:calendar_list = [
\ ['Australian Holidays', 'en.australian#holiday@group.v.calendar.google.com'],
\ ['Austrian Holidays', 'en.austrian#holiday@group.v.calendar.google.com'],
\ ['Brazilian Holidays', 'en.brazilian#holiday@group.v.calendar.google.com'],
\ ['Canadian Holidays', 'en.canadian#holiday@group.v.calendar.google.com'],
\ ['China Holidays', 'en.china#holiday@group.v.calendar.google.com'],
\ ['Christian Holidays', 'en.christian#holiday@group.v.calendar.google.com'],
\ ['Danish Holidays', 'en.danish#holiday@group.v.calendar.google.com'],
@NZKoz
NZKoz / solar87
Created March 28, 2013 01:38
Riyadh Solar Time
# <pre>
# This file is in the public domain, so clarified as of
# 2009-05-17 by Arthur David Olson.
# So much for footnotes about Saudi Arabia.
# Apparent noon times below are for Riyadh; your mileage will vary.
# Times were computed using formulas in the U.S. Naval Observatory's
# Almanac for Computers 1987; the formulas "will give EqT to an accuracy of
# [plus or minus two] seconds during the current year."
#