Skip to content

Instantly share code, notes, and snippets.

View mtigas's full-sized avatar

Mike Tigas mtigas

View GitHub Profile
===== Places vs Place, 1 variable; Significance/Strength of Difference =====
Given the data for each county in one state and each county in another
(two samples), determine whether crime rate (one variable) is significantly
higher (in a statistics sense) in one state versus the other.
---
We're testing *one* variable, technically, but if we have a function written
up for this, we could actually forloop this and list various demographics --
population, crime rate, education, etc -- and show the difference between the
@mtigas
mtigas / gist:219443
Created October 27, 2009 09:55 — forked from tkaemming/gist:94302
.zshrc
# .zshrc
alias lstree="ls -R | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\/]*\//–/g' -e 's/^/ /' -e 's/-/|/'"
autoload colors zsh/terminfo
if [[ "$terminfo[colors]" -ge 8 ]]; then
colors
fi
for color in RED GREEN YELLOW BLUE MAGENTA CYAN WHITE; do
eval PR_$color='%{$terminfo[bold]$fg[${(L)color}]%}'
# coding=utf-8
from matplotlib.figure import Figure
def make_example_pie():
"""
Follows the simple pie chart demo[1] from matplotlib's gallery, but
rewritten in a cleaner fashion that can be used for PNG rendering.
[1] http://matplotlib.sourceforge.net/examples/pylab_examples/pie_demo.html
"""
<?xml version="1.0" encoding="utf-8"?>
<!-- non-standard XML format, obviously -->
<!-- example for this story:
http://www.komu.com/satellite/SatelliteRender/KOMU.com/ba8a4513-c0a8-2f11-0063-9bd94c70b769/e46a687c-80ce-0971-006f-a167008c2203
-->
<!-- should newlines in this be \n delimited? -->
<body><![CDATA[LAFAYETTE COUNTY - Horrifying details continue to surface after Missouri authorities arrested five family members on an array of child sexual abuse charges.
Law enforcement continues its search of the Mohler's property, located about 30 miles east of Kansas City. Authorities began searching Tuesday evening, and they're convinced there's still a lot of evidence to find. Authorities have confirmed they are looking for bodies buried on the property. They are also looking for glass jars that contain notes written by victims with the details of the abuse.
<?xml version="1.0" encoding="utf-8"?>
<!-- non-standard XML format, obviously -->
<!-- example for this story:
http://www.komu.com/satellite/SatelliteRender/KOMU.com/ba8a4513-c0a8-2f11-0063-9bd94c70b769/e56e519a-80ce-0971-00b6-57a8d5e46f84
-->
<!-- should newlines in this be \n delimited? -->
<body><![CDATA[COLUMBIA - Columbia Transit announced Wednesday it reached its goal of two million riders for the 2009 fiscal year that ended in September.
Columbia Transit announced Wednesday it reached its goal of two million riders for the 2009 fiscal year, which ended in September. Despite initial predictions of a decrease in bus ridership, there are more Columbia passengers than ever before. Transit supervisor Drew Brooks said changes in the economy may have contributed to this year's success.
@mtigas
mtigas / backup_dir.sh
Created February 9, 2010 22:56
Script that creates a tarball backup of a directory, compressed with xz (LZMA2) and encrypted with GPG. Uploads backup to S3 storage space.
#!/bin/bash
# Script that creates a tarball backup of a directory,
# compressed with xz (LZMA2) and encrypted with GPG.
# Resulting backup is then uploaded onto my Amazon S3
# storage space.
#
# Requires:
# * GNU Tar 1.22
# * XZ Utils 4.999.9beta
# * GNU Privacy Guard
#!/bin/bash
#
# sniff.sh
# A simple script that allows your Mac to perform packet sniffing on
# unencrypted WiFi networks.
# ----------
# Usage:
# ./sniff.sh (keyword)
#
# `keyword` is optional and is simply appended to the resulting
mtigas@nationbrowse:~$ ab -n 100 -c 10 http://mike.tig.as/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking mike.tig.as (be patient).....done
Server Software: nginx/0.7.62
Server Hostname: mike.tig.as
# See http://www.census.gov/tiger/tms/gazetteer/zips.txt
import csv
from places.models import ZipCode
from django.contrib.gis.geos import fromstr as geo_from_str
state_cache = dict()
reader = csv.reader(open('zips.txt'),delimiter=',',quotechar='"')
for row in reader:
@mtigas
mtigas / sunrise.html
Created June 7, 2010 08:25
Messing with HTML5 canvas to create a daylight clock visualization.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Sunlight</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">/*<![CDATA[*/
// TODO automate getting this data somehow
// http://aa.usno.navy.mil/data/docs/RS_OneDay.php