Skip to content

Instantly share code, notes, and snippets.

View mattsta's full-sized avatar
🐢
Moving slowly and fixing things

Matt Stancliff mattsta

🐢
Moving slowly and fixing things
View GitHub Profile
@zaphar
zaphar / date_util.erl
Created May 1, 2009 06:07
set of utility functions that wrap the calendar module and erlangs now() date() and time() functions
-module(date_util).
-compile(export_all).
epoch() ->
now_to_seconds(now())
.
epoch_hires() ->
now_to_seconds_hires(now())
.
@archaelus
archaelus / netmask.erl
Created February 22, 2011 22:55
CIDR in/out net calculation
-module(netmask).
-export([in_network/3]).
in_network(Net, CIDR, IP)
when is_binary(Net), is_binary(IP), is_integer(CIDR) ->
<<NetworkPrefix:CIDR/bits, _/bits>> = Net,
case IP of
<<NetworkPrefix:CIDR/bits, _Host/bits>> ->
in_net;
_ -> not_in_net
@tompaton
tompaton / kdtree.py
Created March 10, 2011 00:15
Python kd-tree spatial index and nearest neighbour search
#!/usr/bin/env python
# kd-tree index and nearest neighbour search
# includes doctests, run with: python -m doctest kdtree.py
class KDTree(object):
"""
kd-tree spatial index and nearest neighbour search
http://en.wikipedia.org/wiki/Kd-tree
"""
@jdmaturen
jdmaturen / ExponentiallyDecayingSample.py
Created April 6, 2011 01:45
expontentially decaying sample algorithm w/ redis
import logging
from math import exp
from random import random
from time import sleep
from time import time
from uuid import uuid1
from redis.exceptions import WatchError
diff --git a/iPhoneTrackingAppDelegate.m b/iPhoneTrackingAppDelegate.m
index 1d22ecb..4af2bcf 100644
--- a/iPhoneTrackingAppDelegate.m
+++ b/iPhoneTrackingAppDelegate.m
@@ -146,7 +146,7 @@
return NO;
}
- const float precision = 100;
+ const float precision = 10000;
@dreid
dreid / dialysis
Created August 10, 2011 20:52
first pass at a shell script to make building dialysis plts easier to use.
#!/bin/sh
OTP_VERSION=$(erl -noinput \
-noshell \
-eval 'io:fwrite(erlang:system_info(otp_release)).' \
-s init stop)
PLT_DIR="$HOME/.dialyzer/${OTP_VERSION}"
CURRENT_APP=$(basename $(pwd));
@jlong
jlong / uri.js
Created April 20, 2012 13:29
URI Parsing with Javascript
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@robertoaloi
robertoaloi / demo.md
Last active December 28, 2015 21:09
Demo session used for "Introduction to Erlang" talks and courses.

Start an instance of the Erlang run-time system

$ erl

Show information about processes

> i().

Spawn a new process which sleeps for 10 seconds

-module(crc17).
-export([calc/1]).
calc(List) -> calc(List,16#FFFF).
calc(<<>>,CRC) ->
CRC;
calc(<<Value:8,Rest/binary>>,CRC) ->
Index = (CRC bxor Value) band 255,
@debasishg
debasishg / gist:8172796
Last active July 29, 2024 18:23
A collection of links for streaming algorithms and data structures

General Background and Overview

  1. Probabilistic Data Structures for Web Analytics and Data Mining : A great overview of the space of probabilistic data structures and how they are used in approximation algorithm implementation.
  2. Models and Issues in Data Stream Systems
  3. Philippe Flajolet’s contribution to streaming algorithms : A presentation by Jérémie Lumbroso that visits some of the hostorical perspectives and how it all began with Flajolet
  4. Approximate Frequency Counts over Data Streams by Gurmeet Singh Manku & Rajeev Motwani : One of the early papers on the subject.
  5. [Methods for Finding Frequent Items in Data Streams](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.9800&amp;rep=rep1&amp;t