Skip to content

Instantly share code, notes, and snippets.

@mookerji
mookerji / build.sh
Created July 11, 2017 23:01
SBP-JSON timing tests, to test on an assumed hardware test log (in JSON).
# Assumes you have in third_party libsbp, rapidjson, and b64.c (built)
g++ -O3 -g -v -stdlib=libstdc++\
-Wall -Werror -Wno-c++11-extensions \
-Ithird_party/rapidjson/include \
-Ithird_party/libsbp/c/include \
-Ithird_party/b64.c/ \
third_party/b64.c/b64 $1;
time ./a.out
@mookerji
mookerji / Script output
Last active May 7, 2018 17:08
Pandas (v0.22) fails to roundtrip category types.
# python3 bug_categories.py
a b c
0 foo foo foo
1 bar bar bar
2 baz baz baz
3 foo foo foo
4 bar bar bar
5 baz baz baz
6 foo foo foo
@mookerji
mookerji / eni-analysis.py
Last active February 14, 2020 07:28
ECS service discovery hell
import pandas as pd
def read_eni_cap(filename):
return pd.read_csv(filename,header=None, sep='\t', names=['name', 'old', 'new']).set_index('name')
eni_cap = read_eni_cap('instance-types.txt')
def read_enis(filename):
enis = pd.read_json(filename, orient='records')
return enis.join(enis.Attachment.apply(pd.Series), rsuffix='.attach').set_index('NetworkInterfaceId')
@mookerji
mookerji / loop.py
Created May 6, 2021 03:44
Endless eigenvalues
from numpy import linalg as alg
import numpy as np
arr = np.array([
0.0, 1., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 1., 0., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 1., 0., 0., 0., 0., 0., 0., 0.,
0., 0., 0., 0., 1., 0., 0., 0., 0., 0., 0.,