Skip to content

Instantly share code, notes, and snippets.

@mbostock
mbostock / .block
Last active December 22, 2022 18:47
Perspective Transformation II
license: gpl-3.0
@ralphbean
ralphbean / flickr-scraper.py
Last active January 15, 2022 23:43
Script to scrape images from a flickr account.
#!/usr/bin/env python
""" Script to scrape images from a flickr account.
Author: Ralph Bean <rbean@redhat.com>
"""
import ConfigParser
import urllib
import requests
@levigross
levigross / equality.clj
Last active January 13, 2023 06:06
Constant Time Comparison functions
; Taken from https://github.com/weavejester/crypto-equality/blob/master/src/crypto/equality.clj
(ns crypto.equality
"Securely test sequences of data for equality.")
(defn eq?
"Test whether two sequences of characters or bytes are equal in a way that
protects against timing attacks. Note that this does not prevent an attacker
from discovering the *length* of the data being compared."
[a b]
@ngrilly
ngrilly / auth.go
Created December 4, 2013 09:49
Sharing authentication cookies between Python and Go. This code is published in response to this discussion on golang-nuts: https://groups.google.com/forum/#!topic/golang-nuts/_nUQ1brlPBY This code is not really ready for public consumption: documentation is missing in some places, tests are missing in the Python version, code is not general eno…
package auth
import (
"net/http"
"net/url"
"strings"
"time"
"lib/crypto"
"lib/utils"
@briancline
briancline / consume.py
Created March 9, 2013 07:55
Queue consumer with some creates/deletes persisted in a Riak bucket
#!/usr/bin/env python
from __future__ import print_function
import json
import ConfigParser
import optparse
import pika
import riak
from pprint import pprint
from pika.adapters import SelectConnection
@max-mapper
max-mapper / index.js
Last active December 17, 2019 06:10
smooth voxel terrain
var createGame = require('voxel-engine')
var isosurface = require('isosurface')
var game = window.game = createGame({meshType: "wireMesh"})
var THREE = game.THREE
// rotate camera to look straight down
game.controls.pitchObject.rotation.x = -1.5
var container = document.body
game.appendTo(container)
@mbostock
mbostock / .block
Last active April 18, 2016 04:58 — forked from mbostock/.block
Collision Detection (Canvas)
license: gpl-3.0
@CMGS
CMGS / websocket.py
Created May 2, 2012 03:41
websocket hybi3 support with gunicorn and gevent
import collections
import errno
import re
from hashlib import md5, sha1
import base64
from base64 import b64encode, b64decode
import socket
import struct
import logging
@syntagmatic
syntagmatic / gist:2202660
Created March 26, 2012 03:30
Export CSV with Javascript
// assumes variable data, which is a homogenous collection of objects
// get keys
var keys = _.keys(data[0]);
// convert to csv string
var csv = keys.join(",");
_(data).each(function(row) {
csv += "\n";
csv += _(keys).map(function(k) {
@DGuidi
DGuidi / TileLayer.TileJSON.js
Created February 1, 2012 08:49
Leaflet TileCanvas
L.TileLayer.TileJSON = L.TileLayer.Canvas.extend({
options: {
debug: false
},
tileSize: 256,
initialize: function (options) {
L.Util.setOptions(this, options);