Skip to content

Instantly share code, notes, and snippets.

View dlamotte's full-sized avatar

Dan LaMotte dlamotte

View GitHub Profile
>>> e = codecs.lookup('zlib').incrementalencoder()
>>> e.encode('foo')
'x\x9c'
>>> e.encode('bar')
''
>>> e.encode('baz')
''
>>> e.encode('', final=True)
'K\xcb\xcfOJ,JJ\xac\x02\x00\x12{\x03\xb7'
@binarymatt
binarymatt / gist:3188630
Created July 27, 2012 15:22
Postgis on a mac

Developer Setup

  1. Setup homebrew:

    /usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
    

    Then:

@NorthIsUp
NorthIsUp / spawn.py
Created July 5, 2012 12:46
gevent spawn helpers
"""
realertime.lib.spawn
~~~~~~~~~~~~~~~~~~~~
:author: Adam Hitchcock
:copyright: (c) 2012 DISQUS.
:license: Apache License 2.0, see LICENSE for more details.
"""
from __future__ import absolute_import
@phred
phred / pedantically_commented_playbook.yml
Last active November 3, 2023 01:55
Very complete Ansible playbook, showing off all the options
---
####
#### THIS IS OLD AND OUTDATED
#### LIKE, ANSIBLE 1.0 OLD.
####
#### PROBABLY HIT UP https://docs.ansible.com MY DUDES
####
#### IF IT BREAKS I'M JUST SOME GUY WITH
#### A DOG, OK, SORRY
####
@gdamjan
gdamjan / eventsource.py
Last active September 30, 2015 14:08
This is a python/gevent reimplementation of this EventSource demo https://github.com/remy/eventsource-h5d/
#! /usr/bin/env python2
'''\
This is a reimplementation of a node.js demo of the Server-Sent Events API.
You can find (and compare to) the node.js version at https://github.com/remy/eventsource-h5d/.
'''
from werkzeug import Request, Response, redirect
from werkzeug.wsgi import SharedDataMiddleware
@byplayer
byplayer / git ignore ssl verify
Created January 12, 2012 07:31
git ignore ssl verify
export GIT_SSL_NO_VERIFY=true
@taiansu
taiansu / memusage.rb
Created October 7, 2011 14:05 — forked from sxalexander/memusage.rb
WebFaction Memory Usage Script
#!/usr/bin/env ruby
# Memory usage script for WebFaction customers adapted to attempt to
# draw username from the pwd
# Nick Trew <vxnick@gmail.com>
# 2009-05-25
# START CONFIG #
require 'pathname'
@zyegfryed
zyegfryed / gist:814432
Created February 7, 2011 14:25
Tastypie OAuth
from oauth2 import Error
from django.utils.translation import ugettext as _
from tastypie.authentication import Authentication
from oauth_provider.utils import initialize_server_request, send_oauth_error, get_oauth_request
from oauth_provider.consts import OAUTH_PARAMETERS_NAMES
from oauth_provider.store import store, InvalidTokenError
@mathiasbynens
mathiasbynens / appify
Created November 12, 2010 13:46 — forked from subtleGradient/appify
appify — create the simplest possible Mac app from a shell script
#!/bin/bash
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.
Appify takes a shell script as its first argument:
`basename "$0"` my-script.sh
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh