Monthly Archives: March 2014

i’m on a bus driving on I-80, so let’s post about Lyft!

buspic

I started driving for Lyft about two months ago and it’s been really really really fun. Genuinely fun.   More fun than I’d thought it’d be. It’s the best if you love random conversation, and that’s probably because driving passengers entails meeting totally new people in a very brief amount of time.

I’ve actually had some conversations that were so good and so intriguing that it was actually sad to come to get to the destination and realize the conversation was ending.  Looking back, it’s a pretty warm/fuzzy feeling inside.

It looks like the first time I drove was on a Friday, Jan 31.  Basically from what I eventually learned about ratings, I sucked that night!  Badly!   But at the time I had no idea since the experience was very novel and very unique and definitely fun.   I think my first passenger was a dude working at some tech company in the Mission (theres office space in the Mission?!) at like 20th and Folsom or something and I gave him a ride home to Daly City.

Since then…

I gave a Lyft to a passenger with a very unique name:  Veigar.   Though the name wasn’t foreign to me.  It was also the name of this spell casting, purple midget dude in my favorite computer game, League of Legends.   The ride was quiet at first, and he chose to sit in the back seat.  After asking him what the origin of his name was (Iceland), I made a remark of how I’d had seen this name in a video game I played.

Turns out, this “Veigar” who was riding with me actually worked at Riot Games who made the game itself and the Veigar from League of Legends was actually named after him!  I couldn’t believe it!  I was filled with sheer awe and even joy, haha.  Looking back at it,  I  really should have asked to take a picture with him.  If anything, to fulfill my gamer-like-thirst for liking things that are obnoxious/weird/funny.

  1.   I despite being a total noob with not a clue of how my demeanor should be My first ever passenger was a dude I picked up in the Mission and took to Daly City.

‘iftop’ – top for network interfaces on linux!

this thing is cool!! look look    http://www.ex-parrot.com/pdw/iftop/

what’s all those columns in the  display of?  from the man page…

The  main part of the display lists, for each pair of hosts, the rate at which data has been sent and received over the preceding 2, 10 and 40 second intervals. Thedirection of data flow is indicated by arrows, <= and =>. For instance,
       foo.example.com  =>  bar.example.com      1Kb  500b   100b
                        <=                       2Mb    2Mb    2Mb

 

iftop-on-web1

ctrl+c dosen’t cancel a running Python script that uses threads?! /gasp

welp, ctrl+c is my best friend when it comes to bailing out of a program where I screwed up or is taking too long for my gamer-esque patience

It turns out you actually gotta kill -9 the process!

The answer to “why” this is the case is around 22:00 to 25:00 in this  presentation, “Inside the Python GIL”  by David Beazley:

This came about as recently I’ve been working on a Rackspace Cloud Files container replication program, and I’ve been working on trying to speed it up in ways so that it completes in a “reasonable” amount of time.   

I first gave it a shot at it with the multiprocessing module.  Soon enough though I found I couldn’t use it due to the inability to pickle an SSLObject.  Which, I guess the cloudfiles.connection.Connection I was using to connect to the Cloud Files container was using.

At this point I went searching for an answer, and tangentially discovered that Cloud Files’ origin was actually from a separate company named Mosso, which Rackspace acquired and turned into their cloud service thingy!

My second try was more successful:  using the threading and Queue modules to create a specified number of worker threads to run replicate() method over a queue of container objects.

And this is where I discovered this ctrl+c weirdness/intricacy.  I’d have a bug or some stack happening which I could see from the debug output.  Wanting to exit out early, I’d bang on ctrl+c to absolutely no avail!  Sooooo weird!  haha

 

Summing a column of numbers using awk

When I googled “awk sum count of column”  I found this answer from a site i’ve never heard about!  haha  http://www.commandlinefu.com/commands/view/1497/using-awk-to-sumcount-a-column-of-numbers.  It looks like a stack overflow for shell commands!

Inexperienced with awk, my first attempt was to extract the third column which had the count I wanted to sum, and find a way to add that.   Through some searching I found the program bc,  which is basically a command line calculator.

cat thumbnail-counts.txt  | awk '{ print $3 }' | paste -sd+ - | bc

 

However,  it turns out awk has a lot more power than just extracting columns of text  😀   And a succinct solution turns out to be this:

     cat count.txt | awk '{ sum+=$1} END {print sum}'