Category Archives: Uncategorized

…and we’re back

welp, since my last post I moved hosting from rackspace to digital ocean and due to extreme laziness haven’t went into the control panel to make the blog.dlam.me subdomain to make this work right

anyhoo recently this past week I did not one, but *two*, scavenger hunt things.  

1. http://realescapegame.com/category/real-escape-room/   – basically you’re trapped in a room and you have to get out by looking for clues,  scavenging for stuff and solving puzzles.  There was one particularly impressive clue that I remember:  imagine a 6×10 Japanese anime book with about 150 pages.  If you looked carefully at it, you’d notice one of the corners are creased a la a bookmark.  This brought you to a page in the comic in which the character is examining a black swiveling office chair and finds a tiny hole which he states one would never find unless they were meticulously looking for it.  Out of curiosity the character in the comic disassembles a pen to try to poke through it, and it revealed something.

Sure enough,  inside the room we were in was a black swiveling office chair, and the facilitator at the start of our game gave us each pens and paper to take notes on.  Realizing that this was  indeed a clue, we took apart one of the pens and poked it through a hole at the bottom of the chair ans sure enough it popped open a concealed part of the chair with a crossword puzzle to solve .

It was super hard haha.  My job was to look for and break stuff

 

2.  http://thegogame.com/team-building-san-francisco/   –   so this scavenger hunt was set around jefferson square park in north beach.  It was pretty high tech.  And it involved using your phone to get your next clue, and physically walking to certain street intersections or locations to solve them.  Sometimes, the clues involved interacting with actor game plants playing some sort of role,  and whom you had to do something silly or say the right thing to extract a clue for them.  For example, one game plant was a pretty girl sitting down in a specific bar, in which a clue on the phone was to give her a good pickup line.  If you walked in, it wasnt obvious who to talk too… until you realized there was only-one-girl-at-the-bar-sitting-down-at-11-am, haha.  I failed miserably as I didn’t know any pick up lines, but the rest of co-worker team did super good and were successful, yay.

Another actor-clue-scavenger-hunt-thing involved getting some sort of art to impress a lady sitting at the corner of some intersection.  And so, along the way we found a big thrown out white iMac box with a big picture of itself on the side.  Naturally, we thought it might be artistic to put a head through it, so using our car keys we carved out a hole big enought for a head and I got to walk around with that.  We even got some random people who were just walking about in North Beach to don the iMac box haha.  I thought it was sooooo funny for some reason.

 

 

 

So tonight I went to another Django meetup at Yelp:   “Django 1.7 And You”   –  Andrew Godwin was the speaker and talked about migrations being moved into core (of course),  app loading,  and other new things I hadn’t heard about like the system check framework and custom lookups when using the mighty QuerySet filter().

There, out of nowhere while I was sitting down I noticed to my left Jason Monberg!  I hadn’t seen him in years ever since we worked at MarkLogic!  I said hi after the talk, and we had a fun little conversation and he mentioned he worked steps away from the building.

Afterwords, I rode a bike (my fav) back to my car parked at 8th and Bryant and did some Lyfts:

  1. Think my first ride was someone on Townsend and the Adobe building (where I’ve went to meetups too!)  near Caltrain, and I took her to somewhere in Hayes Valley
  2. Then my next ride was awfully memorable:  she was an indian girl who went to Gunn where I went to high school!   She graduated in 2000 and lived in Los Altos Hills.  I brought up random names of teachers, like Ms. Gill and Bio, but she forgot all their names.  We drove from like Van Ness to the Hilton in the Embarcadero on Market.
  3. After that,  I drove home and turned my thing on in Palo Alto.  There, I got pinged right in front of the Pennisula Creamery and picked up this guy who just got here from New York earlier today.    Turns out, he was a Python programmer, and knew about Django.  He did brain imaging stuff.  I brought up being intimately familiar with it too, having actually *done* an MRI and angiogram and stuff.  I told him my AVM story.   It was a far ride:  from downtown Palo Alto to San Jose near SJSU where he was staying at an Airbnb place.
  4. My last ride were 3 guys who recently graduated from college and watched the Sharks game.  The Sharks had just lost game 7 after being up 3-0 in the series,  meaning they had just completed an epic fail playoff meltdown.  They were fun and  semi drunk, and so were heckling LA Kings fans from inside the car.  They were going to Campbell.  I tried to use Waze,  but for some reason it wasn’t working weirdly, so I indicated to guide me.  The first ramp to 880 was closed, so we wound up driving to nearby Santa Clara University where I mentioned I knew the area since I went to school there.  Turns out,  these 3 guys actually had gone to SCU too!  I deluged them with my SCU knowledge and asked them if they had done a capstone project too.  They actually did their capstone all together!   All in all, it was a fun little (drunk) conversation, and I wound up dropping em off at some *other* bar in Campbell

 

python circular import fun?!

dlam notes on it!

and `import …` vs `from x import y`

from the Python Programming FAQ  section:  How can I have modules that mutually import each other?

Guido van Rossum recommends avoiding all uses of from <module> import ..., and placing all code inside functions. Initializations of global variables and class variables should use constants or built-in functions only. This means everything from an imported module is referenced as <module>.<name>.

Also see…  http://effbot.org/pyfaq/how-can-i-have-modules-that-mutually-import-each-other.htm

https://docs.python.org/2/reference/simple_stmts.html#the-import-statement

 

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}'