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 / 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 / plugins.lua
Created October 26, 2020 11:54
using packer.nvim
-- check if packer is installed (~/local/share/nvim/site/pack)
local packer_exists = pcall(vim.cmd, [[packadd packer.nvim]])
if not packer_exists then
if vim.fn.input("Hent packer.nvim? (y for yada)") ~= "y" then
return
end
local directory = string.format(
'%s/site/pack/packer/opt/',
@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 / app_launcher_window_switcher.md
Last active January 1, 2024 07:27
fzf/skim app launcher + window switcher using kitty/alacritty

.

Here follows a simple example using sway. Scripts and locations can/should be modified for your needs and layout can be changed to whatever likings. export FZF / SKIM default envir vars can also change behavior in addition to local fzf/skim --flags during command or scripting will override defaults. Go nuts.

  • in sway/config
# Preferred application launcher
# fzf launcher
set $fzf_launcher kitty --config \"$HOME/.config/kitty/fzf-launcher.config\" --class fzf-launcher --detach
@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' }