Skip to content

Instantly share code, notes, and snippets.

@satra
satra / 00README
Created February 26, 2011 19:40
Installing EPD 7.0 + ETS on OSX x64 + virtualenv
Please note that this gist applies to EPD version 7.0 and 7.1. EPD 7.1 includes ETS
but not completely on OSX x64. Furthermore a patch has been submitted for inclusion
in virtualenv that should resolve the virtualenv issue.
The notes below were compiled for 7.0 and will need to be replaced with corresponding
7.1 paths.
https://github.com/satra/virtualenv/tree/fix/EPDpatch
@thwarted
thwarted / sshpub-to-rsa
Created June 14, 2011 09:12
converts an openssh RSA public key into a format usable by openssl rsautl (if you don't have openssh 5.6 or later with ssh-keygen PEM export format)
#!/usr/bin/env python
# with help and inspiration from
# * ASN1_generate_nconf(3) (specifically the SubjectPublicKeyInfo structure)
# * http://www.sysmic.org/dotclear/index.php?post/2010/03/24/Convert-keys-betweens-GnuPG%2C-OpenSsh-and-OpenSSL
# * http://blog.oddbit.com/2011/05/converting-openssh-public-keys.html
import sys
import base64
import struct
@drewbuschhorn
drewbuschhorn / plos_sunburnt_demo.py
Created July 12, 2011 03:06
PLOS API code for use with SunBurnt
#Sample PLOS api code for use with python Solr library Sunburnt
#( https://github.com/tow/sunburnt )
#!Note! requires sunburnt's external libraries: httplib2,lxml
#https://groups.google.com/d/topic/plos-api-developers/zv591sFz6TM/discussion
import sunburnt,urllib2
class PlosInterface(sunburnt.SolrInterface):
def __init__(self,api_key):
plos_url = "http://api.plos.org/search"
#either
@jsocol
jsocol / data-uri.py
Created July 18, 2011 14:48
Give an image, get a data-uri
#!/usr/bin/env python
"""Command line script to convert a file, usually an image, into a data URI
for use on the web."""
import base64
import mimetypes
import os
import sys
@zeeshanlakhani
zeeshanlakhani / monoid.py
Created October 13, 2011 15:49
Python Monoid
#Code from http://fmota.eu/, great!
class Monoid:
def __init__(self, null, lift, op):
self.null = null
self.lift = lift
self.op = op
def fold(self, xs):
if hasattr(xs, "__fold__"):
return xs.__fold__(self)
@tingletech
tingletech / README
Created December 4, 2011 07:40 — forked from onyxfish/example1.py
Basic example of using NLTK for auto-greeking text
see now https://github.com/tingletech/greeker.py
usage: greeker.py [-h] [--piglatin] [infile] [outfile]
Create greeked text for XML testing.
positional arguments:
infile input XML (or standard input)
outfile output greeked XML (or standard out)
@gregburek
gregburek / rateLimitDecorator.py
Created December 7, 2011 01:51
Rate limiting function calls with Python Decorators
import time
def RateLimited(maxPerSecond):
minInterval = 1.0 / float(maxPerSecond)
def decorate(func):
lastTimeCalled = [0.0]
def rateLimitedFunction(*args,**kargs):
elapsed = time.clock() - lastTimeCalled[0]
leftToWait = minInterval - elapsed
if leftToWait>0:
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@crofty
crofty / index.html
Last active October 22, 2021 08:24
A example of using Google Map tiles with the Leaflet mapping library - http://matchingnotes.com/using-google-map-tiles-with-leaflet
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
</head>
<body>
@nichtich
nichtich / campain.json
Created May 20, 2012 07:43
unglue.it API
{
"meta":{
"limit":20,
"logged_in_username":null,
"next":null,
"offset":0,
"previous":null,
"total_count":6
},
"objects":[