Skip to content

Instantly share code, notes, and snippets.

geraldstanje

Block or report user

Report or block geraldstanje

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:0134ac365f8b414bf2ef9e0efca150e5
cut -f1,4 -d',' freq_1483051128.csv | sort | awk -F',' '{a[$1]+=$2}END{for (i in a){print i,a[i]}}'
@geraldstanje
geraldstanje / main.py
Last active Oct 21, 2016
Basic thread pool example whipped up quickly for #python
View main.py
import threading
import Queue
import time
QUEUE_TIMEOUT_s = 0.1
WORKER_COUNT = 200 # play with this! If switching to multiprocessing, use ncores+1 (or 2)
NUM_TASKS = 1000
SLOW_ADD_TIME_s = 0.1
done_event = threading.Event()
View main.go
package main
import (
"database/sql"
"gopkg.in/gorp.v1"
"log"
"strconv"
"github.com/gin-gonic/gin"
_ "github.com/go-sql-driver/mysql"
View wavelet_test.csv
33.5827844 -0.837060000000001 3.367104
33.5827844 -0.822270000000003 3.344952
33.5827844 -0.807480000000002 3.344952
33.5917065 -0.837060000000001 3.363412
33.5917065 -0.851850000000002 3.37818
33.5917065 -0.837060000000001 3.381872
33.5917065 -0.866640000000004 3.400332
33.5917065 -0.911010000000001 3.422484
33.6006286 -0.881430000000002 3.418792
33.6006286 -0.911010000000001 3.45202
View wavelet_test.R
library(wavelets)
load_data <- function(filename, row) {
data = read.csv(filename, header=FALSE, sep=",")
return(data[[row]])
}
wavelet_transform <- function(data) {
Wavelet_out = matrix(0, 1, 8)
View wavelet_test.py
import pywt
import csv
import pandas as pd
import numpy as np
def read_csv(filename):
columns = defaultdict(list) # each value in each column is appended to a list
with open(filename) as f:
reader = csv.DictReader(f) # read rows into a dictionary format
View gist:64f8238aa6e5233f8f5ee82bd43f0226
https://www.cs.swarthmore.edu/~turnbull/cs67/s09/labs/lab05.pdf
http://nxn.se/post/90198924975/extract-cluster-elements-by-color-in-python
https://joernhees.de/blog/2015/08/26/scipy-hierarchical-clustering-and-dendrogram-tutorial/
http://databasefaq.com/index.php/answer/205523/python-scipy-hierarchical-clustering-dendrogram-cutting-scipy-hierarchical-dendrogram-into-clusters-via-a-threshold-value
http://brandonrose.org/clustering
View gist:e2f6f3c35103460629fae54a5cc97109
http://jsfiddle.net/ts4oyyn0/10/
cc http://coagisweb.cabq.gov/arcgis/rest/services/public/environmentalissues/MapServer/1/query&#8221
http://bl.ocks.org/wboykinm/29ef7eda9e28932353fd
http://stackoverflow.com/questions/35468510/binning-data-into-a-hexagonal-grid-in-google-maps
http://stackoverflow.com/questions/19830527/using-d3-to-create-a-density-value-heatmap-layer-for-leaflet
python:
@geraldstanje
geraldstanje / rand_location.js
Last active Apr 14, 2017
generate random location (lat, long)
View rand_location.js
function getRandomCoordinates(radius, uniform) {
// Generate two random numbers
var a = Math.random(),
b = Math.random();
// Flip for more uniformity.
if (uniform) {
if (b < a) {
var c = b;
b = a;
View print4.html
%html{:lang => "en", "ng-app" => "myApp"}
%head
%script{:src => "http://ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"}
%script{:src => "https://maps.googleapis.com/maps/api/js?v=3.6&?key=AIzaSyAkyvfxLRt8uJ3gZlduH38ZQSF30_5N9cA&sensor=true"}
%script{:src => "http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"}
%meta{:charset => "utf-8"}/
%title My AngularJS App
%body
.container-fluid
.row
You can’t perform that action at this time.