Skip to main content

Posts about python (old posts, page 1)

Recurse Center, 2014-08-14

  • I spent the morning cleaning up the "repr" functions of the diff classes, so that the diff of functions between two modules can be printed out in a somewhat meaningful way.
  • I spent most of the afternoon, preparing to make a small presentation on how sys.path works in Python. I thought I didn't do as good a job of it, as I would've liked, but Tom thought it was not too bad…
  • Looks like another of those days, where I didn't get much done… I spent the evening finishing off Homeland. It's a brilliant book, and everyone who cares about the Government and policies and technology MUST read it! Thanks Cory.

Recurse Center, 2014-08-13

  • I feel like I didn't get much done yesterday.
  • I mostly worked on the API differ, but didn't get much done. I have a few tests, and some code for diffing two functions, but I'm not very happy with it.
  • I helped Giorgio and Carlos with using my client only hs_oauth script/library, for their Zulip bot.
  • The white boarding group worked on some binary related problems, and it was fun.
  • I looked at how the HS OAuth backend works on blaggregator and thought about how to go about fixing the issue of broken images on the site. The problem happens because the image URLs are returned from the HS API calls, that are made whenever a user logs in(?), and the URLs are cached. Since, HS uses cloudfront for its assets, the URLs expire after a period of time, and the cached urls in blag's database need to be updated. There could be two ways of doing it -
    1. Check if the URL 404s, every time a URL is requested, on the server side.
    2. Do it on the client side, with some javascript magic.

    Intuitively, I feel like 2. would be better, but Madhu suggested that 1. wouldn't be that bad either. We could try both out, and see which works better I suppose.

    I'd be interested to try this out, sometime.

Recurse Center, 2014-08-12

  • An issue I was seeing with pip and a package installed in system-site-packages turned out to be non-reproducible. It was probably PEBKAC.
  • I was wondering around in the morning trying to find something to work on.
  • I decided to work on Pankaj's idea to write a tool that gives you API differences between two versions of a library. It would be useful to have the list of public API changes in a library you use, to estimate the cost of updating to the newer version, without having to manually go through all the changes.
  • I spent some time talking to Sophia, and looking at her FTP server's refactored code.

Recurse Center, 2014-08-11

  • I spent about an hour in the morning testing out the staging blaggregator instance, and things seemed to work as expected. Side note, I got added as a collaborator on the blaggregator repo!
  • We worked through the first chapter on getting video working, but we mostly ended up just copying code rather than actually understanding/carefully studying it. I'm not sure how I feel about it, but we got to display fancy stuff.
  • I wasn't feeling like working on any of my 'old'/'ongoing' projects, and since Mondays don't feel very productive, I worked on writing a couple of simple scripts to create twitter lists of HSers, batch wise.

    For the HS API, I just reused some old code I had lying around from my experiments with the OAuth2 API, though I had to tweak it a little bit to be able to actually login, using requests. Something about CSRF tokens seems to have changed.

    In the process, I found that twitter's API isn't very pleasant to use. Or may be it's the fact that I was using python twitter client without getting my own client id/key, but the whole experience of dealing with the twitter API wasn't a pleasant one at all!

  • Amber, Daria and I also spent about an hour white-boarding some problems from the Cracking the Code Interview book.
  • I ended up fixing some minor issues with blaggregator and am hoping that the long pending PR will be merged today.

Recurse Center, 2014-08-08

  • I spent the morning doing some white-boarding interview practice with a Jorge and Brian.
  • I spent the rest of the day, playing with PyPy and working through a tutorial that teaches us to write a BF interpreter.
  • I spent the Saturday revamping my Emacs config. The main issue with my config was having a "package" list, of all the packages that the configuration uses, in case we are trying to duplicate it elsewhere. I noticed that this gets out of sync, because I install packages by hand and never update this list. I wrote up some code, that keeps this list in sync with all the packages I have installed. I configured el-get to play well with my config, and am pretty happy with my setup, though I still have to add some matching/searching features with helm/ido/whatever else.
  • I spent the Sunday writing a patch to xtab to be able to limit the number of tabs in Chromium by the memory it uses.

Recurse Center, 2014-08-03


  • On Friday, I didn't do the exercises that everyone else doing job prep were doing. I wanted to continue writing C code, and continued to work on the bencode parser in C. I barely was able to finish adding support for lists.
  • I got comfortable using Valgrind, in the process of debugging a stupidity of not using realloc correctly.
  • What I was able to write with Python in an hour or so, I have been writing for about a day, in C, and haven't yet finished it! It definitely doesn't help that my C is very rusty…

