RSSAmplifier

Blog

Posts on

Recent content in Posts on

paulbutler.orgRSS feed ↗40 posts

Latest posts

Smuggling arbitrary data through an emoji

This Hacker News comment by GuB-42 intrigued me: With ZWJ (Zero Width Joiner) sequences you could in theory encode an unlimited amount of data in a single emoji. Is it really possible to encode arbitrary data in a single emoji? tl;dr: yes, although I found an approach without ZWJ. In fact, you can encode data in any unicode character. This sentence has a hidden…

The hater’s guide to Kubernetes

Among a certain tech set, Kubernetes has earned a reputation as an unnecessarily complicated time-sink that startups should avoid. Using Kubernetes with a small team is seen as a sign of over-engineering. I’m guilty of taking pithy jabs myself. I might gripe about Kubernetes sometimes, but it really is a great piece of technology. I highly recommend it to all my competitors. — Paul Butler…

Generalizing Secret Santa with integer programming in Julia

You might know Secret Santa as the gifting game where each person in a group is assigned another person in the group to give a gift to. For three years in a row, I’ve organized a post card exchange for plotter enthusiasts called #ptpx, which I think of as a sort of “generalized Secret Santa”. Instead of just sending and receiving one gift, participants choose how many postcards they’d like to make…

Why is it so hard to give Google money?

I’ve been trying to run search ads on Google for over a month. Due to two unrelated snags, I’ve only had ~12 hours of uptime with those ads in that time. Based on conversations with other startups that run Google Ads, my experience is neither unique nor surprising. Apropos of Google’s earnings day, I wanted to vent a bit about how hard Google makes it to use the product that…

The problem with bitcoin miners

Disclosure: I hold short positions in companies mentioned in this article. This is not financial advice. Six months ago, I wrote: [Bitcoin] miners burn an enormous amount of capital just to capture the same slice of a diminishing pie, but they take advantage of investor confusion over how mining works to frame it as investing in growth. I want to go deeper on that idea. But first, some accounting.

Rust for web devs: Destructuring

This is the first of an unbounded and weakly-ordered series of posts aimed at developers coming to Rust from a JavaScript/TypeScript background. It’s “for web devs” because my imagined reader is a web developer, but it’s not about web development. Nor is it meant to be a comprehensive introduction to Rust, just a series of essays on the parts I find interesting. If you’re brand…

What does it mean to listen on a port?

This story explores some concepts in computer networking, inspired by Michael Nielsen’s idea of discovery fiction. Code samples can also be found in this repo. Excerpts use openbsd-flavoured netcat on Debian Linux; behviour and IPv6 support may vary by version. PS: I’m currently hiring Rust and TypeScript developers for a YC-backed startup. In the corner of the student union building…

“Play-to-earn” and Bullshit Jobs

In Bullshit Jobs: A Theory, David Graeber makes the case that a sizable chunk of the labour economy is essentially people performing useless work, as a sort of subconscious self-preservation instinct of the economic status quo. The book cites ample anecdotal evidence that people perceive their own jobs as completely disconnected from any sort of value creation, and makes the case that the ruling…

Betting Against Bitcoin

I hold what amounts to a bet against bitcoin, expressed in terms of options and shorts on public market bitcoin-related companies. Given that crypto discourse tends to be dominated by bulls and boosters because that’s who shows up, I wanted to share my bear case. This is, emphatically, not investing advice. The position represents only a small part of my portfolio, and is something of a…

Calling WebAssembly from Rust

WebAssembly originated as a lightweight, portable, sandboxed code execution model for the web. Since its early days, people have realized that these qualities were useful outside of the web as well. As the standard has evolved, a wealth of tooling and standards for running WebAssembly ex-browser have appeared. As I write this in August 2021, embedding WebAssembly involves understanding a handful…

Ranked-choice Voting for Data Scientists

In a few weeks, New York City will become the largest US jurisdiction to use instant-runoff voting when it is used in the mayoral primary elections. Ranked-choice elections generate a lot of data. It’s not clear yet how much of this data the New York City Board of Elections will release immediately following the election — a bill that would mandate a broad data release did not pass before…

The WebAssembly App Gap

To users of Figma, it’s no mystery why the browser-based design tool is popular. What has been a mystery to me is why it’s so hard to point to Figma equivalents in other categories. Specifically, I mean browser-based apps that embrace modern browser tech (WebAssembly, WebGL) to compete head-to-head with desktop apps without having to compromise features for performance. The answer, I…

Comments on A False Majority

Over the past year, I have undertaken a project to analyze instant runoff elections at the ballot-level across multiple cities and states. To date, I have processed 31 instant-runoff elections, which has involved implementing in code the ballot counting and tabulation methods of five localities. In the process, I’ve gained some insight into how the instant runoff process works (and when it…

The Kelly criterion: How to size bets

Did the White House Doctor a Video?

The Misunderstood Electoral College

Understanding the Mandelbrot Fractal

Optimizing Plots with a TSP Solver

Tuning Style Transfer with a Control Surface

There’s a fun technique introduced by Gatys, Ecker, and Bethge that lets you reduce an image into separate “content” and “style” representations. Then, by taking a content representation from one image and the style representation from another, you can create a new image that matches the content of the first image in the style of the second. The gist of style transfer…

Surface Projection

Stop Dragging Hayek into Bitcoin

Note: This post discusses the relationship between Hayek’s work and cryptocurrencies, and is not financial advice. Opinions are my own. I do not hold a position in Bitcoin or other cryptocurrencies. When monetary theory comes up in reference to Bitcoin, the work of Friedrich von Hayek is often invoked. I have read a number of claims that the Nobel laureate’s 1976 book,…

The Surprising Persistence of Bad Signals

How likely is a debtor to default on a loan? How likely is a student to succeed in college? Both of these questions demand a probability that is impossible to measure directly. Instead, we find signals that proxy for them. SAT scores are meant to predict college success. FICO scores proxy for creditworthiness. We accept that there is a certain amount of measurement error in these scores. If the…

Fractal Generation with L-Systems

Visualizing Flight Options

Few routine consumer purchases involve as great a volume of data as booking a flight. For an international trip, there can be dozens of options differing by price, duration, time-of day, connections, and carrier alliances. ITA Software, now part of Google, quietly introduced a Gantt chart-style visualization. The use of Gantt-charts for flights has since been perfected and popularized by Hipmunk.…

Make for Data Scientists

This is a follow-up to Chris Clark’s post, Engineering Practices in Data Science, and is cross-posted to the Kaggle blog. Any reasonably complicated data analysis or visualization project will involve a number of stages. Typically, the data starts in some raw form and must be extracted and cleaned. Then there are a few transformation stages to get the data in the right shape, merge it with…

Groupon Visualization in HBR

A version of my Groupon visualization appears in the latest Harvard Business Review. At the suggestion of their editorial and design staff, I re-did the visualization to focus on a smaller subset of the data: deals in San Francisco. I must give the HBR staff a lot of credit for the final product — they made a visualization designed to be interactive work in print.

What $480 of Gross Revenue Looks Like to Groupon

On Saturday, the Wall St. Journal posted details of an internal Groupon memo that reported $760 million in revenue last year. The WSJ article came just as I was finishing up a visualization of some data I had collected on Groupon deals, which gives perspective on that massive number in terms of the individual deals. Each box is a deal. I used height to represent number sold, and width to represent…

Visualizing Facebook Friends

Earlier this week I published a data visualization on the Facebook Engineering blog which, to my surprise, has received a lot of media coverage I’ve received a lot comments about the image, many asking for more details on how I created it. When I tell people I used R, the reaction I get is roughly what I would expect if I told them I made it with Microsoft Paint and a bottle of Jägermeister.

Data Structures for Range-Sum Queries

This week I attended the Canadian Undergraduate Mathematics Conference. I enjoyed talks from a number of branches of mathematics, and gave a talk of my own on range-sum queries. Essentially, range-aggregate queries are a class of database queries which involve taking an aggregate (in SQL terms, SUM, AVG, COUNT, MIN, etc.) over a set of data where the elements are filtered by simple inequality…

An experiment in A/B Testing my Résumé

Objective I’ll admit it: my résumé doesn’t stand out. I’ve had some great internships, but also a tendency to work for companies that aren’t (yet!) household names. And though I’m doing fine academically, it’s not well enough to stand out on my marks alone. On the other hand, my blog lets me stand out. I’ve had a few opportunities to meet and interview with some great people and companies because…

Why R Doesn't Suck

I first encountered the R programming language a few years ago when I needed to make some plots. Although I’ve used it occasionally since, I always considered it a sort of “Perl for statisticians” — a useful swiss-army knife with ugly syntax and inconsistent semantics. My workflow generally involved manipulating the data in Python and using R to make a simple plot, minimizing the amount of R code…

Groupon Math: Data Scraping to Estimate Revenue

There’s been a lot of talk recently about the Chicago startup Groupon. Groupon brands itself as a group-buying site, but it’s really more of a localized version of what woot.com does. They post a new deal (which they call a Groupon) every day, available only on that day. If enough people want to buy it, everyone gets it for a substantial discount. Otherwise, nobody gets anything, but this rarely…

Do we Really Need Another Programming Language?

Yesterday, a group inside Google released a new programming language called go. Among the many comments on the new language, I noticed a number of people rhetorically asking if there is really room for more programming languages. I’ve seen the same sentiment expressed before, seemingly whenever someone releases a pet language (Arc, Factor) or rediscovers an older programming language (Smalltalk,…

N-Queens in a Tweet

Most people who like puzzles or study computer science have probably encountered the famous N-Queens problem. If you haven’t, before reading any further, try this online version of the most popular form, the 8-Queens problem. The 8-Queens problem is to find positions on a chess board for eight queen chess pieces so that none of them “threaten” the others. Since a queen in chess can move…

Python Debugging with Decorators

I’ve written a little python function which I have found to be very helpful for debugging. It takes a function, and returns a function which is identical to the original except that it prints a message to the console with useful information every time the function is called or returns. Here is the function: # Number of times to indent output # A list is used to force access by reference…

SimpleDiff in Python

A while ago I posted a PHP implementation of a diff algorithm I came up with. Since it was well received, and it’s a useful little algorithm to have, I created a Python version as well. There are a few performance improvements as well. The PHP version creates an array in memory proportional to the square of the size of the input, while the Python version’s array is directly proportional to the…

Tail Recursion in Python

After spending a lot of time in Scheme, it’s hard not to think in recursion from time to time. When I recently started to improve my Python skills, I missed having Scheme optimize my tail recursive calls. For example, consider the mutually recursive functions even and odd. You know a number, n, is even if it is 0, or if n – 1 is odd. Similarly, you know a number is not odd if it is 0, and that it…

Garden Path Sentences

I recently came across an interesting post on the Powerset Blog recently about garden path sentences. Garden path sentences are sentences that lead you down the wrong path through a string of words with multiple meanings. For example, The complex houses married and single students and their families In this case, most readers would probably think complex was an adjective that modified the plural…

A Simple Diff Algorithm in PHP

A diff algorithm in its most basic form takes two strings, and returns the changes needed to make the old string into the new one. They are useful in comparing different versions of a document or file, to see at a glance what the differences are between the two. Wikipedia, for example, uses diffs to compare the changes between two revisions of the same article. Solving the problem is not as simple…

webFractal: Web-based Fractal Explorer

Last weekend, I won a nice new Toshiba laptop in a local software competition. My entry was a web-based fractal explorer. I had a lot of fun making it, and it is fun to play with as well. I have decided to release it under an open-source license so that other people can play around with it (see the download link at the bottom of this post). Unfortunately, I do not have access to a powerful Tomcat…