This commit is contained in:
ash
2026-05-29 11:04:02 +01:00
3 changed files with 156 additions and 21 deletions
+72
View File
@@ -0,0 +1,72 @@
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then
PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
for rc in ~/.bashrc.d/*; do
if [ -f "$rc" ]; then
. "$rc"
fi
done
fi
unset rc
alias HandBrakeCLI='flatpak run --command=HandBrakeCLI fr.handbrake.ghb'
export SSH_AUTH_SOCK=$HOME/.bitwarden-ssh-agent.sock
# Help Sheet
function helpme() {
echo -e "\e[32m--------- System Update ---------\e[0m"
echo -e "update : System Update"
echo -e "cleanup : Autoremove Packages"
echo -e ""
echo -e "\e[32m------------- Files -------------\e[0m"
echo -e "llt : Tree View"
echo -e "pack : pack compressed.tar.xz /folder/file1.txt /folder/folder2"
echo -e "unpack : unpack file.tar.xz"
echo -e "size : List files and sizes"
echo -e "zi : See past filepaths"
echo -e "ctl+R : Command history"
echo -e "alt+C : fzf search subdirectories"
echo -e ""
echo -e "\e[32m------------- Docker ------------\e[0m"
echo -e "dup : Docker compose up -d"
echo -e "ddown : Docker compose down "
echo -e "dupdate : Docker compose down, pull, up"
echo -e "drestart : Docker compose restart"
echo -e "dlog : Docker compose logs"
echo -e ""
}
alias update="sudo apt update && sudo apt upgrade -y"
alias cleanup="sudo apt autoremove"
alias ll="lsd -1"
alias llt="lsd --tree"
alias reload="source ~/.bashrc"
alias rip='abcde -c ~/.abcde.conf'
alias size="du -shc"
alias nano="micro"
alias dup="docker compose up -d"
alias ddown="docker compose down"
alias dupdate="docker compose down && docker compose pull && docker compose up -d"
alias drestart="docker compose restart"
alias dlog="docker compose logs"
alias star-update="sudo -v && cd ~/.bash && git pull https://git.marlow.quest/ash/Starship.git && chmod +x install-debian.sh && ./install-debian.sh && source ~/.bashrc"
alias star-edit="nano ~/.config/starship.toml"
alias pack="tar -cvJf" # pack compressed.tar.xz /folder/file1.txt /folder/folder2
alias unpack="tar -xvf"
eval "$(starship init bash)"
eval "$(zoxide init bash)"
\cd
+12 -6
View File
@@ -31,12 +31,20 @@ esac
echo -e "Selected hex color: $PRIMARY_COLOR\n" echo -e "Selected hex color: $PRIMARY_COLOR\n"
# --- 1. Update and install dependencies ---
echo -n "📦 Checking and installing dependencies... " echo -n "📦 Checking and installing dependencies... "
if sudo apt install -y git curl fontconfig lsd micro zoxide fzf > /dev/null 2>&1; then
# Define the command: Use sudo only if NOT root
if [ "$EUID" -ne 0 ]; then
CMD="sudo apt install -y"
else
CMD="apt install -y"
fi
# Execute the command
if $CMD git curl lsd micro zoxide fzf > /dev/null 2>&1; then
echo "Done." echo "Done."
else else
echo "Failed! Check your internet connection." echo "Failed! Check your internet connection or package manager state."
exit 1 exit 1
fi fi
@@ -80,13 +88,11 @@ if [ -f ".bashrc" ]; then
if [ ! -L ~/.bashrc ] && [ ! -f ~/.bashrc.bak ]; then if [ ! -L ~/.bashrc ] && [ ! -f ~/.bashrc.bak ]; then
cp ~/.bashrc ~/.bashrc.bak cp ~/.bashrc ~/.bashrc.bak
fi fi
cp -f .bashrc ~/.bashrc && echo "Done." cp -f .bashrc_debian ~/.bashrc && echo "Done."
else else
echo "Skipped (.bashrc not found)." echo "Skipped (.bashrc not found)."
fi fi
# --- 5. Refresh Kitty ---
echo "-----------------------------------------------" echo "-----------------------------------------------"
echo "✅ All set! Terminal Restarting." echo "✅ All set! Terminal Restarting."
+71 -14
View File
@@ -31,18 +31,49 @@ title() {
# Dependencies # Dependencies
# ------------------------- # -------------------------
check_dependencies() { check_dependencies() {
for cmd in flashkit fzf md5sum; do # Ensure ~/.local/bin is in PATH (for pip installs)
if ! command -v $cmd &> /dev/null; then export PATH="$HOME/.local/bin:$PATH"
gum confirm "$cmd is not installed. Install it now?" && {
gum spin --spinner="line" --title="Installing $cmd..." -- sudo apt-get install -y $cmd # flashkit
} if ! command -v flashkit &> /dev/null; then
gum confirm "flashkit is not installed. Install it now?" || exit 1
gum spin --spinner="line" --title="Installing flashkit..." -- \
python3 -m pip install --user flashkit
# Re-check after install
if ! command -v flashkit &> /dev/null; then
gum style --foreground="#FFA500" "flashkit install failed or not in PATH."
gum style --foreground="#FFA500" "Try: export PATH=\$HOME/.local/bin:\$PATH"
exit 1
fi fi
done fi
# pyserial
if ! python3 -c "import serial" &> /dev/null; then
gum confirm "pyserial is not installed. Install it now?" || exit 1
gum spin --spinner="line" --title="Installing pyserial..." -- \
python3 -m pip install --user pyserial
if ! python3 -c "import serial" &> /dev/null; then if ! python3 -c "import serial" &> /dev/null; then
gum confirm "pyserial is not installed. Install it now?" && { gum style --foreground="#FFA500" "pyserial install failed."
gum spin --spinner="line" --title="Installing pyserial..." -- python3 -m pip install pyserial exit 1
} fi
fi
# fzf
if ! command -v fzf &> /dev/null; then
gum confirm "fzf is not installed. Install it now?" || exit 1
gum spin --spinner="line" --title="Installing fzf..." -- \
sudo apt-get update && sudo apt-get install -y fzf
fi
# md5sum (usually present, but just in case)
if ! command -v md5sum &> /dev/null; then
gum style --foreground="#FFA500" "md5sum not found. Please install coreutils."
exit 1
fi fi
} }
@@ -96,7 +127,9 @@ read_cart() {
# FZF file browser # FZF file browser
# ------------------------- # -------------------------
browse_files() { browse_files() {
find ~/ -type f -name "*.md" -size +256k 2>/dev/null \ search_path="$1"
find "$search_path" -type f -name "*.md" -size +256k 2>/dev/null \
| fzf \ | fzf \
--height=40% \ --height=40% \
--reverse \ --reverse \
@@ -112,7 +145,32 @@ write_rom() {
clear clear
title title
rom_file=$(browse_files) # Build menu dynamically
options=()
if [ -d "/mnt/nas/Games/ROMs/megadrive" ]; then
options+=("NAS (/mnt/nas/Games/ROMs/megadrive)")
fi
options+=("Search Home (~)")
source_choice=$(printf "%s\n" "${options[@]}" | gum choose --header="Select ROM source:")
case "$source_choice" in
"NAS (/mnt/nas/Games/ROMs/megadrive)")
if [ ! -d "/mnt/nas/Games/ROMs/megadrive" ]; then
gum style --foreground="#FFA500" "NAS path not available."
return
fi
rom_file=$(browse_files "/mnt/nas/Games/ROMs/megadrive")
;;
"Search Home (~)")
rom_file=$(browse_files "$HOME")
;;
*)
return
;;
esac
[ -z "$rom_file" ] && { [ -z "$rom_file" ] && {
gum style --foreground="#FFA500" "No file selected." gum style --foreground="#FFA500" "No file selected."
@@ -120,8 +178,8 @@ write_rom() {
} }
# File info # File info
rom_size=$(du -h "$rom_file" | cut -f1) rom_size=$(du -h "$rom_file" | awk '{print $1}')
rom_md5=$(md5sum "$rom_file" | cut -d ' ' -f1) rom_md5=$(md5sum "$rom_file" | awk '{print $1}')
gum style \ gum style \
--foreground="#FFA500" \ --foreground="#FFA500" \
@@ -136,7 +194,6 @@ MD5: $rom_md5"
gum spin --spinner="line" --title="Writing ROM..." -- flashkit --port "$selected_port" write-rom -i "$rom_file" gum spin --spinner="line" --title="Writing ROM..." -- flashkit --port "$selected_port" write-rom -i "$rom_file"
gum style --foreground="#FFA500" "Done! ROM written successfully." gum style --foreground="#FFA500" "Done! ROM written successfully."
# Auto refresh
read_cart read_cart
} || { } || {
gum style --foreground="#FFA500" "Cancelled." gum style --foreground="#FFA500" "Cancelled."