Saturday & Sunday

  • I didn't work much, and went around New York with Madhu. We went to quite a few places around here, the highlight being, the view of Manhattan's skyline from the Staten Island Ferry.
  • NYC's library also had an interesting exhibhition on the history of America, just before and during WW-I.
  • On Sunday, I tried out Mary TTS on the raspberry pi, and it is simply unusable.
  • I then, started writing a simple wrapper around Google's tts that is used by Google translate.
  • The TTS part is more or less working right now, the next step would be to deploy it on the RaspberryPi and start using it as a radio, to see what my needs are like. Hooking it up to Jasper client seems like a good idea, right now… though I'm not sure if it would work very well, with the pi's audio output drowning out the voice commands.

Recurse Center, 2014-07-28

  • There seemed to be excitement in the space to have Jessica around. We had coffee with her, and I chatted with her briefly. She encouraged me to try and send a patch to CPython, that involved debugging and fixing some C issues.
  • I spent some time with Tom, while he tried to get cinspect working for him, and it seemed like having the developer next to you, helped. As always. We didn't make any fixes to the code, but it worked.
  • I spent the afternoon, adding tests for a simple issue, to see how patches are sent.
  • Later, I paired with Sophia for an hour to refactor the vcs code. It's beginning to look much better than what it used to, and I like that.
  • Jessica's talk on buffer overflows was enlightening and entertaining. It was very similar to a talk that Max gave on one of the thursdays, but it was exciting nevertheless.
  • After the talk, I am inspired to try and work through the Hacking: Art of exploitation, at some point. I'm beginning to feel like time at HackerSchool running out!

Recurse Center, 2014-07-25

  • We worked on writing our own (toy) version control system on Friday, as a part of job prep. I paired with Sophia, and we got upto the point where we had diffs working, when we decided to refactor the code with some tests and stuff.
  • The party was brilliant with a lot of activity. All the project installations looked so cool, and it was so much fun!
  • I spent some time during the weekend watching the "Anatomy of Matplotlib" lectures.
  • I started some work with poking around Matplotlib's template backend, and trying to start writing and ascii backend.
  • Also, I was trying to help UC setup GrooveBasin on his raspberry pi, and helped him configure jasper on it.

Recurse Center, 2014-07-24

Glowing LEDs and me

  • It turned out that the SPI driver exposed a faster way to write bits, writing to all the LEDs at once, instead of one at a time, and this was sufficient to get things working!
  • Kyle and I started to have enough, of the glowing LEDs and decided to wrap up the project, but, Nick had different ideas for us! We had talked about having the music stream via airplay, but Nick got his DJing tools, and it would be too bad to not use it for the party, but doing that meant Airplay's delay wouldn't help the DJ. So, we connected a line-in, and thought we'd be done if we just read the input and used that data. But, it turns out that's not so simple because sending data over the wire, added noise to it, and in a whole range of frequencies! I tried removing all the fourier coefficients which were lower than a threshold, but I felt like it didn't work very well, until Nick reduced the gain of this output on the amp to the very minimum. Finally, Kyle and I decided that this was good enough for the party!
  • I also hacked up a quick script to read a font file, and use the grey values to get ascii characters to show up on the LED strip.


  • While trying to find the RPi on the network, I learnt that sudo nmap -sP 10.0.1.* gives us the hostname as well, instead of just IPs. sudo being the key, here.
  • Kyle and I went and grabbed dinner in a restaurant in west village. It was good to sit down and talk about various things, and eat. The glowing LEDs were totally out of my mind for that period, and the break was good!
  • There were a bunch of HSers doing mock-interviews and it was fun to watch, so I stayed on until quite late, when all of us headed out together.


  • I'm excited about trying to build a small version control system from scratch today!
  • Though I have had quite a bit of glowing LEDs in my face for the past week, I may suck up to it, and figure out how to do scrolling text on the display.
  • Also, excited to see how all the cool projects will come together in the party tonight!

Recurse Center, 2014-07-23

Shairplay and WS2801

  • Kyle mounted the LEDs onto a cardboard, and packaged it to look cool.
  • We thought we were done with the project, until we found out we weren't! The LEDs all lighted up correctly, when we played the audio from a file on disk, but streaming messed something up! Only the first few columns lighted up, when we were listening on the stream.
  • We spent the whole evening trying to debug the issue, and eliminated quite a few hypothesis, but weren't able to fix it, yet.


  • rntz live coded a parser for us yesterday, and I learnt a few things about parsers. I'm glad I went to the discussion/talk.
  • I started working through the videos of Anatomy of Matplotlib, and hope to get new insights into how it works.


  • Today will be spent mostly trying to get streaming audio working.
  • I feel like debugging this, will take my understanding of the hardware-software interface to a new level.