# open nix shell with a bunch of programs def nsp [ ...programs: string ] { nix shell ...($programs | each {|it| $"nixpkgs#($it)" }) } # do a nix run of a nix package def nr [ program: string ] { nix run $"nixpkgs#($program)" } # do a recursive line count of a file extension def lcr [ file_extension: string ] { ls **/* | where name ends-with $".($file_extension)" | par-each {|file| open $file.name | lines --skip-empty | length } | math sum } # get parsed git log def glog [ amount: int ] { git log --pretty=%h»¦«%s»¦«%aN»¦«%aE»¦«%aD -n $amount | lines | split column "»¦«" commit subject name email date } # open typst IDE ish setup def typed [ name: string ] { const DEFAULT_TYPST_FILE = "#import \"@local/typst-configs:0.1.0\": generic, sf;\n#show: generic.with();" if not ($"($name).typ" | path exists) and not ($"($name).pdf" | path exists) { $DEFAULT_TYPST_FILE | save $"($name).typ" typst compile $"($name).typ" } else if ($"($name).pdf" | path exists) { typst compile $"($name).typ" } mprocs --names Editor,Viewer,Notify $"hx '($name).typ'" $"while true; do mupdf-x11 '($name).pdf' && break; done" $"while inotifywait -e modify '($name).pdf' ; do pkill -HUP mupdf; done" } # figure out when the next event is def nev [ unit = day ] { ( ( open Docs/dates.csv | update datetime {|it| $it.datetime | into datetime } | first ).datetime - (date now) ) | into duration | format duration $unit } # open chromium with bahn.expert opened and ready # TODO: intermediate stations def bx [from: string to: string] { let map = open ~/Docs/ril100map.json; let start = $map | get ($from | str upcase) | first; let dest = $map | get ($to | str upcase) | first; let url = $"https://bahn.expert/routing/($start)/($dest)/0/"; print $url; ^bash -c $"nohup chromium '($url)' &"; } def meow [ n = 1 ] { "m{rr,r,}{e,ee,{,e,aa}o}w{,w,ww}" | str expand | shuffle | first $n | str join ' ' } alias miau = meow; def bars [display_name?: string] { print $display_name; pkill eww if ($display_name | is-empty) { print "Opening bars on whatever eww figures is best" eww open-many topBar bottomBar } else { print $"Opening bars on ($display_name)" eww open --screen $display_name bottomBar eww open --screen $display_name topBar } } def "dp ccchh" [] { layaway "hdmi2 + edp/bottom,center" pkill eww bars "25BL56WY" } def "dp gay" [] { layaway "dp3 + edp1/bottom,center + dp5/right,top" # manual fix for lack of frequency in layaway, else monitor just turns off swaymsg "output DP-3 position 0 0 scale 1 transform normal resolution 1920x1080@60Hz" pkill eww bars "LEN G27c-10" }