January 2013
3 posts
4 tags
gen_nocorrect
gen_nocorrect: A shell (written for zsh) function for turning a list of commands into nocorrect aliases.
Example input:
jsc
mplayer
ipython
Example output:
# Aliases for nocorrect commands. Automatically generated
alias jsc="nocorrect jsc"
alias mplayer="nocorrect mplayer"
alias ipython="nocorrect ipython"
https://gist.github.com/4553009
4 tags
[RIM] will stand alone as the only mobile solutions provider focused on IT first...
– Rob Enderle, Why 2013 Is RIM’s BlackBerry Year
4 tags
split_keep.py
split_keep.py - A simple python function for splitting a string by multiple “splitters”, remembering the splitter used each time.
What it does: Takes a string and a list of splitters and splits the string by each of them. Basically, returns a list containing all of the splitters found in the input string, along with all of the characters found between...
December 2012
1 post
4 tags
soundstretch.sh
soundstretch.sh - A silly shell script for recursively finding mp3 files and making copies that are sped up +40%.
What it does: Recursively searches for mp3s* in a given GETDIR, making faster copies in the same relative location in a copy of the directory tree rooted in the PUTDIR specified.
* Will skip over files with the extension .fast.mp3, so as to not speed songs up twice.
Key line:
find...
September 2012
1 post
5 tags
Introducing Comparative Word Clouds
What is a comparative word cloud?
Comparative word clouds are like normal word clouds, except they compare two different sources of text.
[[MORE]]
How does it work?
In a normal word cloud, words only have one meaningful attribute: their size, corresponding to how many times they are used. In a comparative word cloud, words are also colored according to how predominately they appear in one...
August 2012
1 post
July 2012
6 posts
4 tags
Batman and the Bomb
WARNING: This post is about a major spoiler for The Dark Knight Rises.
[[MORE]]
How far away from Gotham would Batman have to have taken the bomb to stay out of the blast radius?
Using New York as a model (which is fair…) he would’ve had to have put it about here:
You can play along here.
Some notes:
The air blast radius would be about 7.63 miles, but the thermal radiation...
6 tags
11 Days of Mozart: The most popular composers on...
I updated my script to take start/end dates and a number of composers to print results for as (optional) arguments from the command line, and wrapped the functionality inside a class.
To test it out, I made it fetch data going back to the first day I could find archives for, May 12th, 2010. The results are similar to the results for this year, with more shifting at the bottom of the list.
...
8 tags
6 tags
Who are the most popular composers on WPR?
Question: Which composers are played most on the NPR News and Classical network on WPR, and how much playtime do they get?
Here’s a rough draft of some code to find the top 50 most played composers (by total piece duration) for 2012. It does nothing fancy (it doesn’t even convert the raw number of seconds into something more human-friendly), but it gave me an answer.
require...
June 2012
6 posts
Yet I would like it if the tiny baton twirler, who has been made to wear...
– Don’t Mention My Name in Sheboygan - The Realist (appears on the second page)
Class Resources: CS 638 - Web Programming
A few years ago, there was a CS course at UW-Madison called CS 638 - Web Programming. The course was later renamed CS 369, and it’s still listed in the course directory, but it doesn’t appear to have been offered very recently. So, I grabbed the class files from one session of the class and zipped them up.
From the class directory, I’ve included:
Lecture slides (with mentioned...
2 tags
May 2012
10 posts
Tweets Onslaught: 2012-05-30
This is everything I’ve tweeted over the past few days. Yawn. [[MORE]] 2012-05-23 01:46:56 - My dumb tweet-fetching program seems to work, so I can probably sleep now. TODO: Make it less stupid. 2012-05-23 01:48:18 - RT @wjjessen: Stop Meeting People and Make Things Happen http://t.co/WRTvrZ2h 2012-05-23 10:51:45 - US Supreme Court takes on broad software and method patents,...
An easy bitly bookmarklet
I hacked together a bookmarklet to make a bitly shortened url from the current page. Expanded, it looks like this:
var xhr = new XMLHttpRequest();
xhr.open("GET", "https://api-ssl.bitly.com/v3/shorten?longUrl="+encodeURIComponent(top.document.URL)+"&login=LOGIN_KEY&apiKey=API_KEY");
xhr.onreadystatechange = function() {
if(xhr.readyState == 4) {
if(xhr.status==200) {
...
5 tags
An interesting episode in Wisconsin's labor union...
This did not end our troubles with the labor unions. It was the beginning of very serious troubles…They picketed the building site although a non-union contractor was willing and able and glad to hire Madison laborers…That didn’t satisfy the local Madison labor unions. They meant to strike the job and pull everybody off. So there was this picket line thrown around the...
April 2012
9 posts
6 tags
Jay Rosen's Trust Puzzler: My comment
See the original post here.
I’m not ready to answer the puzzler, but I do come bearing data from other (all online) polls on trust. This should be mostly relevant to #1, but a few things are relevant to the other explanations.
Harris Interactive:
What you need to know: This Harris poll finds that the level of trust might be fairly broad. Basically, 73% trust local TV news, 69% radio, 69%...
6 tags
Starting to crawl the Wisconsin Legislature
I’m currently learning about web crawling by trying to get information off of the Wisconsin State Legislature. As a simple first exercise for myself, here’s a bit of ruby to get a listing of all the dates of floor periods in the current session.
require 'nokogiri'
require 'open-uri'
URL = "http://legis.wisconsin.gov/leginfo/session.htm"
session = Nokogiri::HTML(open(URL))
# Divide...
8 tags
The closing of the progressive mind (SEE UPDATE)
Cut/paste into search box; modify to your personal preference: #wiunion -jrios68 -teeocee -lizschmidt3 -wijim500 -nomorespend -shreksshrek
— Spud Lovr (@SpudLovr) April 16, 2012
The conservative movement in the US has an alternative media universe, to avoid liberal mainstream media. The progressive movement in Wisconsin is trying to construct their own, to avoid a conservative mainstream...
7 tags
Last, but certainly not least, I must bring the downright disturbing and...
– Thoughtcrime.
motherjones asked: Hey, Zach— Not sure we can actually use that code, but if you've got the bandwith, our programming guru suggests you "create a Mother Jones Enhancement Suite browser plugin forFirefox or Chrome."
10 tags
Formatting code on tumblr
I use pygments to format my code, with pretty default settings. The “-f” option gets you embeddable code if set to html. You’ll run something like this from the (Unixy) command line (from the pygments docs):
$ pygmentize -f html -l python -o test.html test.py
Make sure to include “-f html”; otherwise, you won’t get html tags.
You can see the styling...
6 tags
A better way for Mother Jones to present the...
I was looking at Mother Jones’ Trayvon Martin story, and it occurred to me that it would be really nice if I could load the page and only see the updates since I last visited. So I put together a little ruby program to do this locally for me. It’s very version-0.1, but think it works (EDIT: not really—see below).
Here it is:
require 'nokogiri'
require...
Link blast
Things from The Twitter, in reverse-chronological order:
Tom Barrett was the wonkiest candidate for Governor in 2002. Here are all of his policy papers. (Full website here)
Kathleen Falk didn’t maintain her website in 2008.
Mordecai Lee in 2010: “[Walker] has that ability to disagree without being disagreeable, which is important. He is probably the best politician I have seen in a...
March 2012
7 posts
7 tags
On the left, you find much more of a realist discourse on violence … Realism is...
– Corey Robin is being smart.
4 tags
By conservative estimates, the twentieth century, an experiment in secular...
– Yes, conservatives do estimate it like that.
7 tags
Jon Stewart was right: Wisconsin as Bizarro World
Don’t you get what’s happening here? The union Wisconsin protest is the Bizarro World Tea Party!
That’s Jon Stewart on 2/21/11. Was he right? Well:
“Tyrannical” figureheads: President Obama vs. Governor Walker.
Protests.
Bill-oriented thinking: Lots of “kill the Bill”/”ramming the bill down our throats.”
“The voters didn’t...
6 tags
Journalists and the recall as a lesson in...
From the Gannett template-column about the journalists signing Walker recall petitions (see here, here for examples—the direct quote comes from the former):
…journalists have a first responsibility to be trusted. They have a first responsibility to protect the credibility of the news they are covering for their readers and their community. They have a first responsibility to protect...
You guys should do some actual reporting instead of just reporting whatever...
– Rick Santorum wanting you to work on your pressthink.
3 tags
The banality of brilliance
That was unexpected (emphasis added):
You don’t have to be James Carville to figure out that talking about people’s health and the health of their children … is going to make a difference to the average voter,” Daniel Weiss, director of climate strategy at the Center for American Progress Action Fund, said.
4 tags