This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE sqf_2010 | |
( | |
id serial, | |
year text, | |
pct text, | |
ser_num text, | |
datestop text, | |
timestop text, | |
recstat text, | |
inout text, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
double root_NR(double n, double epsilon=.0000000001) | |
{ | |
if (n < 0) return 0.0; // throw? | |
// http://mathworld.wolfram.com/SquareRootAlgorithms.html | |
// Both Bhaskara-Brouncker and Newton's iteration use | |
// (1 + n) / 2 instead of just guessing n/2. | |
double r = 0.5 + 0.5 * n; | |
double f = r*r - n; | |
while (epsilon < abs(f)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// code taken from here: | |
// http://www.analogpixel.org/blog/2011/09/13/msced-148-boxy-lady-take-2/#more-764 | |
// and formatted for readability. | |
PImage pic1; | |
PGraphics pg; | |
boolean grow; | |
int box_size; | |
int MAXS = 40; | |
int MINS = 1; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from collections import defaultdict | |
from itertools import izip | |
from rtree import index | |
import shapefile | |
def read_shapefile(shape_dir): | |
sf = shapefile.Reader(shape_dir) | |
shapes = {} | |
for (s, sr) in izip(sf.shapes(), sf.shapeRecords()): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns transparse.core | |
(:import [clojure.java.io]) | |
;;(:import [java.lang.Float]) | |
(:require [clojure.string :as string]) | |
(:require [clj-time.format :as form]) | |
(:gen-class)) | |
(defn to-fields [line] | |
(string/split | |
(string/trim line) #"\\t")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// see it live here: http://sketchpad.cc/wkAzMXfKbD | |
PFont font; | |
void setup() | |
{ | |
size(600, 600); | |
font = loadFont("Courier", 22); | |
noLoop(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import string | |
import nltk | |
from collections import defaultdict | |
stopwords = set(nltk.corpus.stopwords.words('english')) | |
def get_sentences(): | |
sentences = [] | |
with open('/Volumes/data-1/files/topicana/cs_nps_comments_cat.txt') as f: | |
for line in f: | |
sentences.append(line.split('\t')[-1]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
color[] d3_10 = [#1f77b4, #ff7f0e, #2ca02c, #d62728, #9467bd, #8c564b, #e377c2, #7f7f7f, #bcbd22, #17becf]; | |
color[] d3_20 = [#1f77b4, #aec7e8, #ff7f0e, #ffbb78, #2ca02c, #98df8a, #d62728, #ff9896, #9467bd, #c5b0d5, #8c564b, #c49c94, #e377c2, #f7b6d2, #7f7f7f, #c7c7c7, #bcbd22, #dbdb8d, #17becf, #9edae5]; | |
color[] d3_20b = [#393b79, #5254a3, #6b6ecf, #9c9ede, #637939, #8ca252, #b5cf6b, #cedb9c, #8c6d31, #bd9e39, #e7ba52, #e7cb94, #843c39, #ad494a, #d6616b, #e7969c, #7b4173, #a55194, #ce6dbd, #de9ed6]; | |
color[] d3_20c = [#3182bd, #6baed6, #9ecae1, #c6dbef, #e6550d, #fd8d3c, #fdae6b, #fdd0a2, #31a354, #74c476, #a1d99b, #c7e9c0, #756bb1, #9e9ac8, #bcbddc, #dadaeb, #636363, #969696, #bdbdbd, #d9d9d9]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
#-*- coding: utf-8 -*- | |
# This script computes a the Color Bars of a video. | |
# Copyright (C) 2011 Benoit Romito | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Check if your password is in the linkedin password dump. | |
You'll need to download the dump from here: | |
https://disk.yandex.net/disk/public/?hash=pCAcIfV7wxXCL/YPhObEEH5u5PKPlp+muGtgOEptAS4= | |
and unzip it to combo_not.txt | |
""" | |
import hashlib | |
# TODO: May want to use getpass if someone might be reading over your shoulder |