Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jbcrail on github.
  • I am jbcrail (https://keybase.io/jbcrail) on keybase.
  • I have a public key whose fingerprint is 87A5 63FE 6852 8A5F 7C2F D584 7973 F166 B1B4 E12D

To claim this, I am signing this object:

@jbcrail
jbcrail / find_duplicate_files.py
Last active February 22, 2018 23:54
Group duplicate files recursively inside a directory
import hashlib
import os
import sys
from os.path import join, getsize
def sha1(path):
m = hashlib.sha1()
with open(path, "r") as f:
@jbcrail
jbcrail / foo.py
Last active November 14, 2017 21:51
Test case for runpy
from __future__ import print_function
class App(object):
def __init__(self, a='', b=0, c=False):
print(" ", a, b, c)
class Foo(App):
def __init__(self):
super(Foo, self).__init__(a='bar', b=80, c=True)
@jbcrail
jbcrail / graph_layout.ipynb
Last active July 13, 2017 03:21
Datashader (Graph Layout)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import dask
import dask.dataframe as dd
import numpy as np
import numba
import time
@numba.njit
def calc_hist(X, Y, xrange, yrange, out, w, h):
x0, x1 = xrange
@jbcrail
jbcrail / bayesdb_parallelization_demo.ipynb
Created February 5, 2017 21:51
BayesDB Parallelization Demo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jbcrail
jbcrail / wafer-yield.py
Last active December 30, 2015 18:20
Yield Analysis for Silicon Wafer
import numpy as np
import pandas as pd
from collections import OrderedDict
from bokeh.models import ColumnDataSource, GridPlot, HoverTool
from bokeh.palettes import RdYlGn9
from bokeh.plotting import Figure, hplot, vplot, output_file, show
def generate_dataset(name, size):
"""
@jbcrail
jbcrail / bench_initialize.c
Last active August 29, 2015 14:10
Benchmark for initializing allocated memory
// Linux/OS X: gcc -g -std=gnu99 -Wall -Werror -o bench_initialize bench_initialize.c -lrt
//
// Generate test data using `dd if=/dev/urandom bs=$N count=1 >output` for $N bytes
#include <assert.h>
#include <fcntl.h>
#include <inttypes.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@jbcrail
jbcrail / gdsii.lua
Last active August 21, 2020 11:45
Simple GDSII parser
-- A basic GDSII reader that reads from standard input and writes serialized
-- text to standard output
local gdsii = {}
gdsii.types = {
[0] = "HEADER",
[1] = "BGNLIB",
[2] = "LIBNAME",
[3] = "UNITS",
@jbcrail
jbcrail / README.md
Last active August 29, 2015 14:02
Louisville crimes by day/hour

Forked from tjdecke’s block #5558084.

Example data shows Louisville crimes between 2012 and 2014.