Skip to content

Instantly share code, notes, and snippets.

Avatar

Scott Hendrickson DrSkippy

View GitHub Profile
@DrSkippy
DrSkippy / updateeggs.py
Created Mar 3, 2012
Python easy_install package list and update
View updateeggs.py
#!/usr/bin/env python
from setuptools.command.easy_install import main as install
from pkg_resources import Environment, working_set
import sys
# From
# http://pyinsci.blogspot.com/2007/07/updating-all-your-eggs.html
#
#Packages managed by setuptools
@DrSkippy
DrSkippy / updateeggs.py
Created Mar 3, 2012
Python easy_install package list and update
View updateeggs.py
#!/usr/bin/env python
from setuptools.command.easy_install import main as install
from pkg_resources import Environment, working_set
import sys
# From
# http://pyinsci.blogspot.com/2007/07/updating-all-your-eggs.html
#
#Packages managed by setuptools
@DrSkippy
DrSkippy / esttimeline.csv
Created Mar 7, 2012
Script to plot estimated twitter sizes by month, day-of-week, hour-of-day
View esttimeline.csv
date links mentions filesize
2012-02-01 00:00:00 1568084.39368 6891876.66592 5073796635.0
2012-02-01 01:00:00 1630363.40724 7165598.71946 5275310693.0
2012-02-01 02:00:00 1503238.39881 7330823.79295 5346632196.0
2012-02-01 03:00:00 1531098.1639 7466687.15896 5445722212.0
2012-02-01 04:00:00 1263227.86262 5684331.32022 4622638454.0
2012-02-01 05:00:00 1025376.85854 4614038.34139 3752249801.0
2012-02-01 06:00:00 1133004.69538 4284112.83464 3142526930.0
2012-02-01 07:00:00 1018009.20802 3849292.35654 2823572898.0
2012-02-01 08:00:00 1247276.24662 4593417.27672 2740500941.0
@DrSkippy
DrSkippy / fit.py
Created Mar 12, 2012
Reference growth with time. Many Linear Regressions with Python. Create R plots in a loop; layout with grid.arrange
View fit.py
#!/usr/bin/env python
import sys
import datetime
import re
from pprint import pprint
import math
from scipy import stats
# cat nikeplot.csv | ./fit.py > fit.csv
@DrSkippy
DrSkippy / urls.py
Created Mar 20, 2012
Lengthen Short URL with service longurl.org
View urls.py
#!/usr/bin/env python
#
# Scott Hendrickson
# 2012-03-18
#
import sys
import re
import urllib
import httplib2
@DrSkippy
DrSkippy / stats.py
Created May 1, 2012
Python/Numpy/Scipy/Matplotlib statistical summary and histogram column of numbers
View stats.py
#!/usr/bin/env python
import sys
import numpy
import scipy
import scipy.stats
from optparse import OptionParser
parser = OptionParser()
parser.add_option("-b", "--bins", dest="bins", default=50,
help="Number of bins (default = 50)")
@DrSkippy
DrSkippy / joined.csv
Created May 25, 2012
Aligned time series plots in R
View joined.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 8 should actually have 22 columns, instead of 6. in line 7.
time,ts,twcount,ts1,wpcpcount,ts2,wpcccount,ts3,wpopcount,ts4,wpoccount,ts5,dcount,ts6,ngcount,twcount,wpcpcount,wpcccount,wpopcount,wpoccount,dcount,ngcount
2012-03-20 17:00:00,1332262800,8,1332262800,0,1332262800,0,1332262800,0,1332262800,0,1332262800,0,1332262800,7,0.0,0.0,0.0,0.0,,0.0,0.0
2012-03-20 17:01:00,1332262860,4,1332262860,0,1332262860,0,1332262860,0,1332262860,0,1332262860,0,1332262860,0,0.0,0.0,0.0,0.0,,0.0,0.0
2012-03-20 17:02:00,1332262920,2,1332262920,0,1332262920,0,1332262920,0,1332262920,0,1332262920,0,1332262920,0,0.0,0.0,0.0,0.0,,0.0,0.0
2012-03-20 17:03:00,1332262980,2,1332262980,0,1332262980,0,1332262980,0,1332262980,0,1332262980,0,1332262980,0,0.0,0.0,0.0,0.0,,0.0,0.0
2012-03-20 17:04:00,1332263040,5,1332263040,0,1332263040,0,1332263040,0,1332263040,0,1332263040,0,1332263040,0,0.0,0.0,0.0,0.0,,0.0,0.0
2012-03-20 17:05:00,1332263100,3,1332263100,0,1332263100,0,1332263100,0,1332263100,0,1332263100,0,1332263100,0,0.0,0.0,0.0,0.0,,0.0,0.0
2012-03-20 17:06:00,1332263160,4,1332263160,0,1332
@DrSkippy
DrSkippy / dist.r
Created Aug 24, 2012
Distribution of languages on Twitter - plot order, freqpoly and grid.arrange different sized plots
View dist.r
#!/usr/bin/env Rscript
library(ggplot2)
library(stringr)
library(gridExtra)
fmt <- function(){
function(x) format(x,nsmall = 2,scientific = FALSE)
}
@DrSkippy
DrSkippy / ColorBrewer.pde
Created Sep 20, 2012
ColorBrewer Colors as PVectors for Processing
View ColorBrewer.pde
//
//
// Generated Class
// (2012-09-20 15:29:49.747163)
class ColorBrewer{
// color Pastel2_Qualitative_7
ArrayList get_Pastel2_Qualitative_7() {
ArrayList Pastel2_Qualitative_7_ = new ArrayList();
Pastel2_Qualitative_7_.add(new PVector(179, 226, 205));
@DrSkippy
DrSkippy / ColorBrewer.r
Created Sep 20, 2012
ColorBrewer Colors as Vectors for R
View ColorBrewer.r
#
# Generated Vectors
# (2012-09-20 16:00:18.137289)
# color Pastel2_Qualitative_7
Pastel2_Qualitative_7 <- c( rgb(179, 226, 205, maxColorValue=255), rgb(253, 205, 172, maxColorValue=255), rgb(203, 213, 232, maxColorValue=255),
rgb(244, 202, 228, maxColorValue=255), rgb(230, 245, 201, maxColorValue=255), rgb(255, 242, 174, maxColorValue=255),
rgb(241, 226, 204, maxColorValue=255))
# color Pastel2_Qualitative_6
Pastel2_Qualitative_6 <- c( rgb(179, 226, 205, maxColorValue=255), rgb(253, 205, 172, maxColorValue=255), rgb(203, 213, 232, maxColorValue=255),