2025-01-07 14:48:56 -08:00
|
|
|
# task
|
2024-05-16 01:56:17 -07:00
|
|
|
|
2024-08-28 13:49:15 -07:00
|
|
|
alias xo = xdg-open
|
2024-09-05 15:18:19 -07:00
|
|
|
# alias h = hx (sk)
|
2024-05-16 01:56:17 -07:00
|
|
|
alias b = btm
|
|
|
|
|
alias cringe = sudo bootctl set-oneshot auto-windows
|
|
|
|
|
alias fetch = fastfetch
|
|
|
|
|
alias ff = firefox
|
|
|
|
|
alias pu = pueue
|
|
|
|
|
alias t = task
|
|
|
|
|
alias zl = zellij
|
2024-06-17 13:13:35 -07:00
|
|
|
alias snapper = snapper -c home
|
2024-10-02 17:58:52 -07:00
|
|
|
alias follow = readlink -f
|
2025-01-23 17:57:22 -08:00
|
|
|
alias la = ls -a
|
2024-09-21 00:01:32 -07:00
|
|
|
|
2024-09-05 15:18:19 -07:00
|
|
|
alias quiet = sudo ectool fanduty 30
|
2024-08-29 10:12:47 -07:00
|
|
|
alias loud = sudo ectool autofanctrl
|
2024-09-21 00:01:32 -07:00
|
|
|
|
2024-11-29 20:39:29 -08:00
|
|
|
alias cp-full = cp
|
2024-09-21 00:01:32 -07:00
|
|
|
alias cp = cp -prv
|
2024-11-29 20:39:29 -08:00
|
|
|
alias mv-full = mv
|
2024-09-21 00:01:32 -07:00
|
|
|
alias mv = mv -pv
|
|
|
|
|
|
2025-01-05 23:59:35 -08:00
|
|
|
alias j = jj
|
2024-11-26 15:25:21 -08:00
|
|
|
alias ja = jj log -r 'all()'
|
2024-05-25 17:18:24 -07:00
|
|
|
alias jc = jj desc
|
2024-10-13 23:23:19 -07:00
|
|
|
alias jd = jj diff
|
2024-10-17 11:08:01 -07:00
|
|
|
alias je = jj edit
|
|
|
|
|
alias jf = jj git fetch
|
2024-10-07 19:41:32 -07:00
|
|
|
alias jg = jj git clone --colocate
|
2024-10-13 23:23:19 -07:00
|
|
|
alias jm = jj bookmark set main
|
|
|
|
|
alias jp = jj git push
|
|
|
|
|
alias js = jj status
|
2024-11-05 08:16:23 -08:00
|
|
|
alias jw = jj workspace update-stale
|
2024-09-05 15:18:19 -07:00
|
|
|
|
|
|
|
|
def h [] {
|
|
|
|
|
sk | complete |
|
|
|
|
|
if $in.exit_code == 0 {
|
|
|
|
|
$in.stdout | str trim | hx $in
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-09-01 22:11:49 -07:00
|
|
|
def --env c [path: path = "~"] {
|
|
|
|
|
cd $path
|
2024-05-16 01:56:17 -07:00
|
|
|
l
|
|
|
|
|
}
|
2024-04-28 10:56:51 -07:00
|
|
|
def l [
|
2024-05-25 17:18:24 -07:00
|
|
|
--all (-a)
|
2024-05-25 18:35:30 -07:00
|
|
|
--long (-l)
|
2024-05-16 01:56:17 -07:00
|
|
|
path: path = "."
|
2024-04-28 10:56:51 -07:00
|
|
|
] {
|
2024-05-25 18:35:30 -07:00
|
|
|
if $all and $long {
|
|
|
|
|
ls -la $path
|
|
|
|
|
} else if $all {
|
2024-05-25 17:18:24 -07:00
|
|
|
ls -a $path
|
2024-05-25 18:35:30 -07:00
|
|
|
} else if $long {
|
|
|
|
|
ls -l $path
|
2024-05-25 17:18:24 -07:00
|
|
|
} else {
|
|
|
|
|
ls $path
|
|
|
|
|
}
|
2024-05-16 03:51:55 -07:00
|
|
|
| sort-by type name -i -n
|
2024-04-28 10:56:51 -07:00
|
|
|
}
|
2024-09-05 15:18:19 -07:00
|
|
|
def srg [] {
|
2024-05-28 20:40:46 -07:00
|
|
|
sk --ansi -i -c 'rg --color=always --line-number "{}"'
|
2024-05-25 18:35:30 -07:00
|
|
|
}
|
2024-05-25 17:18:24 -07:00
|
|
|
alias nd = nix develop
|
2024-05-16 01:56:17 -07:00
|
|
|
def ns [package] {
|
|
|
|
|
nix shell $"nixpkgs#($package)"
|
|
|
|
|
}
|
2024-05-28 20:40:46 -07:00
|
|
|
def nr [package] {
|
|
|
|
|
nix search nixpkgs $package
|
|
|
|
|
}
|
2024-10-15 19:21:20 -07:00
|
|
|
def rebuild --wrapped [subcommand, ...rest] {
|
2025-01-05 00:48:30 -08:00
|
|
|
if ((open /etc/hostname --raw) == "NOlaptop\n" and not (try {$rest | first | str starts-with "--builders"} catch {true})) {
|
2024-11-05 08:16:23 -08:00
|
|
|
sudo nix store info --store ssh://nocomputer
|
|
|
|
|
}
|
2025-01-28 17:54:51 -08:00
|
|
|
sudo systemd-inhibit nice -n19 nixos-rebuild $subcommand --flake /home/tao/projects/NOflake/ --impure --verbose ...$rest
|
2025-01-22 18:46:34 -08:00
|
|
|
toastify send rebuild done!
|
2024-05-09 23:37:38 -07:00
|
|
|
}
|
2024-06-10 17:41:44 -07:00
|
|
|
# def post-rebuild [] {
|
|
|
|
|
# # rm -r ~/.config/helix/runtime/grammars/
|
|
|
|
|
# # hx --grammar fetch; hx --grammar build
|
|
|
|
|
# # rustup update
|
|
|
|
|
# }
|
2024-05-07 13:10:41 -07:00
|
|
|
def bump [] {
|
|
|
|
|
cd /home/tao/projects/NOflake/
|
|
|
|
|
jj new -m "bump"
|
|
|
|
|
nix flake update
|
|
|
|
|
# rc2nix | save -f /home/tao/projects/NOflake/users/tao/plasma.nix;
|
2024-05-07 13:37:09 -07:00
|
|
|
# sudo nix store ping --store ssh://nocomputer
|
2024-05-09 23:37:38 -07:00
|
|
|
rebuild boot
|
2024-05-07 13:10:41 -07:00
|
|
|
jj new
|
|
|
|
|
}
|
2024-05-09 23:37:38 -07:00
|
|
|
alias rb = rebuild boot
|
|
|
|
|
alias rs = rebuild switch
|
2024-05-16 01:56:17 -07:00
|
|
|
alias gc = nh clean all
|
2024-08-21 18:31:46 -07:00
|
|
|
def check-mullvad [] {
|
2024-08-24 12:52:54 -07:00
|
|
|
loop {
|
2024-08-22 14:29:12 -07:00
|
|
|
print "checking connection status"
|
2024-08-24 12:52:54 -07:00
|
|
|
http get https://am.i.mullvad.net/json
|
2024-09-06 22:44:48 -07:00
|
|
|
| if $in.mullvad_exit_ip == true {break} else {print $in}
|
2024-08-28 13:49:15 -07:00
|
|
|
sleep 1sec
|
2024-08-21 18:31:46 -07:00
|
|
|
}
|
|
|
|
|
}
|
2024-05-16 01:56:17 -07:00
|
|
|
def tse [exit_node: string = ""] {
|
2024-05-28 20:40:46 -07:00
|
|
|
if ($exit_node | is-empty) and (ps | find deluge | is-not-empty) {
|
2024-11-26 15:25:21 -08:00
|
|
|
return "stop summoning first!"
|
2024-05-28 20:40:46 -07:00
|
|
|
} else {
|
|
|
|
|
tailscale set --exit-node $exit_node
|
|
|
|
|
}
|
2024-08-28 13:49:15 -07:00
|
|
|
if ($exit_node | is-not-empty) {
|
|
|
|
|
check-mullvad
|
|
|
|
|
}
|
2024-11-26 15:25:21 -08:00
|
|
|
return "exit node set"
|
2024-05-16 01:56:17 -07:00
|
|
|
}
|
2024-06-01 17:01:22 -07:00
|
|
|
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 -r
|
|
|
|
|
}
|
2024-05-16 01:56:17 -07:00
|
|
|
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
|
2024-05-19 16:14:11 -07:00
|
|
|
# tailscale status
|
2024-08-21 18:31:46 -07:00
|
|
|
check-mullvad
|
2024-05-16 01:56:17 -07:00
|
|
|
}
|
2024-03-15 12:47:44 -07:00
|
|
|
alias ts = tailscale
|
|
|
|
|
alias tss = tailscale status
|
2024-05-16 03:51:55 -07:00
|
|
|
alias tsu = tailscale up
|
|
|
|
|
alias tsd = tailscale down
|
2024-03-15 12:47:44 -07:00
|
|
|
alias tsx = tailscale exit-node list
|
2024-06-01 17:01:22 -07:00
|
|
|
alias tsa = tailscale exit-node suggest
|
2024-05-28 20:40:46 -07:00
|
|
|
def "config stuff" [] {
|
|
|
|
|
hx ~/projects/NOflake/users/tao/nushell/stuff.nu
|
|
|
|
|
}
|
|
|
|
|
def deluge-gtk [] {
|
|
|
|
|
tsr
|
|
|
|
|
deluge-gtk
|
|
|
|
|
}
|
|
|
|
|
alias deluge = deluge-gtk
|
|
|
|
|
def fixme [] {
|
|
|
|
|
rg TODO --json
|
|
|
|
|
| lines
|
|
|
|
|
| each {from json}
|
|
|
|
|
| where type == "match"
|
|
|
|
|
| get data
|
|
|
|
|
| flatten
|
|
|
|
|
| each {$"($in.text):($in.line_number)"}
|
|
|
|
|
| hx ...$in
|
|
|
|
|
}
|
2024-05-16 01:56:17 -07:00
|
|
|
source ~/.cache/starship/init.nu
|
|
|
|
|
source ~/.zoxide.nu
|
2025-01-30 17:42:24 -08:00
|
|
|
def --env z [path: string = "~"] {
|
|
|
|
|
zo $path
|
|
|
|
|
l
|
|
|
|
|
}
|