
npr’s site is using some OpenStates data, the project I’m currently working on at sunlight labs.
If you feel like affecting change in US politics, and know Python, we could use some help (it’s a F/OSS project!) over on github
Keep being awesome!
For the sake of anyone else who’s fighting their screens, I’ve got a script that will do this (but very very slowly)
setup script
xrandr --output VGA1 --auto
xrandr --output LVDS1 --auto
xrandr --output VGA1 --rotate left
eval "`monconf`"
monoconf script
#!/usr/bin/env python
import subprocess
output = subprocess.check_output(["/home/tag/.bin/mon.ls"])
output = [ item.split() for item in output.split("\n") ]
mons = {}
for mon in output:
if len(mon) > 0:
if mon[1] == "connected":
res=mon[2]
res=res.split("x")
for item in res[1].split("+"):
res.append(item)
res.pop(1)
mons[mon[0]] = res
BOTTOM_LEFT = "LVDS1"
TOP_RIGHT="VGA1"
LEFT_WIDTH = mons[BOTTOM_LEFT][0]
LEFT_HEIGHT = mons[BOTTOM_LEFT][1]
RIGHT_WIDTH = mons[TOP_RIGHT][0]
RIGHT_HEIGHT = mons[TOP_RIGHT][1]
print "xrandr --output %s --pos 0x%s" % (
BOTTOM_LEFT,
(int(RIGHT_HEIGHT) - int(LEFT_HEIGHT)))
print "xrandr --output %s --pos %sx0" % (
TOP_RIGHT,
int(LEFT_WIDTH)
)
and the mon.ls command
xrandr -q | grep "^[^\ ].*" | grep -v Screen
All of this is super hacky, but it works.
Use vim? Check out some sweet vim exrc stuff for editing one-line JSON files:
autocmd BufRead,BufNewFile *.json set filetype=json
command Js silent %!jp
command Jc silent %!jcompress
autocmd FileType json Js
Having a wicked time in Cleveland, hitting up such local wonders as the melt, browns stadium, and the winking lizard.
I miss Cleveland lots, and it’s been a crazy few days. Be back in Boston soon!
Hello, World!
Today’s hacks come remotely, on the first day of my long trek to Cleveland. As many debian readers know, debian URLs are usually transmitted over IRC or email with some snappy abbreviations. Usually, you’ll see something like:
Feel free to check out information about frob at wiki.d.o/Frob
or something like:
I have uploaded package bar onto mentors.d.n for review
What bugs me most about this is that I have to expand URLs by hand. Which is lame. Enter libolla (a fitting name as well as a graceful nod to my alma mater John Carroll University’s crest).
When LD_PRELOAD’d, it’ll intercept and expand calls to getaddrinfo transparently. It seems to work fine on SSH, and chrome (but I can’t test well, since I’m not on a real line).
This was all hacked up in a few hours I had to spare, and without any sort of internet love, so I’m willing to bet there are some bits that can be cleaned up (after all, the name of the blog is “Peace, Love and C++”, not “Peace, Love and C” - I don’t clam to be a c expert ;) )
So, feel free to fork the project on github (or as I can now do - http://g.c/paultag/libolla)
Now, I just need to find a way to globally pre-load this for apps that I start in my DE. Should be easy enough fiddling with some env-var files.
I’ve whipped up two libs this week, and both have some pretty radical uses. The fist is python-charlie, which can be found on github, which is named in honor of Charlie on the MTA.
This lib will fetch data on the Boston MBTA T (rather, just the Red, Orange and Blue lines), which can actually be super useful in a lot of ways.
I’d love to see some hacks with this data!
The second is php-openstates, a PHP binding into the openstates API. It comes with a nifty little util to get some bill listings, but hopefully, this will mature as teh project grows.
Fork the project on github. Rock on.
As of today, I’ve left my current job at Boston College for a new spot at The Sunlight Foundation, a government transparency nonprofit.
Needless to say, all opinions from here on out are my own, and in no way represent anyone other them myself. Sometimes, not even myself.
Anywyo, I’m very exited, and going to be working on Open States, a F/OSS backed API into state government data.
Can’t wait!
Presenting another script from the useless script department — dog!

It has an in-built (and rather quirky) state-machine style parser, which will emit the color defined on entering the new state.
The syntax is stupid easy - and hopefully easy enough to write.
Perhaps (given some time) I’ll turn this into something, well, useful.
Code’s on github, but very buggy and stuff. Also hard-coded.
Enjoy!
In honor of the recent nyan-cat ANSI fad, I hacked up some goodies that is able to do this with a small subset of all gifs - namely those which are well-formed.
The code is thrown up as a gist — it uses some code from Micah Elliott’s colortrans.py.