Skip to content

Instantly share code, notes, and snippets.

View diegodorado's full-sized avatar

Diego Dorado diegodorado

View GitHub Profile
@diegodorado
diegodorado / build-nodemcu.sh
Last active March 1, 2019 01:39
Building and Flashing NodeMCU firmware
# Building the firmware
# https://nodemcu.readthedocs.io/en/master/en/build/
#
# I used the Docker Image method
# https://hub.docker.com/r/marcelstoer/nodemcu-build/
# 1) download the firmware
git clone --recurse-submodules https://github.com/nodemcu/nodemcu-firmware.git
# 2) Configure modules and features
@diegodorado
diegodorado / flash_disk.sh
Last active April 22, 2019 17:47
dd, cat, etc
sudo dd if=input.img of=/dev/sdX status=progress
# Synchronize cached writes to persistent storage
sync
@diegodorado
diegodorado / startup.scd
Created July 12, 2019 23:57
Startup de superdirt que estoy usando ultimamente

( "SC_JACK_DEFAULT_INPUTS".setenv(""); "SC_JACK_DEFAULT_OUTPUTS".setenv("");

s.options.numBuffers = 1024 * 32; // increase this if you need to load more samples s.options.memSize = 8192 * 32; // increase this if you get "alloc failed" messages s.options.maxNodes = 1024 * 32; // increase this if you are getting drop outs and the message "too many nodes" s.options.numOutputBusChannels = 4; // set this to your hardware output channel size, if necessary s.options.numInputBusChannels = 8;

@diegodorado
diegodorado / brindis.hs
Last active August 29, 2019 16:48
Brindis - live coded song with tidalcycles
setcps 1
let pats =
[
("bs", s "[swbd swsn]/2" # gain 1.2 # orbit 3),
("bs2", s "[swbd [swsn!3 [swsn swsn*3]]/4]/2" # gain 1.2 # orbit 3),
("bs3", s "[swbd*4, ~ <swsn <swsn:3*3? swsn:4>>]/2" # gain 1.2 # orbit 3),
("bs4", s "[swbd <swsn <[swsn:3 swsn:3? swsn:3?] swsn:4>>]" # gain 1.2 # orbit 3),
("hh", off "<0.167 0.33>" (|*|gain 0.9) $ s "<hh*2 feel:1*<2 2 3>>" # gain 1.1 # hpf (range 1000 6000 $ slow 4 tri) # hpq (range 0.025 0.3 $ slow 4.3 tri) # lpf 3000),
rename -n 's/\.JPG$/\.jpg/' *
# -n for testing... doesnt actually rename
rename -v 's/\.JPG$/\.jpg/' *
# -v, to be verbose, so you see what and how it is renamed
#one liner rename ordered files
ls | cat -n | while read n f; do mv "$f" `printf "%02d.wav" $n`; done
let digits = "0123456789".split('')
function *permute(a, n = a.length) {
if (n <= 1) yield a.slice();
else for (let i = 0; i < n; i++) {
yield *permute(a, n - 1);
const j = n % 2 ? 0 : i;
[a[n-1], a[j]] = [a[j], a[n-1]];
}
}
include "%L"
<Multi_key> <n> : "ñ"
<Multi_key> <Multi_key> <k> <i> <s> <s> : "💋" U1F48B # KISS MARK
let ns pp = note (scale "spanish" $ pp)
pat = "[0 3 4]/12"
nseg ss pp = (round <$> (segment ss $ pp))
nss ss pp = ns (nseg ss pp)
pats =
[
("intro", nss 6 (range 0 "<12 8>" $ sine+0.2*rand) # midi 5),
("intro2", nss (2 * irand 4) (range 0 "<12 8>" $ sine+0.2*rand) # midi 5),
("intro3", nss (2 * irand 4) (range 0 "<12 8>" $ sine+0.2*rand) + stack[midi 5,midi 0 -note 12]),
("bridge", nss (choose([1,3,6,12])) (sine*12+rand*3) + stack[midi 5,midi 0 -note 12]),
# how to pair a fucking bluetooth keyboard
# first, make sure bluetooth service is on
# then, enter bluetoothctl
bluetoothctl
#just in case
power on
#filter keyboards
agent KeyboardOnly
@diegodorado
diegodorado / backup_and_restore_atmega_hex.sh
Created September 18, 2019 23:21
How to get a full flash backup (and restore) of an atmega328 chip, with usbasp programmer
# How to get a full flash backup (and restore) of an atmega328 chip, with usbasp programmer
# Backup
avrdude -p m328p -c usbasp -U flash:r:flash_backup_file.hex:i
#Restore
avrdude -p m328p -c usbasp -e -U flash:w:flash_backup_file.hex:i