Standing impatient, platform teeming, almost noon Robo voices read off final destinations But one commuter's already at his He reached for life's third rail There is no why in the abyss There's only closing credit hiss The soundtrack's gone, he didn't miss Reaching for life's third rail We ride on, now, relieved and moving forward Each our own lives roll forth, for now But now is gone, for one among us Who reached for life's third rail We rock, to-fro, and reach each station Weight shifting onto forward foot Flesh, bone ground up in violent elation And bloody rags, hours ago a well worn suit I ride the escalator up and pensive About what did and not occur today Commuter glut, flow restricted A crooked kink in public transport hose resolved.
- read more
Yesterday, I rode my longest bike ride to date - the El Cerrito-Davis 200K - with the San Francisco Randonneurs. A big thank you to all the volunteers and randos who made my first 200k so much fun.
First, for the uninitiated, an aside about randonneuring:
I discovered the sport because I'm a cheapskate. I had gotten more and more into cycling over the past 2 years or so, and though I was riding through the East Bay hills mostly alone, I wanted to do a "Century" - a 100 mile ride. Looking up local rides I found out that, while most centuries cost a nontrivial amount of money for the poor grad student I was back then ($60-$200), the San Francisco Randonneur rides were all $10-$20. As I dug deeper and learned about the sport, I found out that the reason for low cost, is that rando rides are unsupported - randonneuring is all about self sufficiency. You are expected to bring gear to fix your own flats, as well as carry or procure your own snacks and beverages.
The Randonneurs USA (RUSA) website succinctly summarizes the sport.
Randonneuring is long-distance unsupported endurance cycling. This style of riding is non-competitive in nature, and self-sufficiency is paramount. When riders participate in randonneuring events, they are part of a long tradition that goes back to the beginning of the sport of cycling in France and Italy. Friendly camaraderie, not competition, is the hallmark of randonneuring.
This description is strikingly similar to my beliefs both about cycling and computing, so I knew I found a new activity I would greatly enjoy. This has been borne out on three previous occasions when I have participated in the ~100 km Populaire rides, which are intended as a way to introduce riders to the sport, yet still be within reach of wide variety of cycling abilities.
We moved in late December, and between unpacking, rainy weekends, and being sick - I haven't been able to get much riding in. However, I've been wanting to do a 200K for a long time - my century, coveted for years, seemed within reach more than ever. To seal my commitment to the ride, I went ahead and ordered a spiffy looking SFR cycling jersey:
Here's the 213km (132 miles) ride map and elevation profile, what follows is my ride report.
The ride started at 8am at a Starbucks by El Cerrito BART station, so I just rode there from my house as I frequently do on my morning commute. I prepared my bike, packed my gear and food the night before, and the only thing I needed to do was to fill up my water bottle before the ride started. I showed up a dozen minutes before the start, with most riders already assembled, got my short drip and a heated up croissant, and totally failed to get any water. It's not a super terrible thing, I frequently don't end up drinking much at the beginning of my rides, but I had now set myself up to ride to the second control (44 km / 27 miles) without any water.
Randonneuring isn't about racing - as you traverse from control to control, there's just a window of time that you have for each control, and so long as you make it through each control withing that time window, you complete the event! There is no ordinal placement, the first rider to finish has just as much bragging rights as the last. The only time people talk about time is when they're trying to make a new personal best. The second control was open roughly between 9 and 11am, so I could have stopped off somewhere to pickup water, but that didn't fit into my ride plan.
You see, the cue sheet is two pages - with the first page dedicated to getting you to the second control, as there are a lot of turns to make in the East bay until you get to Benicia. Accordingly, my plan was to stick with the "fast" group who know the route well, so that I wouldn't have to look at the cue sheet at all. This was a success - and I got to chat with Jesse, whom I rode a fair chunk of the 111 km Lucas Valley Populaire back in October (here's a good video of the first chunk of that ride).
When 7 of us got to the Benicia control at 9:45, I volunteered to guard the bikes as folks filed into the gas station mart to buy something (getting a timestamped receipt is how you prove that you did the ride from one control to the next within the allotted time). Lesson learned: I should have used that time to shed my warm second jersey and long pants, as it had warmed up by then. It just so happens that by the time I went inside, there was a line for the bathroom, and by the time I got out, the fast group was just heading out, yet I still needed to change.
Because keeping up with the "fast" group wasn't that big of a deal and actually rather fun, I really wanted to try to catch up to them, so I stepped it up, and told a couple of other riders that I'd do my best to pull us to them (in case you didn't know - the aerodynamics of cycling make it much easier for those behind the leader to keep up the pace, even if that pace isn't something they could comfortably do on their own). We didn't succeed in catching them during the first 10 mile stretch of road, but I kept pushing with a high cadence in my highest gear, and about 5 miles later, we caught up with them! The only problem was, by this point, I had wasted so much energy, that I couldn't make the last 20 feet to them, though I was happy to see the two guys who'd been letting my push the whole time, use their fresher legs and join the group. So there I was, a few dozen feet from my intended riding partners, but as more and more pavement went past our wheels, the distance between us slowly widened.
Somewhat disheartened by this (though, again, happy that I all of my pulling wasn't all for naught, since I bridged two others to the group), and now overheating, I decide to stop by the side of the road, removed my long sleeved shirt, put on sunscreen (Lesson learned: don't forget your ears, too - they're the only part of me that burned). A fellow rando rider Eric went past, to my smiling cheer of "Go get 'em!". Then when pair of riders asked if I'm alright, I nodded, and decided to hop back on the bike and ride with them for a bit. It was nice to let someone else pull for a bit, but shortly thereafter, we started the first serious ascent, and my heart was pounding too hard from exhaustion and the heat - and I had to stop to again to catch my breath and get some more food in me.
Luckily, when I resumed riding up that hill, I had a mental shift, gave myself a break, and given how tired my legs were already, even though I wasn't even half-way through the ride, I reminded myself that I'll just spin in a low gear if I have to, there's no rush, I'm not racing anyone, and though I know this won't end up being as good of a 200k as it could have been had I trained more in recent months, it was still up to me to enjoy the ride. One of the highlights of the ride were all of the different butterflies I got to see along the way that I started noticing after this change in mental attitude.
After the long climb, followed by a very nice descent, I got onto the Silverado Trail for 14 miles of a straight road with minimal elevation changes. Though my legs were again cooperating more, it was starting to get kind of old, and then out of nowhere, one of the riders I had pulled earlier rides past me, but then proceeds to slow down and ride along side me for a chat. He hadn't been able to keep up with the fast group for very long, and ended up stopping somewhere along the way to eat, which is why I didn't notice that I had passed him. We took turns pulling for each other, which took away from the monotony of Silverado, but he had a lot more in the tank, and I again wasn't able to keep up, losing him with 4 miles to go to St Helena.
Needing another break, with 4 miles to the next control, I decided I would need to spend a while there, recuperating, if I am to make it through the rest of the ride.
I got to Model Bakery at 1:10pm, with many familiar faces from earlier in the day already enjoying their food, but ended up staying there until 2:30 - eating my food, drinking water, just letting my legs rest.
I ended up riding out solo, and really enjoyed the early parts of 128 (after missing the turnoff by a hundred feet) - luckily this was just the spot I had my last stop at, so I quickly turned around and got back on the road.
The problem was it kept getting hotter and hotter - it seemed that I couldn't go a mile without taking a good gulp of water. I still stuck to my strategy of just spinning fast without really pushing hard, since recovering from being out of breath is way faster than waiting for exhausted legs to obey your commands. I made it a good chunk of the way to Winters, but still ended up having to stop half way up the climb near Lake Berryessa. Another SFR rider, Julie, climbed past me, checking if I was OK as she went by. It's great to have that kind of camaraderie along the ride, a couple of people even gently expressed their concern that my rear wheel was out of true - which I knew but kept putting off getting it fixed. These nudges gave me more resolve to get that taken care of.
Finishing off the last of the Haribo Gummi Candy Gold-Bears that I brought with me (and you know you're tired and dehydrated when it takes effort to just chew), I got back on the bike and headed further up the hill. Then, finally, I didn't think I could ever be so cheered up by road sign (hint: they only put "TRUCKS USE LOWER GEAR" signs at the top of big hills).
I finally got to Winters at 5:37pm, got myself a Chai Smoothie, and Julie, who unfortunately was going to miss her train home, proposed that we ride together the rest of the way to Davis. Again - though I really enjoy my alone time while cycling, it's also quite fun to have strong riders to ride with, so as the sun started descending behind us, and no longer scorchingly hot, we set out for the final 17 miles to Davis at a good clip, given how much riding we had already done.
Dodging drunk college kids (it was Picnic Day at UC Davis) was the last challenge of the ride. As a UCD alum, this was a homecoming of sorts, so I lead the way through town as we made our way to the Amtrak station. We finished just before 7, and I caught the 7:25pm train back to the Bay Area - enjoying the company ...read more
- read more
I walk in monologue through Berkeley's Hills Feet pressing into sidewalk firmly I eat the pensive mood solitude brings And bite into the juiciness of self-reflection I write, first time in years, free verse impromptu Taking few dozen steps between each pair of lines I yearn, on tip-toes stretching high, to be expressive A mode of being longtime self-denied I'm walking home - from job I'll soon be leaving To find myself believing once again That which I do defines me not and feeling That which I am is good. enough. a lot.
I am starting to look for a job in the San Francisco Bay Area.
Since many recruiters ask for and presumably look at GitHub profiles, I decided to give mine a little facelift:
In case you aren't familiar, that banner was motivated by Joel Spolsky's Smart and Gets Things Done, which is a book about hiring good developers . So I decided to tweet it out, mentioning @spolsky and he favorited it!
Yesterday, I decided to tweet out an image that's at the top of my resume as a standalone tweet- mentioning Joel Spolsky again, and he liked it well enough to retweet it to his 90 thousand followers, so it's been getting plenty of love.
Perhaps unsurprisingly, the only person to contact me as a result of this so far is a reporter from Business Insider :
My editor would like to post it on our site as an example of a creative way to format a resume... I'm wondering if we can get your permission to do this?
So that's what prompted this post: I simply added my name and a Creative Commons Attribution Licence (CC-BY) to the two images, and then sent my permission along.
Outside of that, no prospective employers have gotten in touch. But like I always say: you can't win the lottery if you don't buy a ticket. And since I also enjoy mixing metaphors, I'll just keep on fishing!read more
Greg Wilson asked on the IPython mailing list:
Subject: easiest way to insert a literal tab character in a code cell? Greg Wilson, on 2014-04-03 18:37, wrote: > Hi, > I'd like to put literal tab characters in cells, but of course tab means > "indent" to the editor. What's the easiest way to do this? > Thanks, > Greg > p.s. because I'm going to write Makefiles in the notebook...
The easiest way to do this is to just get a tab character somewhere that you can copy, and then paste it in.In :
# I copy pasted the output of the cell above here
An alternative solution is to make a string with tabs and insert it into another cell, using IPython machinery.In :
ip = get_ipython()In :
ip.set_next_input("\tMakefiles are awesome")In :
Makefiles are awesome
If you have a file on disk or on the web, you can also just use the
%loadmagic to do this.In :
%load /home/pi/file_with_tabsIn :
default: cat /etc/issue whoami
Such files can be written with the
%%writefilecell magic... but of course you need to have inserted tabs there in some manner.In :
%%writefile ~/file_with_tabs default: cat /etc/issue whoami
Overwriting /home/pi/file_with_tabsIn :
!make -f /home/pi/file_with_tabs
cat /etc/issue Debian GNU/Linux jessie/sid \n \l whoami pi
We can set up CodeMirror to insert tabs instead of spaces.In :
The reason we attach
IPythonis because when we use the
I covered how to add functions like this to the
custom.jsfile in your profile in my post about disabling blinking in the notebook. That way these little functions are available in every notebook, without you having to insert a cell defining them.
Now we've got code that allows us to apply the change to all current and future cells. We leave it as an exercise for the interested reader to modify that code and make a little button in the toolbar, to toggle it on a per-cell basis.
You can get to the code mirror instance via
This post was written as an IPython Notebook. You can view it on nbviewer, or download it.read more
the boldly indiscriminate python interpreter
"...because you shouldn't have to choose."
Two interpreters, both alike in dignity,
In fair Pythona, where we lay our scene,
From ancient grudge break to new mutiny,
Where civil code makes git commits unclean.
From forth the fatal loins of these two foes
A newer kind of stranger's given life;
Whose misadventured piteous overthrows
Doth with its birth bury its parents' strife.
I'm a fancy terminal-based interface to the Python interpreter. I give you
inline syntax highlighting and auto-completion prompts as you type, and I'll
even automatically show you a little tooltip with a docstring and parameter
list as soon as you hit
(to make the function call, so you always know
what you're doing! I'm svelte and proud of it - I don't try to do all of the
ipythondoes with the shell and the web, but the cool kids
love my rewind feature for demos. I strive to make interactive python coding
I'm an awesome suite of interactive computing ideas that work together.
For millennia, I've given you tab-completion and object introspection via
help(obj)in Python. I also have sweet shell features,
special magic commands (
%matplotlib, etc.) and a
history mechanism for both input (command history) and output (results
More recently, I've decoupled the REPL into clients and kernels, allowing
them to run on independent of each other. One popular client is the
IPython Notebook which allows you to write code and prose using a web
browser, sending code to the kernel for execution and getting rich media
results back inline. The decoupling of clients and kernels also allows
multiple clients to interact with the same kernel, so you can hook-up to
that same running kernel from the terminal. The terminal workflow makes
more sense for some things, but my user interface there isn't as polished
By your powers combined... I am
The Power is Yours!
pip install bipython easy_install bipython
bipythonrequires ipython, pyzmq, bpython, and urwid.
For now, you'll need to have a running ipython kernel before running
bipython. You can do this by either opening a notebook or running
ipython console. It won't always be like this, I'll fix it as soon as I can, but it'll be sooner with your help over ivanov/bipython.
After that, just run
bipythonand enjoy the ride.
Here's a walkthrough of ipython, bpython, and bipython:
The screencast is 20 minutes long, but here I'll play it back double speed. There's no sound, and you can pause at any time and select / copy portion of the text as you like. Changing the browser font size in the usual way works, too. (click here if the embed didn't work)read more
Summary: I describe stem plots, how to read them, and how to make them in Python, using 140 characters.
My friend @JarrodMillman, whose office is across the hall, is teaching a computational statistics course that involves a fair amount programming. He's been grading these homeworks semi-automatically - with python scripts that pull the students' latest changes from GitHub, run some tests, spit out the grade to a JSON file for the student, checks it in and updates a master JSON file that's only accessible to Jarrod. It's been fun periodically tagging along and watching his suite of little programs develop. He came in the other day and said "Do you know of any stem plot implementation in python? I found a few, and I'm using one that's ok, but it looks too complicated."
For those unfamiliar - a stem plot, or stem-and-leaf plot is a more detailed kind of histogram. On the left you have the stem, which is a prefix to all entries on the right. To the right of the stem, each entry takes up one space just like a bar chart, but still retains information about its actual value.
So a stem plot of the numbers 31, 41, 59, 26, 53, 58 looks like this:
2|6 3|1 4|1 5|389
That last line is hard to parse for the un-initiated. There are three entries to the right of the 50 stem, and these three entries
9is how the numbers
59are concisely represented in a stem plot
As an instructor, you can quickly get a sense of the distribution of grades, without fearing the binning artifact caused by standard histograms. A stem-plot can reveal subtle patterns in the data that are easy to missed with usual grading histograms that have a binwidth of 10. Take this distribution, for example:
70:XXXXXXX 80:XXXXXXXXXXX 90:XXXXXXX
Below are two stem plots which have the same profile as the above, but tell a different story:
7|7888999 8|01123477899 9|3467888
Above is a class that has a rather typical grade distribution that sort of clumps together. But a histogram of the same shape might come from data like this:
7|0000223 8|78888999999 9|0255589
This is a class with 7 students clearly struggling compared to the rest.
So here's the code for making a stem plot in Python using NumPy.
stem()expects an array or list of integers, and prints all stems that span the range of the data provided.
from __future__ import print_function import numpy as np def stem(d): "A stem-and-leaf plot that fits in a tweet by @ivanov" l,t=np.sort(d),10 O=range(l-l%t,l[-1]+11,t) I=np.searchsorted(l,O) for e,a,f in zip(I,I[1:],O): print('%3d|'%(f/t),*(l[e:a]-f),sep='')
Yes, it isn't pretty, a fair amount of code golfing went into making this work. It is a good example for the kind of code you should not write, especially since I had a little bit of fun with the variable names using characters that look similar to others, especially in sans-serif typefaces (
lI10O). Nevertheless, it's kind of fun to fit much functionality into 140 characters.
Here's my original tweet: @ivanov/status/443980372192137216
You can test it by running it on some generated data:
>>> data = np.random.poisson(355, 113) >>> data array([367, 334, 317, 351, 375, 372, 350, 352, 350, 344, 359, 355, 358, 389, 335, 361, 363, 343, 340, 337, 378, 336, 382, 344, 359, 366, 368, 327, 364, 365, 347, 328, 331, 358, 370, 346, 325, 332, 387, 355, 359, 342, 353, 367, 389, 390, 337, 364, 346, 346, 346, 365, 330, 363, 370, 388, 380, 332, 369, 347, 370, 366, 372, 310, 348, 355, 408, 349, 326, 334, 355, 329, 363, 337, 330, 355, 367, 333, 298, 387, 342, 337, 362, 337, 378, 326, 349, 357, 338, 349, 366, 339, 362, 371, 357, 358, 316, 336, 374, 336, 354, 374, 366, 352, 374, 339, 336, 354, 338, 348, 366, 370, 333]) >>> stem(data) 29|8 30| 31|067 32|566789 33|00122334456666777778899 34|02234466667788999 35|001223445555577888999 36|12233344556666677789 37|0000122444588 38|0277899 39|0 40|8
If you prefer to have spaces between entries, take out the
sep=''from the last line.
>>> stem(data) 29| 8 30| 31| 0 6 7 32| 5 6 6 7 8 9 33| 0 0 1 2 2 3 3 4 4 5 6 6 6 6 7 7 7 7 7 8 8 9 9 34| 0 2 2 3 4 4 6 6 6 6 7 7 8 8 9 9 9 35| 0 0 1 2 2 3 4 4 5 5 5 5 5 7 7 8 8 8 9 9 9 36| 1 2 2 3 3 3 4 4 5 5 6 6 6 6 6 7 7 7 8 9 37| 0 0 0 0 1 2 2 4 4 4 5 8 8 38| 0 2 7 7 8 9 9 39| 0 40| 8
To skip over empty stems, add
e!=a andin front of
>>> stem(data) 29| 8 31| 0 6 7 32| 5 6 6 7 8 9 33| 0 0 1 2 2 3 3 4 4 5 6 6 6 6 7 7 7 7 7 8 8 9 9 34| 0 2 2 3 4 4 6 6 6 6 7 7 8 8 9 9 9 35| 0 0 1 2 2 3 4 4 5 5 5 5 5 7 7 8 8 8 9 9 9 36| 1 2 2 3 3 3 4 4 5 5 6 6 6 6 6 7 7 7 8 9 37| 0 0 0 0 1 2 2 4 4 4 5 8 8 38| 0 2 7 7 8 9 9 39| 0 40| 8
Thanks for reading.
The cursor is meant to tell the user the current location.
The human visual system has a pre-cortical lag of roughly 50-90 ms (read more about P1).
That's how long it takes from something changing on the screen to cause an avalanche of photons to barrel towards your eyeball, be phototransduced and processed by several stages of cells in the retina, finally causing retinal ganglion cells to fire an action potential down their axons through the optic nerve, make its way to a processing relay station called the LGN, with those cells firing action potential down their axons, with those spikes finally ending up in the primary visual cortex.
By ~150 ms, our brains have processed the visual input enough to perform a non- trivial ammount of object recognition.
The default blink rate for CodeMirror is 530ms.
That's as slow as molasses in January!
Say that I've been distracted and looked away from the screen. When I look back at the scree, half of the time it will take 3 times longer for me to get the information that I want ("where's my cursor") than if that cursor was clearly visible at all times. Now it's not always that bad, because sometimes my gaze will land on the screen and even though the cursor isn't visible, it appears in a few milliseconds, and so it takes just as long as if the cursor was there the whole time. But if I happen to be particularly unlucky (there's a reason I don't gamble), it can take 6 times longer.
Try it out
Make the change stick
IPython has a notion of profiles to allow for different kinds of configurations. If this is news to you, you've probably just been using the
defaultprofile and not known it. In the shell, run the
ipython profile createcommand to be sure (don't worry, if you alreay have a profile, this won't overwrite it). Now
ipython locate profilewill tell you the directory which contains all of the configuration for the
!ipython profile createIn :
!ipython locate profile
x = !ipython locate profileIn :
db/ history.sqlite history.sqlite-journal ipython_config.py ipython_nbconvert_config.py ipython_notebook_config.py log/ pid/ security/ startup/ static/
There's a lot of stuff there, but we just need to add our one line to the end of the file in
custom.css custom.jsIn :
!echo "codemirror.defaults.cursorblinkrate=0" >> custom.js
"I want it all and I want it now!"
You say you don't want to save your current notebook and reload it to get the updated CodeMirror settings? You just want all cells in the current notebook to change their behavior? Well, OK, Freddie:In :
I hope you enjoyed this little IPython customization detour. If you want more information about how to get rid of blinking in other programs you use every day, here is an invaluable resource on that matter.
Remember, blinking in user interfaces is bad, but blinking in vision is very important.read more
I'll be in Austin, TX for SciPy next week, and I'll be giving an updated talk about tools for reproducible research.
What follows is the abstract of a talk that I really wanted to give and submitted to the general track which did not get in. I care deeply about this topic, and I'm hoping to have conversations with others about it. The talk was deferred to a poster, so if you don't bump into me at other times, seek me out during the poster session (mine's poster #15, 10:35 AM - 11:35 AM on June 27th). This post is intended as a pre-conference warm up to that.
Navigating the Scientific Python Communities - the missing guide.
The awful truth: our newcomers have a deluge of options to wade through as they begin their journey. What tools are available, how do I install them, how do I make them work together -- all hard questions facing a budding scipythonista.
On developer-friendly platforms, the popular approach is to just install numpy, scipy, matplotlib, and ipython using package management facilities provided by the operating system. On Mac OS X and Windows, the least painful, bootstrapping approach is to use a Python distribution like Python(X,Y), EPD, Anaconda, or Sage.
Both of these paths obscure a reality which must be stated explicitly: the development of packages is fundamentally decentralized. The scientific python ecosystem consists of a loose but thriving confederation of projects and communities.
The chaos of installation options and lack of centralization around a canonical solution, which on the surface appears to be a point of weakness that is detrimental to community growth, is a symptom of one of its greatest strengths. Namely, what we have is a direct democracy for user-developers. They vote with their feet: filing bug reports, testing pre-release versions, participating in mailing lists, writing and reviewing pull requests, and advertising the tools they use in talks, papers, and conversations at conferences.
I will discuss why this is the case, why this is a good thing, and how we can embrace it. The talk will present the ethos and expectations of an effective newcomer, as well as resources and strategies for incremental progress toward becoming a master scipythonista.read more
Page 1 / 5 »