Skip to content

Instantly share code, notes, and snippets.

View carsonfarmer's full-sized avatar
🏖️
Remote working...

Carson Farmer carsonfarmer

🏖️
Remote working...
View GitHub Profile
@sixtenbe
sixtenbe / analytic_wfm.py
Last active May 1, 2024 02:29 — forked from endolith/peakdet.m
Peak detection in Python
#!/usr/bin/python2
# Copyright (C) 2016 Sixten Bergman
# License WTFPL
#
# This program is free software. It comes without any warranty, to the extent
# permitted by applicable law.
# You can redistribute it and/or modify it under the terms of the Do What The
# Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@geotheory
geotheory / galaxy
Created March 17, 2012 13:22
Colliding galaxies in Processing
// Galaxy collisions
Star[] Stars;
PVector[] galp;
PVector[] galv;
color[] galcol, galcol2;
boolean paused = false;
int side = 100; // border around Stars' initial positions
int Startot = 300; // number of Stars
int obsize = 10; // size of Stars
@alexalemi
alexalemi / welford.py
Created March 21, 2012 19:29
Python Welford Algorithm
import math
class Welford(object):
""" Implements Welford's algorithm for computing a running mean
and standard deviation as described at:
http://www.johndcook.com/standard_deviation.html
can take single values or iterables
Properties:
mean - returns the mean
@Robsteranium
Robsteranium / statistics-distributions.js
Created May 11, 2012 20:20 — forked from benrasmusen/statistics-distributions.js
JavaScript library for calculating critical values and upper probabilities of common statistical distributions
/*
* NAME
*
* statistics-distributions.js - JavaScript library for calculating
* critical values and upper probabilities of common statistical
* distributions
*
* SYNOPSIS
*
*
@rochacbruno
rochacbruno / haversine.py
Created June 6, 2012 17:43
Calculate distance between latitude longitude pairs with Python
#!/usr/bin/env python
# Haversine formula example in Python
# Author: Wayne Dyck
import math
def distance(origin, destination):
lat1, lon1 = origin
lat2, lon2 = destination
@repustate
repustate / robford.py
Created December 3, 2013 01:38
Using Repustate's API to create a data source to monitor Twitter for information about Rob Ford.
import requests
API_KEY = 'YOUR_API_KEY'
BASE_URL = 'http://social.repustate.com/%(api_key)s/%(call)s.json'
# Create a new data source.
kwargs = {'api_key':API_KEY, 'call':'add-datasource'}
response = requests.post(BASE_URL % kwargs, {'name':'Rob Ford', 'language':'en', 'niche':'general'})
datasource_id = response.json()['datasource_id']
@debasishg
debasishg / gist:8172796
Last active March 15, 2024 15:05
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&rep=rep1&t
@rjz
rjz / stdin-and-fs-stream.js
Created March 12, 2014 05:18
Streaming from stdin or a file
// Depends on `through`
//
// $ npm install through
//
// Usage:
//
// $ echo 'hello' | node stdin-and-fs-stream.js
// $ echo 'hello' > tmp && node stdin-and-fs-stream.js tmp
//
var fs = require('fs'),
@chris-rock
chris-rock / crypto-stream.js
Last active October 6, 2022 18:38
Encrypt and decrypt streams
// Part of https://github.com/chris-rock/node-crypto-examples
// Nodejs encryption of buffers
var crypto = require('crypto'),
algorithm = 'aes-256-ctr',
password = 'd6F3Efeq';
var fs = require('fs');
var zlib = require('zlib');