Skip to content

Instantly share code, notes, and snippets.

View tr00st's full-sized avatar
💼
considering options

James Cheese tr00st

💼
considering options
View GitHub Profile
@tr00st
tr00st / theme.js
Created March 11, 2020 10:18
Horrendous Material-UI theme generator
import { createMuiTheme } from "@material-ui/core";
/*
Generates a random theme for Material-UI. Usually horrible.
*/
const randomColor = () => {
return ["#",Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16),Math.floor((Math.random()*16)).toString(16)].join("");
}
@tr00st
tr00st / code.py
Last active February 3, 2021 00:20 — forked from sandyjmacdonald/code.py
4 channel control / 8 note MIDI controller example for Pimoroni RGB Keypad for Raspberry Pi Pico
# Based on @sandyjmacdonald's original gist:
# https://gist.github.com/sandyjmacdonald/b465377dc11a8c83a8c40d1c9b990a90
import time
import board
import busio
import usb_hid
from adafruit_bus_device.i2c_device import I2CDevice
import adafruit_dotstar
@tr00st
tr00st / hack.js
Created April 22, 2021 09:59
Silent sound generator hack for Safari audio permissions
// James Cheese 2021 - based on example at https://developer.mozilla.org/en-US/docs/Web/API/AudioBufferSourceNode
// Build an audio context of whatever type's available
let SupportedAudioContext = null;
if (window.AudioContext !== undefined) {
SupportedAudioContext = window.AudioContext;
} else if (window.webkitAudioContext !== undefined) {
SupportedAudioContext = window.webkitAudioContext;
}
const silentAudioContext = new SupportedAudioContext();