eurica

numbers for people.

February 12, 2014
by dave
Comments Off

PagerDuty & Ruby with HTTParty

I’m trying to do more of my hackdays in Ruby, since it’s practically the lingua franca of San Francisco. Since we don’t have an official Ruby library, I used HTTParty.

You’re more then welcome to use it: https://gist.github.com/eurica/8951769

#This is a read-only API key:
webdemo = PagerDuty.new("webdemo","BcRghqyTqokgfx3ADXiq")
# Get incidents:
puts webdemo.get("incidents", :query => "limit=1")

Continue Reading →

January 9, 2014
by dave
Comments Off

Stop LinkedIn from showing candidates’ pictures

ghost_person_200x200_v1I spend a lot of time screening candidates for PagerDuty, and even if it doesn’t mesh with my gut the science says I might be subconsciously favouring mustaches, or be biased towards or against attractive people. So it’s counter-productive to my goals that LinkedIn keeps showing me photos of applicants — enough so that I decided to fix it.

Ideally I’d also swap names for initials since I don’t care about your gender or ethnicity, just what you can do. That’s a little harder since every tool and cultural convention along the way identifies people that way — and sooner or later I’m going to meet the stronger candidates anyway.

Blocking user images from LinkedIn:

User Styles with Stylish (the easy way)

I made a script available on userstyles.org that you can install with on click if you have Stylish

Custom.css in Chrome (the way I did it)

The fact that Stylish wants to “Access your data on all websites, Access your tabs and browsing activity” means that I only turn it on during development.

Chrome lets you specify a Custom.css (most browsers have some equivalent), so I added the following to mine1:

/* LinkedIn Main profile picture, specific enough to not trigger on other sites: .profile-card .profile-picture img */
.profile-card .profile-picture img {
content: url(https://www.gravatar.com/avatar/00000000000000000000000000000000?d=mm&f=y);
}

And there you go, hopefully it’s worth a minute or two to judge resumes on their content.

  1. Actually, the first thing I tried was to make a user script, GreaseMonkey a simple:

    // ==UserScript==
    // @match http://*.linkedin.com/*
    // ==/UserScript==
    $(".profile-picture a img").attr("src","about:blank")

    But it turned out that the picture was often displayed before jQuery was loaded (which is solvable with old timey raw DOM code) but GreaseMonkey tended to run after the image was displayed, so that’s a non-starter.

December 13, 2013
by dave
Comments Off

Solving Unblockme

I’m really bad at enjoying games, I keep getting distracted and trying to build a bot to beat the game. Unblock Me is an adorable puzzle game for mobile, here’s what I learnt about it.

Unblock_Me_puzzle9The first step was to represent the puzzles. as text. So puzzle 9 would be:

<->^++
^<>|<>
|:)v+^
v+^<>|
++v+^v
<->+v+

The Smiley face represents the red block, the others are fairly self-explanatory. The nice thing about this format is there’s a very simple pattern to look for for possible moves: is there something pointed at a plus sign? (Or a plus beside the smiley)

Solving a puzzle is as simple as doing a breadth first search:

  1. For every board layout we know about (at the beginning it’s just the start board) calculate all the possible boards that we can do in one move.
  2. Did we get the smiley face to column 5? If so: win!
  3. For every board that we don’t know about yet, add it to the list (and record which board it came from as the parent).
  4. Count how many times we’ve been through this and loop over it again.

Once we’ve found a winning board, we know it’s the shortest path since we’ve tried every other set of that many moves. And we can find the solution path by looking following the parents back to the starting board.
Continue Reading →

December 9, 2013
by dave
Comments Off

Yet another thing drones would do better: escort surveillance planes

[Dec 31st Update: The US Navy is on it]

This is a little outside my wheelhouse, but when I read this article about a simulated encounter between Chinese J-11s and J-10s and Japanese P-3C Orion with F-15Js and SAM platforms.

An F-22 costs $150 million, I couldn’t find pricing for an F-15J, but the Korean variant costs $100 million so I assume the same ballpark. Thus the Japanese/American side in this conflict is flying three-quarters a billion dollars in hardware with 10 crew but the entire encounter was determined by long range missiles (that cost about half a million each).

Looking just at the escort role (in this story: $200 million in hardware and 4 crew), it seems like something that drones could take over easily. For comparison an Avenger drone 1 only goes a third as fast as the fighter jets, but at $15 million, it can more than keep up with the P-3C in the story and carry 3 tonnes of weapons. Avengers aren’t designed for air-to-air combat, but it isn’t hard to imagine a similar drone, optimized to carry long range air-to-air missiles that could carry 6-8 AIM-120 AMRAAM. An escort drone could even sacrifice stealth for lower cost or increased performance since the surveillance craft or transport that it would be escorting would light up the radar anyway and it would be preferable for any missile to hit the drone instead.

Arguably 4 drones with 24-32 missiles would also need far fewer pilots, as following another plane in formation is probably well within the capabilities of a drone. In the rare event of hostile action, more pilots could be pulled off more routine missions. Either some or all of the drones could peel off and participate in modern day dog-fighting — get missile lock, fire, repeat, and then try to evade missiles fired at you. Drones of course, could stand their ground and accept being blown up as the (much lower) cost of doing business. (As an added bonus, this suicidal charge is exactly when the missile performs best.)

There’s also the obvious question of whether short-range missiles will ever have a place in dog-fighting again (or if “dog-fighting” will ever happen again in any recognizable form) and why long range air-to-air missiles don’t get a fraction of the attention that the F-35 gets (except apparently, from the Russians). If all missiles have the same range, the faster planes still need to come to the slower drone in order to fine — negating much of the benefit of their speed.

