spring cleaning

This commit is contained in:
alisceon 2025-12-06 23:47:07 +01:00
parent 190901ae30
commit 0a11161655
8 changed files with 130 additions and 283 deletions

View file

@ -1,5 +1,21 @@
## ALIASES ##
aliases["tsla-fan"] = "ipmitool -H 10.30.0.3 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01 0x0"
aliases["nixoss"] = "sudo nixos-rebuild switch --flake @('.#' + $(hostname))"
aliases["nixost"] = "sudo nixos-rebuild test --flake @('.#' + $(hostname))"
aliases["nixosb"] = "sudo nixos-rebuild build --flake @('.#' + $(hostname))"
aliases["nixos-dry"] = "sudo nixos-rebuild dry-build --flake @('.#' + $(hostname))"
aliases["init-python"] = "nix flake update --flake templates && nix flake init -t 'templates#python' && direnv allow"
aliases["weboot"] = "bash -c 'nix shell nixpkgs#efibootmgr -c sudo efibootmgr -n 0000 && reboot'"
aliases["ls"] = "exa"
aliases["ll"] = "exa -lah"
aliases["grep"] = "rg"
aliases["theo"] = "python ~/.config/xonsh/theo.py"
aliases["kittycatsay"] = "python ~/.config/xonsh/kittycatsay.py"
## INTERACTIVE CONFIGURATION ##
if $XONSH_INTERACTIVE:
from datetime import datetime
import importlib.util
t0 = datetime.now()
## ENV ##
$XONSH_COLOR_STYLE = 'native'
@ -14,53 +30,26 @@ if $XONSH_INTERACTIVE:
$LESS_TERMCAP_us = "\033[00;36m"
$LESS_TERMCAP_ue = "\033[0m"
## XONTRIB ##
xontrib load coreutils
xontrib load fish_completer
xontrib load direnv
xontrib load clp
xontrib load bashisms
#xontrib load abbrevs #relies on xonsh.ptk_shell which was deprecated in 0.13
## XONTRIB ##
if importlib.util.find_spec("xontrib.coreutils") is not None:
xontrib load coreutils
if importlib.util.find_spec("xontrib.fish_completer") is not None:
xontrib load fish_completer
if importlib.util.find_spec("xontrib.direnv") is not None:
xontrib load direnv
if importlib.util.find_spec("xontrib.clp") is not None:
xontrib load clp
if importlib.util.find_spec("xontrib.bashisms") is not None:
xontrib load bashisms
if importlib.util.find_spec("xontrib.fzf_completions") is not None:
xontrib load fzf-completions
from xonsh.built_ins import XSH
XSH.env['fzf_history_binding'] = "c-r" # Ctrl+R
XSH.env['fzf_ssh_binding'] = "c-s" # Ctrl+S
XSH.env['fzf_file_binding'] = "c-t" # Ctrl+T
XSH.env['fzf_dir_binding'] = "c-g" # Ctrl+G
xontrib load fzf-completions
from xonsh.built_ins import XSH
XSH.env['fzf_history_binding'] = "c-r" # Ctrl+R
XSH.env['fzf_ssh_binding'] = "c-s" # Ctrl+S
XSH.env['fzf_file_binding'] = "c-t" # Ctrl+T
XSH.env['fzf_dir_binding'] = "c-g" # Ctrl+G
## ALIASES ##
aliases["tsla-fan"] = "ipmitool -H 10.30.0.3 -U ADMIN -P ADMIN raw 0x30 0x70 0x66 0x01 0x0"
aliases["nixoss"] = "sudo nixos-rebuild switch --flake .#${config.networking.hostName}"
aliases["nixost"] = "sudo nixos-rebuild test --flake .#${config.networking.hostName}"
aliases["nixosb"] = "sudo nixos-rebuild build --flake .#${config.networking.hostName}"
aliases["nixosdb"] = "sudo nixos-rebuild dry-build --flake .#${config.networking.hostName}"
aliases["devt"] = "devenv test"
aliases["devtas"] = "devenv tasks list"
aliases["devtar"] = "devenv tasks run"
aliases["devs"] = "devenv shell"
aliases["devi-python"] = "nix flake init -t templates#python"
aliases["weboot"] = "bash -c 'nix shell nixpkgs#efibootmgr -c sudo efibootmgr -n 0000 && reboot'"
aliases["ls"] = "exa"
aliases["ll"] = "exa -lah"
aliases["grep"] = "rg"
aliases["theo"] = "python ~/.config/xonsh/theo.py"
aliases["kittycatsay"] = "python ~/.config/xonsh/kittycatsay.py"
if $XONSH_INTERACTIVE:
hour = t0.hour
theo | kittycatsay
"""
if 5 <= hour < 10:
theo | cowsay -d
elif 10 <= hour < 16:
theo | cowsay -w
elif 16 <= hour < 18:
theo | cowsay
elif 18 <= hour < 22:
theo | cowsay -t
else:
theo | cowsay -s
"""
dt = round((datetime.now() - t0).microseconds/1000000, 2)
print("Load time:", dt, "seconds")