Skip to content

Instantly share code, notes, and snippets.

View yuletide's full-sized avatar
🤘

Alex Yule yuletide

🤘
View GitHub Profile
@companje
companje / FibonacciSpiral.pde
Created May 21, 2012 22:32
Fibonacci Spiral in Processing
float phi = (sqrt(5)+1)/2;
size(323,200);
translate(height/phi,0);
scale(height);
noStroke();
smooth();
for (float i=0; i<10; i++) {
fill(i/10*255);
@scw
scw / true-distance-to-shore.py
Created May 30, 2012 20:03
Example using OGR and Shapely to compute true distances between geometries and points.
#!/usr/bin/env python
# distance_from_shore.py: compute true distance between points
# and closest geometry.
# shaun walbridge, 2012.05.15
# TODO: no indexing used currently, could stand if performance needs
# improving (currently runs in ~1.5hr for 13k points)
from geopy import distance
@jboner
jboner / latency.txt
Last active April 29, 2025 15:40
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
anonymous
anonymous / income_df
Created June 14, 2012 22:43
income_df
all_tracts = lapply(income, function(county)
lapply(county$tracts, function(tract) as.data.frame(c(county[1:3],tract))))
all_tracts_temp = lapply(all_tracts, function(county) as.data.frame(do.call(rbind, county)))
income_df = as.data.frame(do.call(rbind, all_tracts_temp))
summary(income_df)
ff = as.numeric(income_df$medianIncome)
ff = as.numeric(as.character(income_df$medianIncome))
income_df$medianIncome = as.numeric(as.character(income_df$medianIncome))
@omarish
omarish / gist:3080200
Created July 10, 2012 00:42
Priceonomics Puzzles

Priceonomics Programming Puzzle, Summer 2012

We love solving puzzles at Priceonomics. We also like meeting people who like to solve puzzles. Here are two interesting puzzles we've faced at some point in the past months that we'd like to share with you.

If you have any questions, contact [email protected].


Puzzle 1: Heatwave

@tmcw
tmcw / index.html
Created July 12, 2012 18:58
markers.js and clustr
<!DOCTYPE html>
<html>
<head>
<title>crime clusters</title>
<script
src='http://mapbox-js.s3.amazonaws.com/mapbox.js/v0.5.5/mapbox.js'></script>
<script type='text/javascript'
src='http://mapbox.com/clustr/dist/clustr.min.js'></script>
<style>
body { margin:0;font: 14px/20px 'Helvetica', 'Helvetica Neue'; background:#eee; }
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active April 29, 2025 08:29
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@swannodette
swannodette / gist:3217582
Created July 31, 2012 14:52
sudoku_compact.clj
;; based on core.logic 0.8-alpha2 or core.logic master branch
(ns sudoku
(:refer-clojure :exclude [==])
(:use clojure.core.logic))
(defn get-square [rows x y]
(for [x (range x (+ x 3))
y (range y (+ y 3))]
(get-in rows [x y])))
@johannesnagl
johannesnagl / Tweetsheets
Created August 9, 2012 10:25
Use Twitter directly in your Google Doc, so no one will ever blame you for being social
var CONSUMER_KEY = "<< YOUR KEY HERE >>";
var CONSUMER_SECRET = "<< YOUR SECRET HERE >>";
function getConsumerKey() {
return CONSUMER_KEY;
}
function getConsumerSecret() {
return CONSUMER_SECRET;
}
@josephwecker
josephwecker / new_bashrc.sh
Created August 11, 2012 04:36
Replace .bashrc, .bash_profile, .profile, etc. with something much more clean, consistent, and meaningful. Now a repo: https://github.com/josephwecker/bashrc_dispatch
#!/bin/bash
# License: Public Domain.
# Author: Joseph Wecker, 2012
#
# -- DEPRICATED --
# This gist is slow and is missing .bashrc_once
# Use the one in the repo instead! https://github.com/josephwecker/bashrc_dispatch
# (Thanks gioele)
#
# Are you tired of trying to remember what .bashrc does vs .bash_profile vs .profile?