Skip to content

Instantly share code, notes, and snippets.

View konsumer's full-sized avatar

David Konsumer konsumer

View GitHub Profile
@konsumer
konsumer / gcpadmidi.ino
Last active May 20, 2020 00:12
Gamecube controller (or DDR Mat) to USB MIDI. Install "Nintendo" and "MIDIUSB" in arduino library-manager. Use this on a programmable-USB arduino, like Leonardo.
#include "Nintendo.h"
#include "MIDIUSB.h"
// attach gamecube controller red wire on this digital pin
#define GC_PIN 7
// MIDI controls for each pad
int ctrls[6] = { 10, 11, 12, 13, 14, 15 };
CGamecubeController GamecubeController(GC_PIN);
@konsumer
konsumer / trackerlist.txt
Last active March 26, 2020 23:55
Add with `docker run --net=host -d -e HOSTPORT=localhost:9091 -e https://gist.githubusercontent.com/konsumer/c3ec5d6315c47fa69cd7c5a28098f3a1/raw/fdf43522cebc25603838ec2e085d178a80669df3/trackerlist.txt --name=transmission-tracker-add andrewmhub/transmission-tracker-add:latest`
udp://public.popcorn-tracker.org:6969/announce
http://104.28.1.30:8080/announce
http://104.28.16.69/announce
http://107.150.14.110:6969/announce
http://109.121.134.121:1337/announce
http://114.55.113.60:6969/announce
http://125.227.35.196:6969/announce
http://128.199.70.66:5944/announce
http://157.7.202.64:8080/announce
http://158.69.146.212:7777/announce
country=US
update_config=1
ctrl_interface=/var/run/wpa_supplicant
network={
scan_ssid=1
ssid="YOURROUTERSSID"
psk="YOURPASS"
}
beatstep.on('noteoff', async params => {
if (params.channel === 0x02) { // left controller buttons are all set to channel 2
// scale is sequence-bank
if (params.note === controls.SHIFT) {
console.log('sequence bank', hex(await beatstep.get(0x50, 0x03)))
}
// global midi channel is track
// TODO: this always returns 0x15
if (params.note === controls.CHAN) {
// npm i easymidi esm && node -r esm simple_midi_forwarder.js
import { Input, Output, getInputs, getOutputs } from 'easymidi'
// these are lists of available devices
const inputs = getInputs()
const outputs = getOutputs()
console.log({ inputs, outputs })
@konsumer
konsumer / index.html
Last active December 7, 2019 04:59
Electron Fiddle Gist
<!-- this is the important part: -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/darkly/bootstrap.min.css" media="(prefers-color-scheme: dark)">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootswatch/4.4.1/flatly/bootstrap.min.css" media="(prefers-color-scheme: no-preference), (prefers-color-scheme: light)">
<div class="row px-5">
<div class="col-md-6">
<h3 class="mt-5">Table with colors</h3>
<p><strong>Note: </strong> Use <code>table-*</code> classes.</p>
<table class="table table-hover">
<thead>
@konsumer
konsumer / .gitlab-ci.yml
Last active December 5, 2019 10:09
Perverse way to write Gitlab CI tasks
test:
image: mcr.microsoft.com/powershell
script:
- Write-Host "Multi-line"
- Write-Host "WORKS!"
@konsumer
konsumer / tinyuriobjdecode.js
Created November 21, 2019 01:13
take a url string (eg from document.location.search) like `cool=1&neat=true` and turn it into an object
const parseURIObj = str => str.split('&').reduce((a, c) => { const v = c.split('='); return { ...a, [decodeURI(v[0])]: decodeURI(v[1]) } }, {})
@konsumer
konsumer / cheerio_fetches.js
Last active November 9, 2019 11:02
A couple common usecases for getting jquery-like for scraping, in node, from GET request
const cheerio = require('cheerio')
const fetch = require('node-fetch')
// get Authorization header for basc auth
const basicAuth = (username, password) => 'Basic ' + Buffer.from(`${encodeURIComponent(username)}:${encodeURIComponent(password)}`).toString('base64')
// get jquery-like object
const f$ = (url, options = {}) => fetch(url, options)
.then(r => r.text())
.then(r => cheerio.load(r))
INGREDIENTS: INCESSANT SCREAMS, INDUSTRIAL BYPRODUCT (BLEARS), FUNK, ROCK, GUNFIRE, NUCLEAR EXPLOSIONS, EARTHQUAKES, FIRECRACKERS, VARIOUS HORNS (TRUMPET, FOG, TRUCK, TUBA, ANTLER), SONIC BOOMS, CHAINSAWS, BALLOONS POPPING, THUNDER, CHIMES, BELLS, BUZZERS, GONGS, LEAFBLOWERS, VOLCANIC ERUPTIONS, (CLASSIFIED). DRAG RACING, DRUMS, CITY TRAFFIC, BULLDOZER, OFFICE WORK, AMPLIFIERS, GIBBERISH, BANGS, CHOIRS, BOOMS, POPS, MAXWELL'S SILVER HAMMER, JET NOISES, GLITTER, BARBARIAN HORDES, THE SUN, RAINBOWS, FLAMBOYANCE, BRIGHT LIGHTS
WARNING: THIS PRODUCT IS NOT EDIBLE AND IS A KNOWN HAZARD! MAY CAUSE BLINDNESS. HEARING LOSS. SEIZURES. DEATH. EXTREME FITS OF GAYNESS. AND/OR BEING JAILED AFTER DEATH! ONCE USED RECTALLY. IT SHOULD NOT BE USED ORALLY! CONTENTS WILL EXPLODE IF SHAKEN! MAY EXCEED 200 dB! USE EAR PROTECTION AND A MECH SUIT WHEN EXPOSED TO CONTENTS! CHEW BEFORE SWALLOWING! WILL CAUSE COLOR SATURATION! LOUD AND SUDDEN MOVEMENTS MAY PROVOKE BLEARS TO ATTACK! $4 FINE FOR INSTANT DEATH!