Skip to content

Instantly share code, notes, and snippets.

@oshoham
oshoham / parse_blaseball_book.py
Last active August 9, 2020 18:43
Parse the Book of Blaseball from the site's minified JavaScript (Python 3 version)
import esprima
import requests
from bs4 import BeautifulSoup
from urllib.parse import urljoin
class BookOfBlaseballVisitor(esprima.NodeVisitor):
def find_book_function_node(self, node):
self._ancestors = []
self._book_function_node = None
@oshoham
oshoham / package.json
Last active August 5, 2020 01:35
Parse the Book of Blaseball from the site's minified JavaScript
{
"name": "blaseball-book-scraper",
"version": "1.0.0",
"description": "",
"main": "parse_blaseball_book.js",
"author": "",
"license": "ISC",
"dependencies": {
"acorn": "^7.4.0",
"acorn-walk": "^7.2.0",
@oshoham
oshoham / recorder-processor.js
Created June 24, 2019 22:51
ES5 AudioWorklet Processor
function RecorderProcessor(options) {
AudioWorkletProcessor.call(this);
var processorOptions = options.processorOptions || {};
this.numInputChannels = processorOptions.numInputChannels || 2;
this.recording = false;
this.clear();
this.port.onmessage = function(event) {
@oshoham
oshoham / midi-controller.ino
Created February 14, 2018 08:21
Tangible Interaction Workshop MIDI Controller
#include <Adafruit_LIS3DH.h>
#define USE_ACCELEROMETER true
const int sliderPins[7] = { A1, A2, A3, A6, A7, A8, A9 };
const int sliderThreshold = 20;
const int sliderNoiseThreshold = 30;
const int rotarySwitchPins[4] = { 5, 4, 3, 2 };
const int toggleSwitchPins[2] = { 7, 8 };
@oshoham
oshoham / lunar-lander.ino
Last active January 31, 2018 00:31
Lunar Lander Controller
/*
* Author: Oren Shoham
* Written on 1/30/2018 for Tom Igoe's Tangible Interaction Workshop class at NYU ITP.
*
* References:
* https://github.com/PaulStoffregen/Encoder/blob/master/examples/Basic/Basic.pde
* https://www.arduino.cc/en/Tutorial/KeyboardAndMouseControl
*/
#include <Encoder.h>
@oshoham
oshoham / laser_harp.ino
Last active June 15, 2022 13:14 — forked from boysonhudson/laser_harp.ino
Laser Harp Arduino Code
/*
* Laser Harp MIDI Controller
*
* Authors: Wei-Luen (Alan) Peng and Oren Shoham
*/
// hex to MIDI note reference: https://www.wavosaur.com/download/midi-note-hex.php
// scale: B5, A5, G5, F5, E5, D5, C5
const int notes[7] = {0x5F, 0x5D, 0x5B, 0x59, 0x58, 0x56, 0x54};
const int startingInputPin = 3;
@oshoham
oshoham / maskTest.pde
Last active October 4, 2017 00:51
maskTest
PGraphics img1;
PGraphics img2;
void setup() {
size(400, 400);
background(255);
img1 = createGraphics(400, 400);
img2 = createGraphics(400, 400);
<!DOCTYPE html>
<html>
<head>
<title>jQuery Fun House Solution Code</title>
</head>
<body>
<div class="section">
<h1>What is your name?
<input id="name">
</h1>
<!DOCTYPE html>
<html>
<head>
<title>jQuery Fun House Starter Code</title>
</head>
<body>
<div class="section">
<h1>What is your name?
<input id="name">
</h1>
@oshoham
oshoham / keybase.md
Created November 11, 2016 22:34
keybase.md

Keybase proof

I hereby claim:

  • I am oshoham on github.
  • I am osh (https://keybase.io/osh) on keybase.
  • I have a public key whose fingerprint is D032 13BF 189A A36B BA35 711E 0E66 D9A1 476C 69E6

To claim this, I am signing this object: