Skip to content

Instantly share code, notes, and snippets.

View TheNeuralBit's full-sized avatar
🐢

Brian Hulette TheNeuralBit

🐢
View GitHub Profile
@TheNeuralBit
TheNeuralBit / break80.py
Created January 15, 2014 01:47
Simple script for taking a file with a bunch of long lines and breaking it into 80 character lines - I use it to fix the output of http://fuckyeahmarkdown.com
import sys
infile = open(sys.argv[1], 'r')
outfile = open(sys.argv[2], 'w')
for line in infile.read().split('\n'):
while len(line) > 80:
idx = line[:80].rfind(' ')
outfile.write('%s\n' % line[:idx])
line = line[idx + 1:]
@TheNeuralBit
TheNeuralBit / inotifyexec.sh
Created August 9, 2014 14:44
A simple script using inotify to execute a command whenever a file is modified
#! /bin/bash
while [ 1 ]; do
inotifywait ${2}
${1} ${2}
done
@TheNeuralBit
TheNeuralBit / index.html
Last active February 12, 2016 15:26
Animate a random Lissajous Curve
<html>
<body>
<svg></svg>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.14/d3.min.js"></script>
<script>
var lineData = d3.range(1000);
function get_rand() {
return Math.round(Math.random()*9 + 0.5);
}

Keybase proof

I hereby claim:

  • I am theneuralbit on github.
  • I am hulettbh (https://keybase.io/hulettbh) on keybase.
  • I have a public key whose fingerprint is 2BBC 7636 3D31 D1CC 5131 45C0 2F48 7FAD BB75 17BE

To claim this, I am signing this object:

@TheNeuralBit
TheNeuralBit / objects_are_dumb.js
Created April 20, 2016 18:12
Convenience function for iterating through keys and values of a JS Object
// obj.forEach(function(k, v) { ... });
Object.prototype.forEach = function forEach(callback) {
for (var key in this) {
if (this.hasOwnProperty(key)) {
callback(key, this[key]);
}
}
}
"""
===================
Label image regions
===================
This example shows how to segment an image with image labelling. The following
steps are applied:
1. Thresholding with automatic Otsu method
2. Close small holes with binary closing
@TheNeuralBit
TheNeuralBit / README.md
Last active November 27, 2022 06:04
Scrabble Arrow

Scrabble Data in an Arrow file

538's data on 45 years of Scrabble games turned into an Arrow file

Usage:

$ python scrabble.py https://media.githubusercontent.com/media/fivethirtyeight/data/master/scrabble-games/scrabble_games.csv scrabble.arrow
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
> apache-arrow@0.3.0 perf /home/hulettbh/working_dir/arrow/js
> node ./perf/index.js
Running apache-arrow performance tests...
Parse "tracks":
Table.from
x 6,199 ops/sec ±2.83% (81 runs sampled)
avg: 0.16ms