diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | config/bash/bash_profile | 63 | ||||
-rw-r--r-- | config/bash/bashrc | 75 | ||||
-rw-r--r-- | config/bash/ps1.sh | 62 | ||||
-rw-r--r-- | config/bash/travel.sh | 15 | ||||
-rwxr-xr-x | install.sh | 3 | ||||
-rwxr-xr-x | link.sh | 3 |
7 files changed, 222 insertions, 1 deletions
@@ -1 +1 @@ -init +# My personal dotfiles diff --git a/config/bash/bash_profile b/config/bash/bash_profile new file mode 100644 index 0000000..02bf099 --- /dev/null +++ b/config/bash/bash_profile @@ -0,0 +1,63 @@ +export EDITOR="nvim" +export VISUAL="nvim" +export TERMINAL="st" +export BROWSER="mullvad-browser" + +export vim="nvim" +alias vim="nvim" +alias n="nvim" + +# User Directories +export XDG_STATE_HOME="$HOME/.local/state" +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" +export XDG_CACHE_HOME="$HOME/.local/cache" +export XDG_DOWNLOAD_DIR="$HOME/doc/Downloads" +export XDG_DOCUMENTS_DIR=$HOME/Doc + +#export GNUPGHOME="$XDG_DATA_HOME"/gnupg +#export GNUPGHOME="${XDG_DATA_HOME:-$HOME/.local/share}/gnupg" +#export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket) +#export XAUTHORITY="$XDG_RUNTIME_DIR"/Xauthority + +export NSS_DEFAULT_DB_TYPE="sql" +export NSS_DB_PATH="$XDG_DATA_HOME/pki" +export PASSWORD_STORE_DIR="$XDG_DATA_HOME"/pass +export CARGO_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/cargo" +export HISTFILE="${XDG_STATE_HOME}"/bash/history +export HISTSIZE= +export NPM_CONFIG_USERCONFIG=$XDG_CONFIG_HOME/npm/npmrc +maildir="${XDG_DATA_HOME:-$HOME/.local/share}/mail" +export GIT_CONFIG_GLOBAL=~/.config/git/gitconfig + +#export ADB_VENDOR_KEYS +export ANDROID="${XDG_DATA_HOME:-$HOME/.config/android}" +export ANDROID_SDK_HOME="$HOME/.local/share/android" +export ANDROID_HOME="${XDG_DATA_HOME:-$HOME/.config/android}" +export ANDROID_USER_HOME="$XDG_DATA_HOME"/android +#alias adb='HOME="$XDG_DATA_HOME"/android' +export W3M_DIR="$XDG_DATA_HOME"/w3m + + +export NOTMUCH_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/notmuch-config" +export GTK2_RC_FILES="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-2.0/gtkrc-2.0" +export LESSHISTFILE="-" +export WGETRC="${XDG_CONFIG_HOME:-$HOME/.config}/wget/wgetrc" +export MBSYNCRC="${XDG_CONFIG_HOME:-$HOME/.config}/mbsync/config" +export INPUTRC="${XDG_CONFIG_HOME:-$HOME/.config}/shell/inputrc" +export PATH=${PATH}:~/platform-tools +export ZDOTDIR="${XDG_CONFIG_HOME:-$HOME/.config}/zsh" +export synonymrc="$XDG_CONFIG_HOME/.config/synonym/synonymrc" +export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel + +#export ALSA_CONFIG_PATH="$XDG_CONFIG_HOME/alsa/asoundrc" +#export WINEPREFIX="${XDG_DATA_HOME:-$HOME/.local/share}/wineprefixes/default" +#export KODI_DATA="${XDG_DATA_HOME:-$HOME/.local/share}/kodi" +#export GOPATH="${XDG_DATA_HOME:-$HOME/.local/share}/go" +#export ANSIBLE_CONFIG="${XDG_CONFIG_HOME:-$HOME/.config}/ansible/ansible.cfg" +#export UNISON="${XDG_DATA_HOME:-$HOME/.local/share}/unison" +##export MSMTP="${XDG_CONFIG_HOME:-$HOME/.config}/msmtp/config" +#export MSMTP="${XDG_CONFIG_HOME:-$HOME/.msmtprc}" + +# Created by `pipx` on 2025-01-01 18:49:01 +export PATH="$PATH:/home/black/.local/bin" diff --git a/config/bash/bashrc b/config/bash/bashrc new file mode 100644 index 0000000..92add3c --- /dev/null +++ b/config/bash/bashrc @@ -0,0 +1,75 @@ +[[ $- != *i* ]] && return + +source ~/.bash_profile +source ~/.local/share/bash/ps1.sh +source ~/.local/share/bash/travel.sh + + +#### === Aliases === #### + +# Linux +alias ls='ls --color=auto' +alias grep="grep --color" +alias rm="rm -r -v" +alias cp="cp -r" +alias mkdir="mkdir -v" +alias s="sudo" +alias SS="sudo systemctl" + + +# Util +alias shutdown="shutdown -h now" +alias wifioff="nmcli radio wifi off && rfkill block wlan" +alias wifion="rfkill unblock wlan && nmcli radio wifi on" +alias p="ping archlinux.org -4 -c 3 || ping -4 -c 3 wikipedia.org" +alias ftube-subs="jq -r '.subscriptions[].name' ~/.config/FreeTube/profiles.db" + + +# DL +alias sdl="curl --tlsv1.3 --proto =https --location --remote-name" +alias yta='yt-dlp --yes-playlist --add-metadata -ic -f "bestaudio[ext=m4a]/bestaudio/best" -o '\''%(uploader)s/%(upload_date)s_%(title)s_%(id)s.%(ext)s'\'' --external-downloader aria2c --external-downloader-args '\''-x 16 -s 16 -k 1M'\''' +alias yt='yt-dlp --yes-playlist --add-metadata -ic --merge-output-format mkv -f "bestvideo[ext=mkv]+bestaudio[ext=m4a]/best[ext=mkv]/best" -o '\''%(uploader)s/%(upload_date)s_%(title)s_%(id)s.%(ext)s'\'' --external-downloader aria2c --external-downloader-args '\''-x 16 -s 16 -k 1M'\''' + + +# Display +alias set_monitor_vertical="xrandr --output HDMI-1 --rotate right" +alias set_monitor_horizontal="xrandr --output HDMI-1 --rotate normal" + +# Programs +alias linecount="scc" +alias scc="scc --binary -c --no-cocomo -i c,h,cpp,java,py,sh,html,js,css" +alias a="aria2c" +alias simplex="simplex-chat -d ~/.local/share/simplex/simplex_v1_agent.db" +alias stopwatch="~/.local/share/pkg/peaclock/build/release/peaclock" +alias tt="tt -notheme --showwpm -highlight2 -n 50" +alias neofetch="neofetch --memory_unit gib" +alias mirror-phone="scrcpy" +alias fl="ranger" +alias mangal="~/.local/share/pkg/mangal/mangal" +alias ed="ed -p ':'" +alias polychromatic-cli="~/.local/share/git/polychromatic/polychromatic-cli" +alias gzip="gzip -v" +alias yarn='yarn --use-yarnrc "$XDG_CONFIG_HOME/yarn/config"' +alias screen="ffmpeg -f pulse -ac 2 -i default -f x11grab -r 30 -s 1920x1080 -i :0.0 -acodec pcm_s16le -vcodec libx264 -preset ultrafast -threads 0 -f segment -strftime 1 -segment_time 10:00:00 %Y-%m-%d__%s.mkv" + +alias rec-ogg="ffmpeg -y -f alsa -ac 2 -ar 44100 -i pulse -f ogg -acodec libvorbis -f segment -strftime 1 -segment_time 10:00:00 %Y-%m-%d__%s.ogg" +alias rec-mp3="ffmpeg -y -f alsa -ac 2 -ar 44100 -i pulse -f mp3 -acodec libmp3lame -f segment -strftime 1 -segment_time 10:00:00 %Y-%m-%d__%s.mp3" +alias vob-to-mkv="ffmpeg -i INPUT.VOB -codec:v libx264 -crf 21 -codec:a libmp3lame -qscale:a 2 -codec:s copy OUTPUT.mkv" + + +# Random +alias sysage="awk -F \"[[ ]\" 'NR==1 {print $2;}' /var/log/pacman.log" +alias sysage2="sudo dumpe2fs /dev/nvme0n1p4 | grep -i 'Filesystem created'" +alias ftube-subs="cat ~/.config/FreeTube/profiles.db | grep -o '\"name\":\"[^\"]*\"' | sed 's/\"name\":\"\(.*\)\"/\1/' | tail -n +2" +alias pascii="awk 'BEGIN {for (i = 32; i < 127; i++) printf \"%3d 0x%02x %c\n\", i, i, i}' | pr -t6 -w78" +alias howlong="clear && printf '\n\033[?25l' && while :; do tdiff 06:00; sleep 60;clear; done && printf '\033[?25h'" + +### Saved non-aliased commands +# cat *.VOB > big.vob && ffmpeg -i big.vob -c:v copy -c:a copy full.mp4 +# openssl rand -hex 10 | sed -E 's/(.{4})/\1-/g' | sed 's/-$//' +# cat /dev/urandom | tr -dc 'a-zA-Z' | fold -w 16 | head -n 1 +# yt-dlp --skip-download --write-subs --write-auto-subs --sub-lang en --sub-format ttml --convert-subs srt --output "transcript.%(ext)s" <URL_GOES_HERE_WITHOUT_QUOTES> && sed -i '' -e '/^[0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9] --> [0-9][0-9]:[0-9][0-9]:[0-9][0-9].[0-9][0-9][0-9]$/d' -e '/^[[:digit:]]\{1,4\}$/d' -e 's/<[^>]*>//g' ./transcript.en.srt && sed -e 's/<[^>]*>//g' -e '/^[[:space:]]*$/d' transcript.en.srt > output.txt && rm transcript.en.srt +# adb shell pm disable-user --user 0 org.lineageos.audiofx +#alias pkg-size="pacman -Qi | egrep '^(Name|Installed)' | cut -f2 -d':' | paste - - | column -t | sort -nrk 2 | grep MiB | less" +#alias fonts-installed="fc-list | cut -f 2 -d ":" | sed 's/^[ \t]*//;s/[ \t]*$//' | sort | uniq" +# ffmpeg -i input.mkv -c:v libx264 -c:a aac -strict experimental output.mp4 diff --git a/config/bash/ps1.sh b/config/bash/ps1.sh new file mode 100644 index 0000000..35a182a --- /dev/null +++ b/config/bash/ps1.sh @@ -0,0 +1,62 @@ +function parse_git_branch { + git rev-parse --is-inside-work-tree &>/dev/null || return + local branch=$(git symbolic-ref --short HEAD 2>/dev/null || git describe --tags --exact-match 2>/dev/null) + + echo "(${branch})" +} + + +## ✗ ✓ ↑ ↓ ↲ ↲ ↳ ↴ ↵ ↺ ➔ ➙ ➜ ➥ +function parse_git_status { + local symbol="✓" # clean state (up to date) + + if git rev-parse --is-inside-work-tree &>/dev/null; then + local branch + branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) + + # Ahead / behind remote + if [[ "$branch" != "HEAD" ]]; then + local behind=$(git rev-list --count HEAD..origin/$branch 2>/dev/null || echo 0) + local ahead=$(git rev-list --count origin/$branch..HEAD 2>/dev/null || echo 0) + if [[ "$ahead" -gt 0 ]]; then + symbol="↑" + elif [[ "$behind" -gt 0 ]]; then + symbol="↓" + fi + fi + + # Unstaged changes + if ! git diff --quiet 2>/dev/null; then + symbol="✗" + fi + if ! git diff --cached --quiet 2>/dev/null; then + symbol="✗" + fi + + # untracked files + if git ls-files --others --exclude-standard -z | grep -q .; then + symbol="?" + fi + fi + + echo "${symbol}" +} + +function set_PS1 { + WHITE="\[\033[01;015m\]" + YELLOW="\[\033[01;33m\]" + BLUE="\[\033[01;34m\]" + RED="\[\033[01;31m\]" + PINK="\[\033[01;35m\]" + RESET="\[\033[0m\]" + + if git rev-parse --is-inside-work-tree &>/dev/null; then + PS1="${YELLOW}\u@\h ${BLUE}[$(basename "$PWD")]${RED}$(parse_git_branch) ${RESET}$(parse_git_status) ${PINK}\$:${RESET} " + else + PS1="${WHITE}\u@\h \$: ${RESET}" + #PS1="\[\033[01;015m\]\u@\h $: \[\033[0m\]" + fi +} + +set_PS1 +PROMPT_COMMAND=set_PS1 diff --git a/config/bash/travel.sh b/config/bash/travel.sh new file mode 100644 index 0000000..41aea98 --- /dev/null +++ b/config/bash/travel.sh @@ -0,0 +1,15 @@ +set -o vi +shopt -s autocd + +function fcd() { + cd "$(fd -t d -E Digital/D1 -E /home/black/Games | fzf --reverse)" && clear +} + +function fcd-o() { + nvim "$(fd -t f -E Digital/D1 -E /home/black/Games | fzf --reverse)" +} + +bind '"\C-f": "fcd\n"' #bind -x '"\C-f": fcd' +bind -x '"\C-o": fcd-o' +bind -x '"\C-n": /bin/dupt' +bind -x '"\C-h": /bin/hist' diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..0f6d3cf --- /dev/null +++ b/install.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +# TODO @@ -0,0 +1,3 @@ +#!/bin/sh + +# TODO |