Peter Sobot

Bona fide software engineer @pagerduty. @uwaterloo alum, @wubmachine, @foreverfm. Musician at heart.

Page 2


Interns are Leading the Way

I attend the University of Waterloo, one of Canada’s most widely-known engineering schools. Waterloo is famous for a system they call co-op - a regimen of paid internships of 4-8 months in duration in a real-world work environment. Co-op is mandatory for all engineering students, and upon graduation, results in each student having worked at up to 6 different companies for a total of at least 24 months. Each “work term” can happen during the summer, fall, or winter, and can be within Canada or abroad. (We do often go abroad, primarily to Silicon Valley.) Here’s where my class went for internships this past summer:

Where my class went for internships for WT4.

Over the past year, a number of Waterloo interns have had the pleasure of interning at Khan Academy, the groundbreaking non-profit dedicated to “accelerate learning for students of all ages.” They’ve made such an impression on Sal Khan, its founder, that he’s gone on to speak

Continue reading →


Emergency Bandwidth Distribution

Late last week, I officially launched forever.fm, an infinite, beatmatched radio stream powered by SoundCloud. This morning, I was happy to discover that it had been featured in Hack A Day - one of my favourite hack-centric blogs. However, such exposure resulted in one small issue:

Ow, my wallet!

That’s 25% of my little 512MB Linode’s monthly bandwidth allotment being used up in 6 hours. With Linode (as of this writing) charging $0.10/GB for bandwidth (allotted or through overages), that huge server load could get very expensive, very fast. (At that rate, each listener would cost me roughly $0.25 per day of constant listening. Not viable for a free service!)

So, this afternoon, I was faced with a dilemma. How do I quickly and easily make it cheaper for me to host the site at peak times? A tried and true CDN would be a good solution, but even simple CDNs like Amazon CloudFront would cost more than

Continue reading →


Introducing forever.fm

I’m very proud to announce the launch of my latest project - forever.fm, an automatic, infinite online DJ. Forever.fm is a beatmatched stream of the hottest tracks from SoundCloud, mixed together to sound awesome, and continuing forever. (No advertisements, DJ chatter, or breaks!) Check it out!

Live today!

WARNING: Past this point, you’ll find only gory technical details of how forever.fm was made.

 Overview

Forever is powered by a large number of technologies, some of which I stole from my previous music hack, the Wub Machine:

  • For this project, I chose to use a 512MB Linode VPS, which has been running spectacularly.
  • The entire site runs on Python and uses Facebook’s Tornado evented server.
  • To stream track metadata, waveforms, and other live updates, I’ve used Socket.IO and tornadio2, its Tornado wrapper.
  • the SoundCloud API provides the songs, metadata and audio streams that you hear.
  • the

Continue reading →


Rewriting in C++ for Fun, Speed and Masochism

A couple months ago, I posted a blog post explaining my use for low-quality
smartphone photos. It involved a smart image cropping algorithm written by
Michael Macias, using ImageMagick and written in Ruby. I’ve actually used
the algorithm quite a bit in preparing new photos for my homepage - although
there’s one major problem - it’s amazingly slow. Take a look at the kind of processing it does:

The most interesting part of Grand Central Station.

On large JPEGs from my own photo library, like the one above, this Ruby script takes roughly 2 seconds to perform a smart 124px square crop on the most interesting part of the
image:

Matched 9 images.
Originals/2012/NYC/IMG_7054.JPG => ./18.jpg in 1801.717ms
Originals/2012/NYC/IMG_7055.JPG => ./19.jpg in 1856.692ms
Originals/2012/NYC/IMG_7052.JPG => ./20.jpg in 1787.717ms
Originals/2012/NYC/IMG_7059.JPG => ./21.jpg in 1727.487ms
Originals/2012/NYC/IMG_7057.JPG => ./22.jpg in 1716.977ms

Continue reading →


The Ubiquitous Capture Device

Every so often, I find myself in a camera store, gawking at beautiful, expensive
cameras and lenses. DSLRs have dropped in price, and mirrorless interchangeable
lens cameras (also known as micro four thirds) now fill the gap between
cheap point-and-shoot and semi-pro. However, every single time I go to make such
a purchase, I stop myself.

It’s not that I don’t want a good camera, it’s that I already have a camera
good enough
. Most of us have one on us at all times.

It’s my smartphone, and it can capture images like this:

A moment, as captured with a lowly smartphone.

