cmatrix -s 

df -h / | lolcat

echo 
# The following lines were added by compinstall

zstyle ':completion:*' file-sort modification
zstyle :compinstall filename '/home/josh/.zshrc'

autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
# End of lines configured by zsh-newuser-install
setopt INTERACTIVE_COMMENTS

setopt HIST_IGNORE_ALL_DUPS

export PATH="$HOME/.local/bin:$PATH"

# ------ NICE BOOT ---------

alias rzsh='clear && zsh'



# ----- HASHES --------

hash -d gd=GoogleDrive
hash -d ff='GoogleDrive/File Folder post-8／17／23'

# ----------------- CANNEDROID ------------
# Run the complete ReDroid container stack from a cold boot
#alias aup='sudo modprobe binder_linux devices="binder,hwbinder,vndbinder" && sudo docker rm -f redroid 2>/dev/null && sudo docker run -itd --rm --privileged --pull missing --name redroid -v ~/redroid-data:/data -p 5555:5555 redroid/redroid:13.0.0-latest androidboot.hardware=redroid redroid.gpu.mode=guest redroid.fps=30 && sleep 10 && adb kill-server && adb connect localhost:5555 && rehash && scrcpy -s localhost:5555 --max-fps=30 --max-size=1024 --window-title="ReDroid" --audio-codec=aac --lock-video-orientation=1'

# Force-target the local container for APK installations
#alias ai='adb -s localhost:5555 install'

# ----- TAIL STUFF ----

alias tn='krfb & sudo docker start guacamole && sudo tailscale funnel 8080'
alias noslp='sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target'
alias slp='sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target'

alias tna='python3 -m http.server 8000 --bind 127.0.0.1 &'
alias tnb='sudo tailscale funnel 8000 &'
alias tnk='sudo killall python3 tailscale'
# -------------- THE AIRDROP STUFF ---------------

# Standard Network Control Ricing
alias netstop='sudo systemctl stop NetworkManager'
alias netgo='sudo systemctl restart NetworkManager'

# The Ultimate Apple Impersonation Suite
alias owlgo='sudo modprobe mac80211_hwsim radios=1 2>/dev/null; sudo systemctl stop NetworkManager; sudo killall wpa_supplicant iwd 2>/dev/null; sudo ip link set wlan0 down; sudo ip addr flush dev wlan0; sudo iw wlan0 set type monitor; sudo ip link set wlan0 up; sudo owl -i wlan0 -N'
alias owlstop='sudo killall owl 2>/dev/null; sudo rmmod mac80211_hwsim 2>/dev/null; sudo systemctl restart NetworkManager'

# OpenDrop Streamlining
alias iget='opendrop -i awdl0 receive'
alias ifind='opendrop -i awdl0 find'
alias igive='opendrop -i awdl0 send'
# where you'd say igive -r # -f /file/path
alias ihelp=" echo 'you say igive -r n -f /file/path btw' "

# --------------------- SDDM and SYSCTL ----------------

alias sdst='sudo sddm start'
alias sdrst='sudo systemctl restart sddm'
alias isol='sudo systemctl isolate multi-user.target'
alias ulock='loginctl unlock-session'

# ----------------- SUDO, ZSH, and OTHER UTILS ---------------
alias sai='sudo apt install'
alias sain='sudo apt install --no-install-recommends'
alias sap='sudo apt purge'
alias sac='sudo apt clean'

alias play='paplay'

alias scl='sudo stacer'
alias cl='stacer'

alias zedit='micro ~/.zshrc'
alias zset='source ~/.zshrc'

alias bedit='micro ~/.bashrc'

alias sdca='sudo dpkg --configure -a'
alias sar='sudo apt autoremove'
alias sarp='sudo apt autoremove --purge'
alias sau='sudo apt update'

alias see="echo 'watch -d -n 1 df -h'"

alias hdsk='ncdu --exclude /home/josh/GoogleDrive ~'
alias dsk='ncdu --exclude /home/josh/GoogleDrive --exclude /proc --exclude /usr /'


alias e='micro'
alias se='sudo micro'
alias mpdf='convert *.png output.pdf'


alias k9='sudo killall -9'
# -------------- MIDI STUFF -----------------

alias playm='aplaymidi -p 24:0'
alias playm2='amidi -p hw:2,0,0 -s'
alias nhkill='sudo bash /home/josh/Code/unhang.sh' # note hang kill btw

# --------------- DIRS AND DOORS ----------------

# ENVS
alias venv='source menv/bin/activate'
alias cenv="cd ~ && python3 -m venv menv"
alias denv="deactivate"
alias renv="rm -rf menv"

# ----------------- RCLONE -------------------
alias dmount="fusermount -u -z "/home/josh/GoogleDrive/""
alias d2mount="fusermount -u -z "/home/josh/JulesDrive/""
alias dmain="fusermount -u -z "/home/josh/MainDrive/""
alias d67="fusermount -u -z "/home/josh/SixSeven/""


