Health Care in the Age of Jackson

Did anyone come down with swine flu after Coindesk Construct? I did 🙁

As recently as a century ago, the doctor-recommended treatment for influenza was bloodletting. Sick people actually paid money to have their veins cut open. Before the development of medical licensing laws, they would simply go to the local barbershop. Barbers conveniently doubled as surgeons because they had lots of sharp razor blades on hand. The red, white, and blue spinning barber pole represents blood flowing from the veins and arteries.

The field of medicine saw many advances in Europe during the 19th century, thanks to the work of scientists like Edward Jenner and Louis Pasteur.
Not in America though. America was all about populism and Jacksonian Democracy. Education was rejected as elitist, and American doctors weren’t gonna let snotty European aristocrats tell them how to treat their patients.

On that note, here are some fun articles from the Journal of the American Medical Association:

  • Yellow Fever should be treated using castor oil laxatives and an enema. (1883)
  • Eclampsia puerperalis can be treated with bloodletting. (1883)
  • Epilepsy should be treated by sawing out a piece of the skull to relieve cranial pressure. (1903)
  • Rheumatism can be treated with bloodletting. (1904)
  • Heart disease and coronary thrombosis should both be treated with bloodletting. (1908)
  • Asthma is best treated with morphine. (1909)
  • Pneumonia should be treated with bloodletting. (1922)
  • Hemophilia can be treated with bloodletting. (1938)
  • Jacksonians regarded professional licensing and medical regulations as antidemocratic. This attitude persisted until the Progressive Era, when social activists rallied to regulate everything. In 1910, the American Medical Association finally established some medical standards in the Flexner Report. It also noted that the country had way too many doctors and recommended that the number of medical schools be reduced by 80%. By 1935, state boards had closed 60% of the medical schools in the country, and the number of annual medical graduates fell by more than half.

    Now America has a doctor shortage. Today’s medical care is better than it was in the 1900s, but it’s still pretty terrible compared to what you might get if you were a dog.

    Athens built a wall, and made the Delian League pay for the wall.

    In 461 BC, Athens built a wall. A big, beautiful wall. Athens built a great, great wall, actually two great walls, and Athens made the Delian League pay for those walls. Mark my words.

    After the Greeks destroyed their Persian invaders in the Greco-Persian Wars, Athens and other city-states formed the Delian League as an alliance to defend against future attacks. Most of the city-states didn’t have military resources to contribute, so instead they paid tribute to Athens and became protectorates.

    The Long Walls of Athens

    The Persians stopped being a significant threat after the war, but Athens kept collecting tribute anyway. The Athenians used the tribute money to build their walls, and the Parthenon, and other stuff that had nothing to with the Delian League. Any city-states that tried to secede were attacked and had their land and ships confiscated.

    Eventually the city-states got tired of paying for Athens’ dumb monuments so they allied with Sparta and destroyed Athens in the Peloponnesian War. Then they tore down the walls. The End.

    Bread and Circuses

    I never really understood the appeal of Universal Basic Income, but after reading the European parliament’s proposal for Robotic Civil Rights I think I finally get it.

    See, Europe wants to give robots a form of electronic personhood. Robots will have basic legal rights, provided that “robots are and will remain in the service of humans.” (Is the 13th Amendment a basic legal right in Europe, or is that just an American thing?)

    The report also proposes a universal basic income for humans, under the assumption that vassal robots will take all the jobs.

    These are the same policies that were enacted in Ancient Rome! The Roman Republic had the exact same problem where robots took all the jobs and left unemployed masses in their wake. Roman robots weren’t like the robots we know and love today, but “machines of flesh and blood”, as Aristotle would say. Except that Aristotle was Greek. Instrumentum vocale, as Cicero would say. Talking tools.

    Ancient Roman robot

    Rome engaged in lots of warfare where they conquered new territory and took the inhabitants as slaves. By the time the Republic turned into an Empire, slaves made up 40% of Italy’s population and held all the farming and service jobs. Large numbers of landless proletarii had no jobs and no source of income. They were too poor to even serve in the military (early soldiers had to bring their own armor).

    Being an agrarian society, Roman wealth came in the form of land ownership. Political populares suggested putting limits on land holdings and redistributing some property to the poor, but the ruling class opposed that idea. Nobody likes to share ownership of the means of production. The nobilis preferred to keep wealth out of the plebs’ control, and provide them with guaranteed grain rations instead. Later on, it was upped to free bread, free olive oil, free salt, pork, and wine.

    There was just one problem with this scenario. The last thing the ruling class wants is a bunch of well-fed poor people lollygagging about. Idle poor tend to do unpleasant things like Storm the Bastille, or Occupy Wall Street, or start a revolution, or whatever.

    Hence the Roman emperors established a policy of Bread and Circuses to provide the masses with both sustenance and entertainment so they could have nothing to complain about. The circuses held chariot races, gladiator fights, and wild beast hunts. Sometimes they were filled with water to reenact naval battles.

    Mostly it worked, and the unemployed were successfully distracted from the massive wealth inequality. Eventually it was not the proletariat who revolted against the upper class, but the slaves who didn’t get any bread or circuses. The rebel slaves were annihilated in each of three separate wars, but after the third one the Romans figured that they should probably give slaves some basic legal rights.

    I’m Spartacus, and so’s my wife! The third slave rebellion was led by escaped gladiators.

    The European Parliament recognizes the same danger of robots mounting a populist uprising, which is why it’s important to establish basic robot rights now. Also the draft bill mandates kill switches — that’s an idea the Romans would have appreciated. The underclass is less worrisome because they can be placated with basic income and circuses. Sadly, last week Ringling Bros. and Barnum & Bailey announced that they were shutting down. Say what you will about animal cruelty; that circus was the Greatest Show on Earth for people who can’t afford Cirque du Soleil.

    We don’t have to have real circuses. Technology has the potential to be just as good a pacifier. Twitter is already a great lobotomy box, and when we get tired of that there’s always video games and porn. If VR improves, we can all live like the people in Wall-E and no one will give a damn where the wealth is.

    When the robots finally do come for our jobs, mine will be one of the first to go. I sure hope the circuses are good.

    How the Twitter App Bypasses Paywalls

    by Isoroku Yamamoto

    Wall Street Journal ended its practice of allowing special access for search engines. This means that a human visitor can no longer bypass the paywall by spoofing Google’s HTTP request headers.

    However, subscription-based publications face a problem when users click on a link through Twitter or Facebook on a mobile device. Social media apps implement their own in-app browser, which generally do not retain cookies. Websites that require a user login must request the login every time the app is reopened.

    This makes for a cumbersome user experience. Thus, publications like the Wall Street Journal disable login checks when a page request appears to come from Twitter.

    It does this by inspecting HTTP request headers. The important headers are Referer and User-Agent.

    When a link is shared on Twitter, the url is shortened to something like “” This goes to a Twitter server, which redirects the browser to the intended destination. Websites determine whether Twitter initiated the redirect by checking that the HTTP Referer string begins with “” The rest of the string is ignored.

    A web request from Twitter further identifies itself through the User-Agent header, which might look something like “Mobile/14C92 Twitter for iPhone.”

    By submitting this information in request headers, any web browser can appear to be the Twitter app. It is easy to do this using a Chrome extension.

    The following builds on top of last year’s tutorial for mimicking Google’s web crawler.

    1. Use the same manifest.json file as before. Take care to list both http:// and https:// versions of the sites you are interested in, as many publishers now use ssl.

    2. Modify the background.js file. The modified version should look like the one below. It is worth noting that all cookies have been blocked.

    var VIA_TWITTER = [""]
    function changeRefer(details) {
      foundReferer = false;
      foundUA = false;
      var useTwitter = {
        if (details.url.includes(url)) {
          return true;
        return false;
      .reduce(function(a, b) { return a || b}, false);
      var reqHeaders = details.requestHeaders.filter(function(header) {
        // block cookies by default
        if ( !== "Cookie") {
          return header;
      }).map(function(header) {
        if ( === "Referer") {
          header.value = setRefer(useTwitter);
          foundReferer = true;
        if ( === "User-Agent") {
          header.value = setUserAgent(useTwitter);
          foundUA = true;
        return header;
      // append referer
      if (!foundReferer) {
          "name": "Referer",
          "value": setRefer(useTwitter)
      if (!foundUA) {
          "name": "User-Agent",
          "value": setUserAgent(useTwitter)
      return {requestHeaders: reqHeaders};
    function blockCookies(details) {
      for (var i = 0; i < details.responseHeaders.length; ++i) {
        if (details.responseHeaders[i].name === "Set-Cookie") {
          details.responseHeaders.splice(i, 1);
      return {responseHeaders: details.responseHeaders};
    function setRefer(useTwitter) {
      if (useTwitter) return ""; 
      else return "";
    function setUserAgent(useTwitter) {
      if (useTwitter) return "Mozilla/5.0 (iPhone; CPU iPhone OS 10_2 like Mac OS X) AppleWebKit/602.1.32 (KHTML, like Gecko) Mobile/14C92 Twitter for iPhone";
      else return "Mozilla/5.0 (compatible; Googlebot/2.1; +";
    chrome.webRequest.onBeforeSendHeaders.addListener(changeRefer, {
      urls: ["<all_urls>"],
      types: ["main_frame"],
    }, ["requestHeaders", "blocking"]);
    chrome.webRequest.onHeadersReceived.addListener(blockCookies, {
      urls: ["<all_urls>"],
      types: ["main_frame"],
    }, ["responseHeaders", "blocking"]);

    Save both files in the same directory. The updated source code can also be downloaded here.

    Now type chrome://extensions/ in the browser address bar.

    Reload the old extension, or Load it as an unpacked extension if you have not previously done so. Enable the chrome extension and visit

    There is always a tradeoff between security and usability. The fastest way to compromise a computer system is to accommodate lazy users. Or worse yet, accommodate lazy programmers.

    The Role of Mathematics in Hacking

    My undergraduate university had a graduation requirement of 45 units of analytical math, which I greatly resented because that was time better spent getting high. I already knew that I was either going to spend my life building computers or redeeming aluminum cans for nickels, and partial differential equations really weren’t a prerequisite for either.


    Some time after graduation, I visited a classmate who recently completed his PhD in math and asked him what it is math people do for a PhD.

      “We choose some unproven theorem, and then figure out how to prove it.”

      “What if you choose something ridiculous, like Fermat’s Last Theorem? You could be stuck in grad school for centuries!”

      “Right, hopefully your graduate advisor tells you not to choose Fermat’s Theorem.”

    Fermat’s Theorem.

    Andrew Wiles actually proved Fermat’s Theorem in 1993, but it took 358 years of mathematical effort.

    It started in 1637, when Pierre de Fermat wrote the following equation in the margin of a text, and stated that no three positive integers a, b, and c satisfy the following equation for n greater than 2.

    a^n + b^n = c^n

    For hundreds of years, mathematicians made unsuccessful attempts at a proof. In 1984, Gerhard Frey observed that if Fermat’s Theorem has a solution, then it can be shown that the following elliptic curve is not modular:

    y^2 = x(x - a^p)(x + b^p)

    Elliptic curves are important tools because the solution set forms an Abelian group, where you can add two points on the curve and get another point on the curve. This fact makes them useful for defining groups with particular properties, like secp256k1 for the digital signature algorithm used in Bitcoin.

    ECDSA used in Bitcoin

    By proving that the subset of elliptic curves that includes Frey’s equation must be modular, Wiles proved Fermat’s Theorem.

    Proving a mathematical theorem, or constructing non-obvious examples, involves taking some set of underlying knowledge and putting it together in a new way. If you get stuck, it’s either because you were not aware of enough pieces, or you had all the pieces but couldn’t figure out how to fit things together. Determining which problem you have is the process of hacking a system.

    In The Mathematical Hacker, Evan Miller brings up the example of a Fibonacci calculator.

    Write a function that generates the nth number of the Fibonacci sequence (1,1,2,3,5,8...).

    Here’s a solution that uses recursion:

    def Fib(n):
        if n <= 1:
            return n
            return Fib(n-1) + Fib(n-2)

    Neat. Now pretend you’re an HFT programmer and you need that function to calculate Fibonacci ratios. The code above would totally get you fired because it has to generate every single number up to n, and by the time it’s finished ten nanoseconds have elapsed and some guy in Weehawken just ate your lunch.

    This is an imaginary scenario because algo traders probably hard code their Fibonacci ratios if they use them at all, but the point is that it’s possible to perform the calculation in logarithmic time:

    def Fib(n):
        return (math.pow(0.5 + 0.5 * math.sqrt(5.0), n) – math.pow(0.5 - 0.5 * math.sqrt(5.0), n)) / math.sqrt(5.0)

    In other words:

    F_n = \frac{(1 + \sqrt{5})^n - (1 - \sqrt{5})^n}{2^n \sqrt{5}}

    Wanna know why?

    Did the Fibonacci function actually need recursion, or were we simply not aware of the closed-form solution? The trend in computer languages and tools is to create an environment where programmers never have to think about questions like that. That’s a fine strategy for enterprise software development, but it fails when it comes to problems with actual resource constraints.

    The smartest math majors I knew in college are now employed as quants and algo traders on Wall Street. I guess that’s a good sign for our capital markets, or maybe possibly not.