Skip to content

Instantly share code, notes, and snippets.

@OverlappingElvis
OverlappingElvis / wingnuts_video_mixer.py
Last active January 30, 2023 19:12
generate random video montages from internet archive identifiers
from math import floor
from sys import float_info, stdout
from internetarchive import download
from moviepy.editor import VideoFileClip, concatenate_videoclips, vfx
from moviepy.video.tools.cuts import find_video_period
from random import choice, sample
import time
from argparse import ArgumentParser
import os
import pytesseract
@OverlappingElvis
OverlappingElvis / index.js
Last active December 23, 2020 22:51
midi-to-blobs
// This script is deprecated, use https://github.com/OverlappingElvis/blob-opera-midi instead!
const fs = require(`fs`)
const _ = require(`lodash`)
const { Player } = require(`midi-player-js`)
const blessed = require(`blessed`)
const contrib = require(`blessed-contrib`)
const Alea = require(`alea`)
const VOWELS = _.range(4)
@OverlappingElvis
OverlappingElvis / festive.json
Created December 15, 2020 19:55
blob opera format
{
"theme":"Festive",
"parts":[
{
"notes":[
{
"timeSeconds":0,
"midiPitch":69,
"librettoChunk":{
"vowel":{
@OverlappingElvis
OverlappingElvis / hanukkah.js
Created December 12, 2020 00:21
menorah math
const allCandles = (new Array(256)).fill(256).map((val, index) => (index).toString(2).padStart(8, 0))
const nonsymmetricCandles = allCandles.reduce((memo, candles) => {
if (memo.includes([...candles].reverse().join(''))) {
return memo
}
memo.push(candles)
const chevrotain = require(`chevrotain`)
const { Lexer, Parser } = chevrotain
const allTokens = []
const createToken = (options) => {
const token = chevrotain.createToken(options)
allTokens.push(token)
@OverlappingElvis
OverlappingElvis / muggin.js
Created September 17, 2017 00:32
I'se A Muggin' (Part 2)
/*
I really wanted my band to do this Mezz Mezzrow song (https://www.youtube.com/watch?v=UEQ6v0pWUcg) but nobody wanted to learn the sequence. Now they have no excuse.
*/
var _ = require('underscore');
// Folks, we're gonna do some muggin' with numbers. "Well explain it to me, man!"
var lessThanSeventy = function(number) {
if (number === 7) {
return 'uh';
@OverlappingElvis
OverlappingElvis / bathroom.js
Last active August 17, 2017 20:31
Is This Bathroom Occupied?
// underscore.js helpers
var _ = require('underscore');
// State aliases
var OCCUPIED = true;
var VACANT = false;
// Sample a current state
var knock = function(state) {
var correct = state.sign === state.bathroom;