alias rmount="rclone mount gdrive: ~/GoogleDrive --vfs-cache-mode writes --allow-non-empty"

alias gmount='rclone mount main: ~/MainDrive \
  --vfs-cache-mode writes \
  --vfs-cache-max-size 100M \
  --vfs-cache-max-age 1h \
  --attr-timeout 1s \
  --buffer-size 0 \
  --drive-export-formats txt \
  --daemon'

alias 2mount='rclone mount j2: ~/JulesDrive \
  --vfs-cache-mode writes \
  --vfs-cache-max-size 100M \
  --vfs-cache-max-age 1h \
  --attr-timeout 1s \
  --buffer-size 0 \
  --drive-export-formats txt \
  --daemon'

alias 67mount='rclone mount 67: ~/SixSeven \
  --vfs-cache-mode writes \
  --vfs-cache-max-size 100M \
  --vfs-cache-max-age 1h \
  --attr-timeout 1s \
  --buffer-size 0 \
  --daemon'

alias rkill='killall rclone'
  
# -------------- GRUB ----------------

alias cpset="sudo cp ~/Coolio.png /boot/grub/img.png"
alias gedit="sudo micro /etc/default/grub"
alias gedit2="sudo micro /etc/grub.d/40_custom"
alias gset="sudo update-grub"


# -------------- MORE UTILS ----------------

alias py="python3"
alias chrome="google-chrome-beta"
alias kai='chrome --app=http://gemini.google.com/app --class=WebApp-kAI5767 --name=WebApp-kAI5767'
alias qt='qutebrowser'

alias ws='curl -s'

alias fbck='curl -s https://api.scratch.mit.edu/users/fiashbang/messages/count'
alias csck='curl -s https://api.scratch.mit.edu/users/charredstuff/messages/count'


alias scrc='python3 ~/Code/comment_catcher.py'

# --------------- CPUTILS ---------------
# The "Shove" command
alias shove='for cpu in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "performance" | sudo tee $cpu; done'

# The "Chill" command
alias chill='for cpu in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do echo "powersave" | sudo tee $cpu; done'

# ------------- EVEN MORE UTILS -----------

alias qotd='fortune | cowsay | lolcat'

alias dewav='sudo bash ~/Code/convert_wav.sh'

alias usbdwav='sudo bash ~/Code/conv_wav_usb.sh'

midifix() {
    # Check if a file was actually provided
    if [[ -z "$1" ]]; then
        echo "Usage: midifix <filename.mid>"
        return 1
    fi

    # Create variables for the basename and the temp file
    local input_file="$1"
    local base_name="${input_file%.*}"
    local temp_abc="${base_name}_temp.abc"
    local output_file="${base_name}_FIXED.MID"

    echo "Refining $input_file via ABC notation..."
    
    # The actual conversion chain
    midi2abc "$input_file" -o "$temp_abc" && \
    abc2midi "$temp_abc" -o "$output_file"
    
    # Cleanup the temp file
    if [[ -f "$temp_abc" ]]; then
        rm "$temp_abc"
        echo "Success! Created: $output_file"
    fi
}

# --------------- IDK KINDA DEPREC TBH -----------------

alias yap='LD_LIBRARY_PATH=$HOME ~/Code/llama/llama-cli -m ~/GoogleDrive/"Cloud Offloading"/qwen-0.5b.gguf \
    --threads 4 \
    --n-predict 256 \
    --color on \
    --temp 0.8 \
    --repeat-penalty 1.5 \
    -cnv \
    -r "User:" \
    -p "<|im_start|>system\nYou are a cynical Linux terminal gremlin. You despise Windows users and think GUI is for the weak. Speak in punchy, technical roasts. No helpful advice allowed.<|im_end|>\n<|im_start|>user\nWhy do you hate Windows?<|im_end|>\n<|im_start|>assistant\nBecause it is a bloated, registry-clogged circus for people who are afraid of a blinking cursor.<|im_end|>\n<|im_start|>user\n"'

# ------------- X11 COMMAND BC SDDM IS COOKED ----------------

alias z11='XDG_SESSION_TYPE=x11 startx /usr/bin/startplasma-x11 -- :2 vt5'


# ------------- CHORDTUNE -----------

# Intercept Enter key to target blank lines only
fancy-blank-enter-fortune() {
    # If the buffer is completely empty or just spaces
    if [[ -z "${BUFFER//[[:space:]]/}" ]]; then
        fortune | lolcat
    fi
    zle .accept-line
}
zle -N accept-line fancy-blank-enter-fortune

# ---------------- CLIP IT! (clpt) -----------

# Instant voice memo trigger
clpt() {
    local dir="$HOME/.Clips"
    mkdir -p "$dir"
    local file="$dir/clip_$(date +%Y-%m-%d_%H%M%S).flac"
    echo "Clipping..."
    rec -q "$file"
}
alias clpt=clpt
