Reverse Engineering OKCupid

If you’ve ever seen bots on reddit like qkme_transcriber, you may wonder how they’re able to make posts without human intervention. Well wonder no longer! By examining how OKCupid handles HTTP requests, I’ll show you how to first deconstruct the undocumented APIs of other sites, then manipulate them with nary a mouse click.

Continue reading

Approximating Pi in Python, Part 1

Consider a square with an inscribed circle of radius r which itself has an inscribed square rotated 45 degrees. square inside circle inside squareIf we look at just the first quadrant, then the area of the outermost square Aouter is r2. The area of the circle Acircle is πr2/4, and the area of the inner triangle Atriangle is r2/2. Therefore, we can make two equations for π based on the ratios of these areas: π = 4Acircle/Aouter and π = 2Acircle/Atriangle. Notice how neither equation depends on the radius; so, if we can figure out an alternate way to calculate these areas, we can determine the value of π. Python to the rescue!
Continue reading