Skip to content

Instantly share code, notes, and snippets.

View jamesb93's full-sized avatar

James Bradbury jamesb93

View GitHub Profile
@jamesb93
jamesb93 / multislider_example.js
Last active January 31, 2024 14:14
JSUI with Dynamic Colors
autowatch = 1
mgraphics.init()
mgraphics.relative_coords = 0
mgraphics.autofill = 0
// we want to draw this many bars
var bars = []
for (var i=0; i < 8; i++) {
bars.push(Math.random())
}
from concurrent.futures import ThreadPoolExecutor
def do_work(work_list):
with ThreadPoolExecutor() as pool:
def work(inp):
return f'{inp}----COMPLETE'
futures = [pool.submit(work, work_item) for work_item in work_list]
for future in futures:
print( future.result() )
local math = require('hs.math')
local hyper = {"cmd"}
local function getWindows()
local win = hs.window.focusedWindow()
local screen = win:screen()
return win, screen
end
local function getFrames(win, screen)
import json
from pathlib import Path
help_files = [Path(x) for x in Path("help").glob("*.maxhelp")]
def ezdac_search(patch, patch_name):
if patch.get("maxclass") == "ezdac~" and not patch.get("local"):
print(patch_name, patch)
for k, v in patch.items():
if isinstance(v, dict):
import sys
import json
from pathlib import Path
help_file_input = Path(sys.argv[1])
s = ''
with open(help_file_input, 'r') as f:
s = f.read()
s = s.replace('"default_fontsize" : 12.0', '"default_fontsize" : 13.0')
@jamesb93
jamesb93 / phonos_mixer.jsfx
Created May 14, 2022 21:39
Quick mixer for PHONOS
desc: Mapping for PHONOS system
author: James Bradbury
slider1:0<-60,0,0.1>1+2
slider2:0<-60,0,0.1>3+4
slider3:0<-60,0,0.1>5+6
slider4:0<-60,0,0.1>7+8
slider5:0<-60,0,0.1>9
slider6:0<-60,0,0.1>10+11
slider7:0<-60,0,0.1>12+13
@jamesb93
jamesb93 / colour_generator.py
Created November 4, 2021 11:09
Generate random colour palettes that arent black or white
from colour import Color
import random
massive_fucking_string = ''
for x in range(200):
hue = random.uniform(0, 1)
saturation = random.uniform(0.5, 1.0)
value = random.uniform(0.3, 0.7)
c = Color(hsl=(hue, saturation, value))
massive_fucking_string += (str(c)[1:])
import numpy as np
NUM_CHUNKS = 4 # or this could be a ratio of original data
raw_audio = np.array([1, 2, 3, 4, 5, 6, 7, 8])
chunks = np.split(raw_audio, NUM_CHUNKS)
downsampled = [max(chunk) for chunk in chunks]
print(downsampled)