Skip to content

Instantly share code, notes, and snippets.

@salkin-mada
salkin-mada / LSEU.scd
Last active March 20, 2020 11:44
Imitating Laurie Spiegels Expanding Universe with Pspawn
s.boot
(
SynthDef(\default, {|out, gate=1, freq=440, sustain, pan=0.0, amp=0.1, res=0.1|
var sum;
var osc = LFSaw.ar(freq);
var env = EnvGen.kr(Env.perc(0.01, sustain, amp), gate, doneAction: Done.freeSelf);
var fenv = EnvGen.kr(Env.perc(0.01, sustain/4, amp), gate);
var sig = DFM1.ar(osc, freq*freq.expexp(20,16e3,1.0,0.4)+fenv.linlin(1.0,0.0,2234,0), res);
sum = Pan2.ar(sig, pan, env);
Out.ar(out, sum);
@salkin-mada
salkin-mada / browse.alias
Last active April 7, 2020 20:40
fzf multi selection browser pacman handling
alias browse="pacman -Sl | fzf --preview 'pacman -Si {2}' -e -m --reverse --margin 5,8% \
--pointer='O' --prompt='>>>' --marker='<>'\
--preview-window=right:60% \
--color='bg:#211a1d,bg+:#211a1d,info:#8b81ff,border:#8b81ff,spinner:#B8C2B8' \
--color='hl:#a50000,fg:#a50000,fg+:#ed6331' \
--color='pointer:#f8f0fb,prompt:#8b81ff,hl+:#8b81ff,marker:#f8f0fb' \
--color='preview-bg:#211a1d,preview-fg:#ed6331' \
| awk '{print \$2}' | xargs -ro sudo pacman -S"
@salkin-mada
salkin-mada / ûr″gə-nŏm′ĭks.scd
Created May 12, 2020 21:24
spwan ûr″gə-nŏm′ĭks
( // Spwan ûr″gə-nŏm′ĭks
fork{
s.volume_(-6);
Convenience.crawl(Platform.recordingsDir);
~ergo_bus = Bus.audio(s,2);
SynthDef('Zzzz', {
|
bufnum, out = 0, loop = 0, rate = 1, pan = 0, spread = 0.5, width = 2, amp = 0.5,
attack = 0.01, sustain = 0.5, release = 1.0, pos = 0,
gate = 1, cutoff = 22e3, res = 0.01, fgain = 1.0, ftype = 0, bass = 0.0
@salkin-mada
salkin-mada / skimcode.sh
Last active November 21, 2020 13:41
skim file content and edit with nvim
function skimcode() {
local cmd='rg -S -n --color=always "{}"'
local pcmd='export LINE_NR=$(echo {} | awk -F: '"'"'{print $2}'"'"') && echo {} | sed "s/:.*//" | xargs -d "\n" bat -f -H $LINE_NR'
sk --ansi -i -c $cmd --preview $pcmd \
--bind 'ctrl-e:execute[export LINE_NR=$(echo {} | awk -F: '"'"'{print $2}'"'"') && nvim +$LINE_NR $(echo {} | sed "s/:.*//")]' \
--bind 'enter:execute(echo {} | sed "s/:.*//")+abort'
}
alias skc='skimcode'
@salkin-mada
salkin-mada / ssh-ify_repo.sh
Last active November 26, 2020 23:04
ssh-ify https clones
#!/usr/bin/zsh
server='github.com'
username='so-schön-ein-Benutzername'
repo_name=$(basename `git rev-parse --show-toplevel`)
old_origin=$(git remote -v | head -n 1 | awk '{print $2}')
echo "switching to ssh on repo $repo_name"
echo "old origin -> $old_origin"
echo "using -> @$server:$username/$repo_name.git"
@salkin-mada
salkin-mada / wif.sh
Last active December 1, 2020 03:27
skim iwctl func
function wif() {
local device=$(iwctl device list | awk '{print $1}' | rg w)
echo "using device: $device"
local cmd="iwctl station $device get-networks"
local pcmd="iwctl station $device show"
echo "scanning for networks"
iwctl station $device scan && iwctl station $device connect \
$(sk --ansi -c $cmd --preview $pcmd \
--bind 'enter:execute(echo {} | awk '"'"'{print $1}'"'"')+abort' \
--bind 'esc:execute(echo "user_closed_wif")+abort' \
@salkin-mada
salkin-mada / gbs.sh
Last active February 28, 2021 14:05
fuzzy git branch switcher
function gbs() { sk --ansi -c 'git branch' --preview 'git branch --all' --bind 'enter:execute[git switch $(echo {} | sed "s/ //g" | sed "s/*//g")]+abort' }
@salkin-mada
salkin-mada / fetch_computer_music_journals.sh
Created March 4, 2021 10:11
download all volumes of the computer music journal
#!/bin/bash
base_dir=computer_music_journals
download_count=0
mkdir -p $base_dir && cd $base_dir
for volume in {23..43}; do
mkdir -p "volume_$volume" && cd "volume_$volume"
for issue in {1..4}; do
if [[ $volume -eq 43 ]]
then
@salkin-mada
salkin-mada / TEENSY3_USB_DESCRIPTIONS.md
Last active May 11, 2021 00:34
You want Keyboard+Midi or Keyboard+Midi+Serial USB mode in platformio?
  • add these lines
    "USB_KEYBOARD_MIDI",
    "USB_KEYBOARD_MIDI_SERIAL",

to the BUILTIN_USB_FLAGS list in /home/$USER/.platformio/platforms/teensy/builder/frameworks/arduino.py

  • and add the following two elifs to /home/$USER/.platformio/packages/framework-arduinoteensy/cores/teensy3/usb_desc.h
#elif defined(USB_KEYBOARD_MIDI)