I’m sure I’m missing something, but for the task of escorting a plane that can’t get over 400 knots, drones seem perfect.

  1. The Avenger is still under development, but this is just spitballing — fun fact: it has engines made in Canada!

October 22, 2013
by dave
Comments Off

Why is no-one disrupting Bart?

As of this morning, it sounds like BART is back and those of us that live in SF can fold up our couches again.

But even when it is working, it raises the question: why isn’t anyone building “Uber for buses”? Or alternately Megabus for daily commuting.

I realize that it’s a licensing nightmare, but if RideJoy can get me to San Diego and SideCar can run a livery service on donations there must be some way to build a busing club with a mobile app.

Just like Uber, the idea would probably involve siphoning off the most affluent passengers — Smartphone toting people in the Bay Area with high salaries but who have been forced out of SF proper by rising housing costs. And like the much maligned private shuttles offered by tech giants south of the city, the bus routes would focus on the employment centers and the gentrifying neighbourhoods. Schedule seats with an app, and run 24 hours on weekends (possibly from the Mission rather than SOMA) and you have all of the revenue, none of the poop.

If someone had launched this service last week they’d be having their hockey stick moment already. But it’s a halfway decent plan even without BART striking.

My first choice would be a better public transit system with dense development at the nodes, more than one axis across town, 24 hour service and no urine smell but until that day — anyone want to start a bus company?

October 11, 2013
by dave
Comments Off

Turning the lights on from PagerDuty

IFTTT screenshotI recently slept through a PagerDuty incident — or rather, I woke up, looked at the back of my phone, assumed that I dreamt it and went back to sleep. I can do better…what if PagerDuty incidents could turn on the lights for me?

So I picked up a Belkin WeMo Switch, which is an internet enabled on/off switch that works with anything. Honestly, I am pretty disappointed with it; the mobile app is crappy and it essentially went dead after a firmware upgrade and most importantly, there’s no documented API. Next time (or this time…I might end up returning it if it keeps falling off the network), I’ll go with the Philips Hue Wireless Lighting, although I really wanted a PagerDuty alert to start the kettle as well.

Since there’s no public API for the WeMo, I’m going to work through If This Then That, which is always a fun thing to plug into. IFTTT doesn’t take PagerDuty webhooks (not yet anyway, I’m pestering them now), so I’m going to repurpose a PHP code sample that I wrote for a customer to send IFTTT an email with one tag if the lights should go on, and another if they should go off (on incident resolution).

As a side note, this was my first time using Runscope1 to test and debug some code. Wow, is that a smooth product! Basically I tell PagerDuty to send the webhook to Runscope, and Runscope forwards it along to my script but lets me view, edit and replay traffic between them. This was a very simple project, so I didn’t save more than 20 minutes, but I’ll be using it again in the future for sure. 2

Anyway, the whole thing works. It takes about 5-15 seconds between the incident firing and the light turning on:
Continue Reading →

  1. I have fond memories of using Fiddler locally, Runscope is Fiddler++ and it works for web glue
  2. As a weird co-incidence, one of the Runscope co-founders also worked for IFTTT, and before that he worked for yet another company whose product I used today — SF is a small place, you should totally live here

September 2, 2013
by dave
Comments Off

Making things: t-shirt edition

I’m addicted to making things, and Zazzle (among others) feeds that addiction. Most of my designs are pretty simple puns, but the most important thing about humour is knowing your audience and sometimes you need to crack open a PBR and moan about hipsters in the mission.

Or a shirt to tease your graphics team, or a company t-shirt for a friend’s son, or your friend as Che Guevera, or a detailed uniform for the OFSAA Under-5 wrestling league…

HipstersHelvetica is Ok Continue Reading →

July 27, 2013
by dave
Comments Off

How many people use Gravatar?

Background: At PagerDuty we’re revisiting our mobile app. Gravatar is a great service made by the founder of GitHub in 2007 that lets people upload their picture and serves it back to any service that can link to a URL. 1-3% of the top million sites 1 and serves 100,000 requests a second. Naturally I wondered how may actually return images.

Our background: When PagerDuty launched, it was an obvious and easy thing to integrate, but on a mobile device, each one of those http requests is a lot more expensive. So we did the research2:

  • 23% of our users have Gravatars. This compares pretty well to the system average: 18% of requests to Gravatar return an image3, but it’s lower than the numbers for WordPress sites (30-40%) and WordPress.com (50-60%)4
  • It doesn’t vary much by size of company or account, but smaller accounts had slightly higher Gravatar penetration
  • This was partially because of very small accounts tipping the scales, 40% of users with gmail.com addresses had Gravatars
  • There is a lot of variance by company ranging from 0% to 93%. The trends aren’t surprising (Nike employees do not use Gravatar at the same rate as Heroku employees)
  • The median percentage for a company was 13%

For a comparison at the far end: Github, unsurprisingly, is absolutely awash in Gravatars: all the projects that I looked at had >90% Gravatar use, all of the top 100 users had Gravatars, and when I looked, John MacFarlane took the prize for most active user without a picture at #148.

  1. I’ve been a top million site according to Alexa before but now I’m barely top 2million
  2. our users are very technical so these numbers may not match your user demographics
  3. I’m very thankful to Simon at WordPress for tracking these numbers down for me
  4. This makes sense, as our #1 complaint from customers about using Gravatars is that they’d have to sign up for a WordPress account