Skip to content

Instantly share code, notes, and snippets.

@alexhornbake
alexhornbake / polars_pandas_test.py
Created December 7, 2023 08:54
Cost of converting to/from polars to join a dataframe
# mprof run polars_test.py
# mprof: Sampling memory every 0.1s
# running new process
# running as a Python program...
# 1701938865.155861 - starting
# 1701938930.560897 - time to generate dataframes: 65.40504503250122
# 1701938930.5609741 - starting pandas join
# Filename: polars_test.py
# Line # Mem usage Increment Occurrences Line Contents
@alexhornbake
alexhornbake / headers-timeout-keep-alive.js
Created August 20, 2020 12:44
reproduce nodejs keep-alive bug
// Client that can reproduce https://github.com/nodejs/node/issues/27363
// modified from https://gist.github.com/shuhei/4098a648a969deb38aad2164bc387148
const http = require("http");
const net = require("net");
function startClient(port) {
const socket = net.createConnection({ port });
let responseCount = 0;
socket.on("data", (chunk) => {
@alexhornbake
alexhornbake / golang-2-error-proposal-refuse.md
Last active August 24, 2023 17:37
Golang 2 proposal. Refuse. A conditional return keyword.

refuse - a mini-proposal for conditional returns. This is an alternative proposal for try, check, check/handle.

So we want to simplify things like:

1: err, thing := newThing(name)
2: if err != nil {
3: 	return nil, err
4: }
@alexhornbake
alexhornbake / index.html
Last active September 25, 2017 18:05
Block Pusher
<!DOCTYPE html>
<html>
<head>
<title>boxpusher</title>
<style>
body {
margin: 0;
height: 100%;
overflow: hidden
}
@alexhornbake
alexhornbake / index.html
Last active September 24, 2017 18:58
push pop mechanic
<!DOCTYPE html>
<html>
<head>
<title>pusher</title>
<style>
.tile {
width: 4%;
padding-bottom: 4%;
display: inline-block;
margin: 5px;

Keybase proof

I hereby claim:

  • I am alexhornbake on github.
  • I am alexhornbake (https://keybase.io/alexhornbake) on keybase.
  • I have a public key whose fingerprint is D462 175C 4B29 C55E 86E9 001F 49A4 3C6B BF6D 240D

To claim this, I am signing this object:

@alexhornbake
alexhornbake / gist:4277348f8b3ab5f7a917
Created April 21, 2014 19:54
fetch m3u8... follow redirect and fetch segments from akamai
m3u8Url=$1
masterM3u8=$(curl -L "$m3u8Url" | grep -m1 http)
token=$(echo \""$m3u8Url" | grep -o hdnea.*)
echo $token
echo "fetching... ""$masterM3u8""&""$token"
segments=$(curl -c cookies.txt "$masterM3u8""&""$token" | grep http)
i=0
while read -r line; do
@alexhornbake
alexhornbake / index.html
Last active February 27, 2024 08:56
Generate Path for Curly Bracket
<html>
<title>Curly Bracket</title>
<script src="http://d3js.org/d3.v3.min.js" charset="utf-8"></script>
<style>
.curlyBrace {
stroke: #000000;
stroke-width: 10px;
@alexhornbake
alexhornbake / fb_parse_location.py
Last active December 19, 2015 17:39
Mapping Facebook Friend Locations and Connections
# Script to strip longitude and latitude data from friend list and coorelate with mutual friends
# Intentionally remove any identifying info before writing to file.
# Author: achornbake , 7/13/2013
# Facebook Data exported using "Give me my Data App" by Ownen Mundy http://owenmundy.com/site/give-me-my-data
import sys
import json
from pprint import pprint
f_data=open('friend_data.json')
@alexhornbake
alexhornbake / chapter7.js
Last active December 19, 2015 15:59
Shortest Route Hiva 'Oa Map
// Visualization of the Hiva 'Oa map in chapter 7 of
// 'Eloquent Javascript' by Marijn Haverbeke
// see original example at http://eloquentjavascript.net/
// for more detail on everything below noted as "Original example from text" in chapter7.js
//BEGIN ORIGINAL EXAMPLE FROM TEXT
var roads = {};
function makeRoad(from, to, length)
{