diff --git a/.newsboat/urls b/.newsboat/urls new file mode 100755 index 0000000000000000000000000000000000000000..ecb2975be5f73760c4872a442d744a8a6566a84c --- /dev/null +++ b/.newsboat/urls @@ -0,0 +1,50 @@ +https://theorangeduck.com/feeds/pages +https://lwn.net/headlines/rss +https://kristoff.it/index.xml +https://www.computerenhance.com/feed +https://tratt.net/laurie/news.rss +https://willhbr.net/feed.xml +https://andrewkelley.me/rss.xml +https://beyondloom.com/blog/rss.xml +https://thomashunter.name/feed.rss +https://decuser.github.io/feed.xml +https://simonwillison.net/atom/entries/ +https://til.simonwillison.net/tils/feed.atom +https://www.andreinc.net/feed.xml +https://voussoir.net/writing/writing.atom +https://blog.regehr.org/feed +https://richiejp.com/atom.xml +https://szymonkaliski.com/feed.xml +https://world.hey.com/dhh/feed.atom +https://mitchellh.com/feed.xml +https://matt-rickard.com/rss +https://neil.computer/rss/ +https://matduggan.com/rss/ +https://michael.stapelberg.ch/feed.xml +https://journal.valeriansaliou.name/rss/ +https://www.duskborn.com/index.xml +https://mirzapandzo.com/rss.xml +https://mitjafelicijan.com/feed.xml +https://crawl.develz.org/wordpress/feed +https://go.dev/blog/feed.atom +https://www.youtube.com/feeds/videos.xml?channel_id=UCYO_jab_esuFRV4b17AJtAw +https://www.youtube.com/feeds/videos.xml?channel_id=UCUSck1dOH7VKmG4lRW7tZXg +https://www.youtube.com/feeds/videos.xml?channel_id=UCkK9UDm_ZNrq_rIXCz3xCGA +https://www.youtube.com/feeds/videos.xml?channel_id=UCwgKmJM4ZJQRJ-U5NjvR2dg +https://www.youtube.com/feeds/videos.xml?channel_id=UC8DntJ-sBtgC-jA0yEjxqjw +https://www.youtube.com/feeds/videos.xml?channel_id=UCrqM0Ym_NbK1fqeQG2VIohg +https://www.youtube.com/feeds/videos.xml?channel_id=UCUzQJ3JBuQ9w-po4TXRJHiA +https://www.youtube.com/feeds/videos.xml?channel_id=UCUyeluBRhGPCW4rPe_UvBZQ +https://www.youtube.com/feeds/videos.xml?channel_id=UCS0N5baNlQWJCUrhCEo8WlA +https://www.youtube.com/feeds/videos.xml?channel_id=UCsBjURrPoezykLs9EqgamOA +https://www.youtube.com/feeds/videos.xml?channel_id=UCaTznQhurW5AaiYPbhEA-KA +https://www.youtube.com/feeds/videos.xml?channel_id=UCld68syR8Wi-GY_n4CaoJGA +https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw +https://www.youtube.com/feeds/videos.xml?channel_id=UCVk4b-svNJoeytrrlOixebQ +https://www.youtube.com/feeds/videos.xml?channel_id=UCNzszbnvQeFzObW0ghk0Ckw +https://www.youtube.com/feeds/videos.xml?channel_id=UCAMu6Dso0ENoNm3sKpQsy0g +https://www.youtube.com/feeds/videos.xml?channel_id=UC2DjFE7Xf11URZqWBigcVOQ +https://www.youtube.com/feeds/videos.xml?channel_id=UCVls1GmFKf6WlTraIb_IaJg +https://www.youtube.com/feeds/videos.xml?channel_id=UCTAfm-YD2M9xzvbYvRc5ttA +https://www.youtube.com/feeds/videos.xml?channel_id=UC5--wS0Ljbin1TjWQX6eafA +https://www.youtube.com/feeds/videos.xml?channel_id=UCmtyQOKKmrMVaKuRXz02jbQ diff --git a/.shenanigans.sh b/.shenanigans.sh new file mode 100755 index 0000000000000000000000000000000000000000..c1b34d799aeef69d7acddf126d18675225fe0d52 --- /dev/null +++ b/.shenanigans.sh @@ -0,0 +1,198 @@ +# Magical environment variables. +NIX_SHELL_PRESERVE_PROMPT=1 +TERM=xterm-256color +VISUAL=vim +EDITOR=vim + +parse_git_branch() { + git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' +} + +is_inside_nix_shell() { + nix_shell_name="$(basename "$IN_NIX_SHELL" 2>/dev/null)" + if [[ -n "$nix_shell_name" ]]; then + echo " \e[0;36m(nix-shell)\e[0m" + fi +} + +# Better prompt. +export PS1="[\033[38;5;166m\]\u@\h\[$(tput sgr0)\]]$(is_inside_nix_shell)\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \w\[$(tput sgr0)\] \n$ " + +# General aliases. +alias ls='ls --color=none' +alias l='ls -lh --color=none' +alias ll='ls -lha --color=none' +alias t='tree -L 2' +alias ..='cd ..' +alias grep='grep --color=always' +alias less='less -R' +alias tmux='tmux -u' +alias vi='vim' +alias server='python3 -m http.server 6969' + +# Custom folder jump commands. +alias p='cd ~/Vault/projects' +alias j='cd ~/Junk/current' +alias d='cd ~/Downloads' + +# Additional path settings. +export PATH=$HOME/Applications:$PATH +export PATH=$HOME/go/bin:$PATH +export PATH=/usr/local/go/bin:$PATH + +# History and search. Stolen from J. +HISTCONTROL=ignoreboth +shopt -s histappend +export HISTSIZE= +export HISTFILESIZE= +export HISTFILE=~/.bash_history_infinite +PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}" +bind '"\e[A": history-search-backward' +bind '"\e[B": history-search-forward' +export HSTR_CONFIG=hicolor +if [[ $- =~ .i. ]]; then bind '"\C-h": "\C-a hstr -- \C-j"'; fi + +# Machine provision script for essential software. +# This is meant to be used on Debian 11+. +provision() { + doas apt install \ + build-essential git gcc make busybox cifs-utils tree hstr s3cmd \ + xmlstarlet htop nvtop tmux picom scrot xclip mc ripgrep jq \ + rsync doas newsboat entr clang clang-tidy clang-tools \ + libx11-dev libxinerama-dev libxft-dev x11-xserver-utils \ + stow podman podman-compose +} + +# Backup to NAS function. Much wow! +backup() { + CWD=$(pwd) + VHOME=/home/$USER/Vault + ME=$(whoami)@$(hostname) + + mkdir -p $VHOME/dotfiles + cd $VHOME/dotfiles + + # Make a copy of certain files. + rsync -azhv /home/$USER/.bash_history_infinite bash_history_infinite + rsync -azhv /home/$USER/.ssh/ ssh + rsync -azhv /home/$USER/.aws/ aws + rsync -azhv /home/$USER/.gnupg/ gnupg/ + + # Sync with NAS. + rsync -azhvpog \ + --exclude '.venv/' \ + --exclude '.git/' \ + --exclude '.import/' \ + --exclude '.godot/' \ + --exclude '.zig-cache/' \ + --exclude 'node_modules/' \ + --exclude 'digg-v5/' \ + --delete \ + $VHOME/ /media/Void/Backup/$ME/ + + # Add to log file. + echo `date +"%D %T"` >> ~/.vault.log + notify-send "Backup finished successfully." + + # Return back to original directory + cd $CWD +} + +# Simple ticket system based on https://github.com/mitjafelicijan/ticket. +export TICKETS=~/Vault/tickets +tt() { + if [ "$(uname -s)" != "Linux" ]; then + printf "Currently only Linux is supported.\n" + return 1 + fi + + if [ -z "$TICKETS" ]; then + TICKETS="$HOME/tickets" + fi + + mkdir -p $TICKETS + + # Display open tickets if no argument provided. + if [ -z "$1" ]; then + echo "`tt -o`" + return 0 + fi + + case $1 in + -n|-new) + # ticket_id=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 10 | head -n 1) + ticket_id=$(echo -n "$(date)" | md5sum | cut -c 9-20) + ticket_file=$TICKETS/$ticket_id + printf "id: %s\n" $ticket_id > $ticket_file + printf "responsible: %s\n" `whoami`@`hostname` >> $ticket_file + printf "created: %s\n" "`date`" >> $ticket_file + printf "status: open\n" >> $ticket_file + printf "title: ?\n" >> $ticket_file + printf "====\n" >> $ticket_file + printf "Description...\n" >> $ticket_file + $EDITOR $ticket_file + ;; + -o|-open) + printf "%-14s %-21s %s\n" "Ticket ID" "Created at" "Title" + printf "%0.s-" {1..100} + printf "\n" + grep --color=never -l 'status: open' $TICKETS/* | while read file; do + id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }') + title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}') + cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}') + cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S") + printf "%-14s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" + done + ;; + -c|-closed) + printf "%-14s %-21s %s\n" "Ticket ID" "Created at" "Title" + printf "%0.s-" {1..100} + printf "\n" + grep --color=never -l 'status: closed' $TICKETS/* | while read file; do + id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }') + title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}') + cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}') + cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S") + printf "%-14s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" + done + ;; + -h|-help) + printf "Usage: ticket [option]\n" + printf " -n, -new creates a new ticket\n" + printf " -o, -open lists open tickets\n" + printf " -c, -closed lists closed tickets\n" + printf " -h, -help shows this help\n" + ;; + *) + if [ -e "$TICKETS/$1" ] && [ -f "$TICKETS/$1" ]; then + $EDITOR "$TICKETS/$1" + else + printf "Ticket not found: $TICKETS/$1\n" + fi + ;; + esac +} + +# Toggles between pulseaudio sinks in round-robin. +togglesink() { + sinks=($(pactl list short sinks | awk '{print $2}')) + current_sink=$(pactl get-default-sink) + current_index=-1 + + for i in "${!sinks[@]}"; do + if [[ "${sinks[$i]}" == "$current_sink" ]]; then + current_index=$i + break + fi + done + + if [[ $current_index -eq -1 ]]; then + next_index=0 + else + next_index=$(( (current_index + 1) % ${#sinks[@]} )) + fi + + pactl set-default-sink "${sinks[$next_index]}" + notify-send "Switched to sink: ${sinks[$next_index]}" +} + diff --git a/README.md b/README.md index f1697ecb9ea90565b573ed14aeb028a8e4c4ca44..6db701b6ccffe0d3b4fd96a107d00a7881dc7ce6 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ ![Unga Bunga](https://github.com/mitjafelicijan/dotfiles/assets/296714/2ea7852a-8297-40c4-a9b1-0f6cba6c701f) +Relies on [GNU Stow](https://www.gnu.org/software/stow/). + ```sh git clone git@github.com:mitjafelicijan/dotfiles.git ~/.dotfiles - -# Create symbolic links to actual config files. -sh symlink.sh +cd .dotfiles && stow ``` diff --git a/gitconfig b/.gitconfig rename from gitconfig rename to .gitconfig diff --git a/i3config b/.config/i3/config rename from i3config rename to .config/i3/config diff --git a/i3status b/.config/i3status/config rename from i3status rename to .config/i3status/config diff --git a/rssfeeds b/rssfeeds deleted file mode 100755 index 503daaa993ec19f9767f8d18044049588840f209..0000000000000000000000000000000000000000 --- a/rssfeeds +++ /dev/null @@ -1,49 +0,0 @@ -https://theorangeduck.com/feeds/pages -https://lwn.net/headlines/rss -https://kristoff.it/index.xml -https://www.computerenhance.com/feed -https://tratt.net/laurie/news.rss -https://willhbr.net/feed.xml -https://andrewkelley.me/rss.xml -https://beyondloom.com/blog/rss.xml -https://thomashunter.name/feed.rss -https://decuser.github.io/feed.xml -https://simonwillison.net/atom/entries/ -https://til.simonwillison.net/tils/feed.atom -https://www.andreinc.net/feed.xml -https://voussoir.net/writing/writing.atom -https://blog.regehr.org/feed -https://richiejp.com/atom.xml -https://szymonkaliski.com/feed.xml -https://world.hey.com/dhh/feed.atom -https://mitchellh.com/feed.xml -https://matt-rickard.com/rss -https://neil.computer/rss/ -https://matduggan.com/rss/ -https://michael.stapelberg.ch/feed.xml -https://journal.valeriansaliou.name/rss/ -https://www.duskborn.com/index.xml -https://mirzapandzo.com/rss.xml -https://mitjafelicijan.com/feed.xml -https://crawl.develz.org/wordpress/feed -https://go.dev/blog/feed.atom -https://www.youtube.com/feeds/videos.xml?channel_id=UCUSck1dOH7VKmG4lRW7tZXg -https://www.youtube.com/feeds/videos.xml?channel_id=UCkK9UDm_ZNrq_rIXCz3xCGA -https://www.youtube.com/feeds/videos.xml?channel_id=UCwgKmJM4ZJQRJ-U5NjvR2dg -https://www.youtube.com/feeds/videos.xml?channel_id=UC8DntJ-sBtgC-jA0yEjxqjw -https://www.youtube.com/feeds/videos.xml?channel_id=UCrqM0Ym_NbK1fqeQG2VIohg -https://www.youtube.com/feeds/videos.xml?channel_id=UCUzQJ3JBuQ9w-po4TXRJHiA -https://www.youtube.com/feeds/videos.xml?channel_id=UCUyeluBRhGPCW4rPe_UvBZQ -https://www.youtube.com/feeds/videos.xml?channel_id=UCS0N5baNlQWJCUrhCEo8WlA -https://www.youtube.com/feeds/videos.xml?channel_id=UCsBjURrPoezykLs9EqgamOA -https://www.youtube.com/feeds/videos.xml?channel_id=UCaTznQhurW5AaiYPbhEA-KA -https://www.youtube.com/feeds/videos.xml?channel_id=UCld68syR8Wi-GY_n4CaoJGA -https://www.youtube.com/feeds/videos.xml?channel_id=UCXuqSBlHAE6Xw-yeJA0Tunw -https://www.youtube.com/feeds/videos.xml?channel_id=UCVk4b-svNJoeytrrlOixebQ -https://www.youtube.com/feeds/videos.xml?channel_id=UCNzszbnvQeFzObW0ghk0Ckw -https://www.youtube.com/feeds/videos.xml?channel_id=UCAMu6Dso0ENoNm3sKpQsy0g -https://www.youtube.com/feeds/videos.xml?channel_id=UC2DjFE7Xf11URZqWBigcVOQ -https://www.youtube.com/feeds/videos.xml?channel_id=UCVls1GmFKf6WlTraIb_IaJg -https://www.youtube.com/feeds/videos.xml?channel_id=UCTAfm-YD2M9xzvbYvRc5ttA -https://www.youtube.com/feeds/videos.xml?channel_id=UC5--wS0Ljbin1TjWQX6eafA -https://www.youtube.com/feeds/videos.xml?channel_id=UCmtyQOKKmrMVaKuRXz02jbQ diff --git a/shenanigans.sh b/shenanigans.sh deleted file mode 100755 index 5af5fdfbb09b1989615523b02ce9b8547f7f1d2a..0000000000000000000000000000000000000000 --- a/shenanigans.sh +++ /dev/null @@ -1,198 +0,0 @@ -# Magical environment variables. -NIX_SHELL_PRESERVE_PROMPT=1 -TERM=xterm-256color -VISUAL=vim -EDITOR=vim - -parse_git_branch() { - git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/' -} - -is_inside_nix_shell() { - nix_shell_name="$(basename "$IN_NIX_SHELL" 2>/dev/null)" - if [[ -n "$nix_shell_name" ]]; then - echo " \e[0;36m(nix-shell)\e[0m" - fi -} - -# Better prompt. -export PS1="[\033[38;5;166m\]\u@\h\[$(tput sgr0)\]]$(is_inside_nix_shell)\[\033[33m\]\$(parse_git_branch)\[\033[00m\] \w\[$(tput sgr0)\] \n$ " - -# General aliases. -alias ls='ls --color=none' -alias l='ls -lh --color=none' -alias ll='ls -lha --color=none' -alias t='tree -L 2' -alias ..='cd ..' -alias grep='grep --color=always' -alias less='less -R' -alias tmux='tmux -u' -alias vi='vim' -alias server='python3 -m http.server 6969' - -# Custom folder jump commands. -alias p='cd ~/Vault/projects' -alias j='cd ~/Junk/current' -alias d='cd ~/Downloads' - -# Additional path settings. -export PATH=$HOME/Applications:$PATH -export PATH=$HOME/go/bin:$PATH -export PATH=/usr/local/go/bin:$PATH - -# History and search. Stolen from J. -HISTCONTROL=ignoreboth -shopt -s histappend -export HISTSIZE= -export HISTFILESIZE= -export HISTFILE=~/.bash_history_infinite -PROMPT_COMMAND="history -a; history -n; ${PROMPT_COMMAND}" -bind '"\e[A": history-search-backward' -bind '"\e[B": history-search-forward' -export HSTR_CONFIG=hicolor -if [[ $- =~ .i. ]]; then bind '"\C-h": "\C-a hstr -- \C-j"'; fi - -# Machine provision script for essential software. -# This is meant to be used on Debian 11+. -provision() { - doas apt install \ - build-essential git gcc make busybox cifs-utils tree hstr s3cmd \ - xmlstarlet htop nvtop tmux picom scrot xclip mc ripgrep jq \ - rsync doas newsboat entr clang clang-tidy clang-tools \ - libx11-dev libxinerama-dev libxft-dev x11-xserver-utils \ - podman podman-compose -} - -# Backup to NAS function. Much wow! -backup() { - CWD=$(pwd) - VHOME=/home/$USER/Vault - ME=$(whoami)@$(hostname) - - mkdir -p $VHOME/dotfiles - cd $VHOME/dotfiles - - # Make a copy of certain files. - rsync -azhv /home/$USER/.bash_history_infinite bash_history_infinite - rsync -azhv /home/$USER/.ssh/ ssh - rsync -azhv /home/$USER/.aws/ aws - rsync -azhv /home/$USER/.gnupg/ gnupg/ - - # Sync with NAS. - rsync -azhvpog \ - --exclude '.venv/' \ - --exclude '.git/' \ - --exclude '.import/' \ - --exclude '.godot/' \ - --exclude '.zig-cache/' \ - --exclude 'node_modules/' \ - --exclude 'digg-v5/' \ - --delete \ - $VHOME/ /media/Void/Backup/$ME/ - - # Add to log file. - echo `date +"%D %T"` >> ~/.vault.log - notify-send "Backup finished successfully." - - # Return back to original directory - cd $CWD -} - -# Simple ticket system based on https://github.com/mitjafelicijan/ticket. -export TICKETS=~/Vault/tickets -tt() { - if [ "$(uname -s)" != "Linux" ]; then - printf "Currently only Linux is supported.\n" - return 1 - fi - - if [ -z "$TICKETS" ]; then - TICKETS="$HOME/tickets" - fi - - mkdir -p $TICKETS - - # Display open tickets if no argument provided. - if [ -z "$1" ]; then - echo "`tt -o`" - return 0 - fi - - case $1 in - -n|-new) - # ticket_id=$(tr -dc 'a-zA-Z0-9' < /dev/urandom | fold -w 10 | head -n 1) - ticket_id=$(echo -n "$(date)" | md5sum | cut -c 9-20) - ticket_file=$TICKETS/$ticket_id - printf "id: %s\n" $ticket_id > $ticket_file - printf "responsible: %s\n" `whoami`@`hostname` >> $ticket_file - printf "created: %s\n" "`date`" >> $ticket_file - printf "status: open\n" >> $ticket_file - printf "title: ?\n" >> $ticket_file - printf "====\n" >> $ticket_file - printf "Description...\n" >> $ticket_file - $EDITOR $ticket_file - ;; - -o|-open) - printf "%-14s %-21s %s\n" "Ticket ID" "Created at" "Title" - printf "%0.s-" {1..100} - printf "\n" - grep --color=never -l 'status: open' $TICKETS/* | while read file; do - id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }') - title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}') - cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}') - cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S") - printf "%-14s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" - done - ;; - -c|-closed) - printf "%-14s %-21s %s\n" "Ticket ID" "Created at" "Title" - printf "%0.s-" {1..100} - printf "\n" - grep --color=never -l 'status: closed' $TICKETS/* | while read file; do - id=$(head -n 1 "$file" | tail -n 1 | awk '{ print $2 }') - title=$(head -n 5 "$file" | tail -n 1 | awk '{$1=""; print $0}') - cdate=$(head -n 3 "$file" | tail -n 1 | awk '{$1=""; print $0}') - cdate_fmt=$(date -d "$cdate" "+%Y-%m-%d %H:%M:%S") - printf "%-14s %-20s %.66s\n" "$id" "$cdate_fmt" "$title" - done - ;; - -h|-help) - printf "Usage: ticket [option]\n" - printf " -n, -new creates a new ticket\n" - printf " -o, -open lists open tickets\n" - printf " -c, -closed lists closed tickets\n" - printf " -h, -help shows this help\n" - ;; - *) - if [ -e "$TICKETS/$1" ] && [ -f "$TICKETS/$1" ]; then - $EDITOR "$TICKETS/$1" - else - printf "Ticket not found: $TICKETS/$1\n" - fi - ;; - esac -} - -# Toggles between pulseaudio sinks in round-robin. -togglesink() { - sinks=($(pactl list short sinks | awk '{print $2}')) - current_sink=$(pactl get-default-sink) - current_index=-1 - - for i in "${!sinks[@]}"; do - if [[ "${sinks[$i]}" == "$current_sink" ]]; then - current_index=$i - break - fi - done - - if [[ $current_index -eq -1 ]]; then - next_index=0 - else - next_index=$(( (current_index + 1) % ${#sinks[@]} )) - fi - - pactl set-default-sink "${sinks[$next_index]}" - notify-send "Switched to sink: ${sinks[$next_index]}" -} - diff --git a/symlink.sh b/symlink.sh deleted file mode 100644 index d31d7cd53ed05aa6f5e9609d9a5a634dd34ae8e5..0000000000000000000000000000000000000000 --- a/symlink.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env sh - -set -x - -mkdir -p ~/.config/i3 -mkdir -p ~/.config/i3status/ -mkdir -p ~/.newsboat - -ln -s ~/.dotfiles/shenanigans.sh ~/.shenanigans.sh -ln -s ~/.dotfiles/tmux.conf ~/.tmux.conf -ln -s ~/.dotfiles/vimrc ~/.vimrc -ln -s ~/.dotfiles/gitconfig ~/.gitconfig -ln -s ~/.dotfiles/i3config ~/.config/i3/config -ln -s ~/.dotfiles/i3status ~/.config/i3status/config -ln -s ~/.dotfiles/rssfeeds ~/.newsboat/urls - diff --git a/tmux.conf b/.tmux.conf rename from tmux.conf rename to .tmux.conf diff --git a/vimrc b/.vimrc rename from vimrc rename to .vimrc