cleanup nushell config

This commit is contained in:
Tao Tien 2024-05-16 01:56:17 -07:00
parent dbd1eeb6ae
commit 8f681ffbac

View file

@ -1,30 +1,31 @@
source ~/.cache/starship/init.nu task
source ~/.zoxide.nu
alias b = btm
alias cringe = sudo bootctl set-oneshot auto-windows
alias fetch = fastfetch
alias ff = firefox
alias jd = jj diff
alias js = jj status
alias pu = pueue
alias t = task
alias zl = zellij
def c [path: path = "~"] {
cd $path
l
}
def l [ def l [
path? path: path = "."
flags?
] { ] {
if $path != null { ls $path
ls $path | sort-by type name -i
} else {
ls
} | sort-by type name -i
} }
def tse [exit_node?] {
if $exit_node != null {
tailscale set --exit-node $exit_node
} else {
tailscale set --exit-node=""
}
}
def tsr [] {
tailscale status --json | from json | get Peer | transpose nodekey node | get node | filter {$in.Location?.Country == USA} | get TailscaleIPs | each {get 0} | select (random int 0..($in | length)) | tse $in.0
tailscale status
firefox https://mullvad.net/en/check
}
def ns [package] {
nix shell $"nixpkgs#($package)"
}
def rebuild [subcommand] { def rebuild [subcommand] {
sudo nice -n19 nixos-rebuild $subcommand --flake /home/tao/projects/NOflake/ --impure --verbose sudo nice -n19 nixos-rebuild $subcommand --flake /home/tao/projects/NOflake/ --impure --verbose
hx --grammar fetch; hx --grammar build hx --grammar fetch; hx --grammar build
@ -41,26 +42,55 @@ def bump [] {
} }
alias rb = rebuild boot alias rb = rebuild boot
alias rs = rebuild switch alias rs = rebuild switch
def ns [package] {
nix shell $"nixpkgs#($package)"
}
alias ard = arduino-cli
alias arduino-cli = boxxy arduino-cli
alias b = btm;
alias cringe = sudo bootctl set-oneshot auto-windows
alias fetch = fastfetch
alias ff = firefox
alias gc = nh clean all alias gc = nh clean all
alias jd = jj diff
alias js = jj status
alias pu = pueue def tse [exit_node: string = ""] {
alias t = task tailscale set --exit-node $exit_node
}
def tsp [] {
tailscale exit-node list
| split row "\n"
| each {str trim}
| filter {is-not-empty}
| skip 1
| last 19
| first 17
| split column -r '\s{2,}'
| reject column5 column3
| rename ip addr city
| par-each {
insert ping {
|row| $row.addr
| str replace "mullvad.ts.net" "relays.mullvad.net"
| ping -c5 -q $in
| split row "\n"
| last
| split column "/"
| get column6?
| get 0
}
}
| sort-by ping -n
}
def tsr [] {
tailscale status --json
| from json
| get Peer
| transpose nodekey node
| get node
| filter {$in.Location?.Country == USA}
| get TailscaleIPs
| each {get 0}
| select (random int 0..($in | length))
| tse $in.0
tailscale status
firefox https://mullvad.net/en/check
}
alias ts = tailscale alias ts = tailscale
alias tss = tailscale status alias tss = tailscale status
alias tsx = tailscale exit-node list alias tsx = tailscale exit-node list
alias zl = zellij
task
source ~/.cache/starship/init.nu
source ~/.zoxide.nu