Skip to content

Instantly share code, notes, and snippets.

@fperez
fperez / ipshell_doctest.py
Created February 1, 2014 03:39
IPython Shell that can be embedded when called in a doctest run
"""Implement a version of `IPython.embed()` which works during doctesting.
This provides a `dt_embed()` function that is similar to `IPython.embed`, but
which can run when used inside code that will be run via doctests (where the
default `embed` locks up due to the hijacking of `sys.stdout` that doctest
performs.
See https://github.com/ipython/ipython/issues/90 for the full details.
"""
@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)
@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":[
@jlicht
jlicht / gist:4046626
Created November 9, 2012 16:21
Data in the DPLA Repository - by Collection
The 'value' is the number of documents. To search for documents within a particular collection:
http://api.dp.la/v1/items?isPartOf=Albert%20Gore%20Sr.%20Senate%20Collection
{"rows":[
{"key":"Digital Library of Georgia,","value":379},
{"key":"Digital Library of Georgia,\"Integrated in all respects\": Ed Friend's Highlander Folk School films and the politics of segregation","value":8},
{"key":"Digital Library of Georgia,\"Thar's gold in them thar hills\": Gold and gold mining in Georgia, 1830s-1940s","value":174},
{"key":"Digital Library of Georgia,1968 sanitation workers strike","value":150},
{"key":"Digital Library of Georgia,A Thousand wheels are set in motion: the buildings of Georgia Tech at the turn of the 20th century, 1888-1908","value":2},
@paulmwatson
paulmwatson / maps.google.com.new.lat.lng.js
Created May 17, 2013 09:28
Bookmarklet for getting the latitude and longitude of the center of the map in new Google Maps (which has lost the What's Here? feature which got the lat/lng easily.)
javascript:var d=document,w=window,l=d.location.href;lats=l.indexOf('!2d')+3;late=l.indexOf('!3d',lats);lat=l.substring(lats,late);lngs=l.indexOf('!3d')+3;lnge=l.indexOf('!',lngs);lnge==-1?lnge=l.length:lnge=lnge;lng=l.substring(lngs,lnge);w.location='http://maps.google.com?q='+lng+','+lat;
@fperez
fperez / 00-Setup-IPython-PySpark.ipynb
Last active December 21, 2015 23:48
HowTo for starting an IPython Notebook server
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rwjblue
rwjblue / rsa_decrypt.rb
Last active March 16, 2016 16:18
Public-key encryption with Ruby.
require 'openssl'
require 'base64'
ciphertext = Base64.decode64("CIPHERTEXT GOES HERE")
passphrase = ENV['PRIVATE_KEY_PASSPHRASE'] # read in from environment
private_key = OpenSSL::PKey::RSA.new(File.read('path/to/private_key.pem'), passphrase)
plaintext = private_key.private_decrypt(ciphertext, OpenSSL::PKey::RSA::PKCS1_PADDING)
puts "Plain text is: " + plaintext
@edsu
edsu / wikichanges.js
Created January 21, 2014 14:53
paste this in your browser's console window and smoke it :-)
var w = new EventSource("https://wikipedia-edits.herokuapp.com/sse");
w.onmessage = function(event) {
change = JSON.parse(event.data);
console.log(change);
}
@mschuerig
mschuerig / docker-enter
Last active February 8, 2017 00:50
Enter a running docker container
#! /bin/sh -e
# See
# http://blog.docker.com/2014/06/why-you-dont-need-to-run-sshd-in-docker/
# https://github.com/jpetazzo/nsenter
case "$1" in
-h|--help)
echo "Usage: docker-enter CONTAINER"
exit 0