Skip to content

Instantly share code, notes, and snippets.

View davidbau's full-sized avatar

David Bau davidbau

View GitHub Profile
@davidbau
davidbau / npycat
Last active May 1, 2022 14:30
npycat: cat utility and swiss army knife for npy and npz files
#!/usr/bin/env python
"""
npycat: cat utility and swiss army knife for numpy and pytorch files.
"""
import numpy, argparse
args = None
def main():
@davidbau
davidbau / .block
Last active March 25, 2017 13:23
3D Scatter Plot Using three.js
license: mit
@davidbau
davidbau / googlesender.py
Last active February 25, 2023 03:25
Python 2 script for generating a JavaScript/jQuery function for submitting to a Google Form
# Google form submit-maker.
#
# Usage: python googlesender.py https://docs.google.com/forms/d/e/1.../viewform
#
# Point this python file at a live Google forms URL, and it will generate
# code for a Javascript function that submits to that form cross-domain.
#
# Notes:
# - The form should be created with "short answer text" questions.
# - The viewform URL to scrape is the link shared when the form is sent.
@davidbau
davidbau / index.js
Last active August 29, 2015 14:22
requirebin sketch
var Parser = require('parse5').Parser;
//Instantiate parser
var parser = new Parser(null, {locationInfo: true});
//Then feed it with an HTML document
var d = parser.parseFragment('<p>hello<p>hello')
var info = ['<pre>', 'fragment has ' + d.childNodes.length + ' top-level nodes'];
for (var j = 0; j < d.childNodes.length; ++j) {
@davidbau
davidbau / index.js
Created May 14, 2015 17:36
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var $ = require('jquery');
var seedrandom = require('seedrandom');
var rng = seedrandom.xor4096('hello.');
for (var j = 0; j < 20; ++j) {
$('body').append('<p>' + rng() + '</p>');
}
@davidbau
davidbau / index.js
Created May 14, 2015 14:42
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var seedrandom = require('seedrandom');
var rng = seedrandom.xor4096('hello.');
console.log(rng());