This image isn’t pristine. It’s vibrant, although it could be moreso. It’s
lacking in detail, a bit noisy, and somewhat compressed. (Compressing it for web
didn’t help with the presentation, either.) However, none of that is important.
It’s a beautiful reminder of that moment - a great lunch with a great person, on
a bright and sunny day, in a crowded restaurant

Continue reading →


Using Eight Cores (incorrectly) with Python

One of my web apps, The Wub Machine, is very computationally expensive.
Audio decoding, processing, encoding, and streaming, all in Python. Naturally,
my first instinct was to turn to the multiprocessing module to spread the
CPU-bound work across multiple processes, thus avoiding Python’s global
interpreter lock.

Remixing is hard work.

In theory, it’s simple enough, but I did run into a few very nasty problems
when dealing with multiprocessing in Python:

  • The multiprocessing module, at least on *nixes, forks the current process
    and communicates with the child with a pipe. This works wonderfully if the
    data you’re transferring can be easily pickled, and if the child
    process doesn’t need to modify any global state in the parent.
    Unfortunately, certain useful constructs in Python can’t be pickled,
    including functions and lambdas (or pretty much anything callable).

    In my app, I had a peculiar use case - I

Continue reading →


A Site For Dinner

I like to make small, single-serving sites - frivolous sites with only one
page, and one purpose. They’re intended to be dead-simple to use, fun to play
with, and somewhat silly. I’ve made a couple in the past, both
alone and with others, often thinking of the idea over dinner and then
implementing it in the hours (or days) that follow. Last night, I decided to
make another single-serving site - and to make it open-source, to show
others how simple it is to do.

Enter A Meal for Me. Roughly 200 lines of code for a fun site that now
helps me be more adventurous in the kitchen. (Grab the source on GitHub!)

That could make a tasty meal...

Development took a couple hours, and was simple enough:

  1. Have dinner.
  2. Google for “Recipe API.”
  3. Get an API key.
  4. Layout a simple page in HAML.
  5. Style with SASS.
  6. Wire it up to the API, and use some basic jQuery to munge the data.
  7. Apply a Google Web Font and subtle background pattern to

Continue reading →


Startups: Bands for Hackers

Growing up as a young musician in suburbia, I fantasized about being in a band:
playing music in front of thousands of people, signing a record contract,
enjoying the successes (and excesses) of stardom and celebrity. As I grew older,
I began to realize how difficult it would be to achieve that goal.

Years later, as I started university and was accepted into VeloCity,
Waterloo‘s startup incubator, I noticed a lot of familiar dreams.
Although their domains are vastly different, startups are just bands for hackers.

Wonderful doodles courtesy of Younjin Kim.

Like many bands, many startups begin in parents’ garages - serious business
in a non-serious atmosphere. Founders (or band members) spend every waking
moment together, working hard to perfect their craft and their endeavour. While
bands work to perfect their lyrics, melodies and rhythms, startups work to
perfect their pitch, product and business plan. Instead of fans

Continue reading →


A Use for Smartphone Photos

As a smartphone user, I take a lot of photos. Since I bought an iPhone 4 nearly two years ago, I’ve taken just over 6,000 photos with it. 47GB of memories. On average, 10 photos per day, every day, often of nothing in particular.

These photos aren’t good enough, or meaningful enough to anyone else, to post on Flickr. 500px would scoff at them. The few people on Facebook that would recognize the people, places and events in the photos wouldn’t see the point. They’re tiny fragments of my life, and that’s about it.

My homepage, when this was written.

Instead of forcing these thousands of photos to stay hidden in my iPhoto
library, I found an outlet for them - my homepage. Crudely modelled after the
stellar TED.com landing page, it’s supplied by a random set of hundreds of
images, all of which I’ve taken, and until now, hand-cropped and hand-selected.

Michael Macias, in a submission to a Codebrawl last November, came up

Continue reading →


Software, Art, Music and Games

I am a software engineering student. The exact definition of that varies among my classmates and professors. Some say that it implies an ability to write software. Others argue that it requires a strong grasp of algorithms and mathematical optimization. Still others say that software engineers need only be able to design large, complex pieces of software, or manage teams of coders, or communicate project specifications, etc.

Few people correlate software engineering with art.

There are those that will argue that “software itself is a form of art,” or that “this code is beautiful.” There are certainly pieces of software, written in different languages, that could be considered their own distinct forms of “poetry.” (And no, I’m not just talking about Lisp poetry.) Elegance, cleverness, and the functionality of the code all contribute to this sense of inherent artistry.

I prefer to write

Continue reading →