# 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)' &"; }