From 9a081f68165d0e6227e28970edf2e29c5477060b Mon Sep 17 00:00:00 2001 From: velvettear Date: Thu, 26 Sep 2024 11:05:50 +0200 Subject: [PATCH] add basic files --- README.md | 9 +++-- config/kitty/colors.conf | 20 +++++++++++ config/kitty/kitty.conf | 50 ++++++++++++++++++++++++++ config/kitty/kitty.conf.bak | 49 +++++++++++++++++++++++++ config/psd/.psd.conf | 10 ++++++ config/psd/psd.conf | 70 ++++++++++++++++++++++++++++++++++++ scripts/scan/batch-scan.sh | 39 ++++++++++++++++++++ scripts/scan/ocr.sh | 11 ++++++ scripts/scan/scan.sh | 27 ++++++++++++++ scripts/update/alpine.sh | 61 +++++++++++++++++++++++++++++++ scripts/update/arch.sh | 71 +++++++++++++++++++++++++++++++++++++ scripts/update/debian.sh | 52 +++++++++++++++++++++++++++ scripts/update/update.sh | 24 +++++++++++++ zsh/conf.d/fujitsu | 15 ++++++++ zsh/zprofile | 36 +++++++++++++++++++ zsh/zshrc | 64 +++++++++++++++++++++++++++++++++ 16 files changed, 606 insertions(+), 2 deletions(-) create mode 100644 config/kitty/colors.conf create mode 100644 config/kitty/kitty.conf create mode 100644 config/kitty/kitty.conf.bak create mode 100644 config/psd/.psd.conf create mode 100644 config/psd/psd.conf create mode 100755 scripts/scan/batch-scan.sh create mode 100755 scripts/scan/ocr.sh create mode 100755 scripts/scan/scan.sh create mode 100755 scripts/update/alpine.sh create mode 100755 scripts/update/arch.sh create mode 100755 scripts/update/debian.sh create mode 100755 scripts/update/update.sh create mode 100755 zsh/conf.d/fujitsu create mode 100755 zsh/zprofile create mode 100755 zsh/zshrc diff --git a/README.md b/README.md index 826ca45..1185850 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ -# .dots + _ _ + | | | | + __| | ___ | |_ ___ + / _` |/ _ \| __/ __| + | (_| | (_) | |_\__ \ +(_)__,_|\___/ \__|___/ -### personal dot files +### personal .dot files diff --git a/config/kitty/colors.conf b/config/kitty/colors.conf new file mode 100644 index 0000000..16dcf11 --- /dev/null +++ b/config/kitty/colors.conf @@ -0,0 +1,20 @@ +foreground #fffff6 +background #0E111C +cursor #fffff6 + +color0 #0E111C +color8 #1e253d +color1 #EEDCA1 +color9 #ffffb4 +color2 #C7C7C6 +color10 #ffffe4 +color3 #EED277 +color11 #ffff83 +color4 #7C7E83 +color12 #909cba +color5 #ADADAF +color13 #cacafa +color6 #BFC0C2 +color14 #dff1ff +color7 #eeebdf +color15 #fffff6 diff --git a/config/kitty/kitty.conf b/config/kitty/kitty.conf new file mode 100644 index 0000000..6b1b513 --- /dev/null +++ b/config/kitty/kitty.conf @@ -0,0 +1,50 @@ +# author: Daniel Sommer +# license: MIT + +# https://sw.kovidgoyal.net/kitty/overview/#configuring-kitty + +# pointer settings +default_pointer_shape arrow + +# background and color settings +background_opacity 0.9 +include ./colors.conf + +# font settings +font_family Fira Code Nerd Font +bold_font auto +italic_font auto +bold_italic_font auto +font_size 12 + +# cursor settings +shell_integration no-cursor +cursor_shape underline +cursor_blink_interval 1 +cursor_underline_thickness 1.0 + +# tab settings +tab_bar_edge bottom +tab_bar_align left +tab_bar_style powerline +tab_powerline_style slanted + +# url settings +detect_urls yes +url_color #f6d66e +url_style dashed + +# bell settings +enable_audio_bell no + +# refresh settings +sync_to_monitor yes + +# scrollback settings +scrollback_lines 10000 + +# keyboard shortcuts +map ctrl+shift+c no_op +map ctrl+shift+v no_op +map ctrl+alt+c copy_to_clipboard +map ctrl+alt+v paste_from_clipboard diff --git a/config/kitty/kitty.conf.bak b/config/kitty/kitty.conf.bak new file mode 100644 index 0000000..5ea2c58 --- /dev/null +++ b/config/kitty/kitty.conf.bak @@ -0,0 +1,49 @@ +# author: Daniel Sommer +# license: MIT + +# https://sw.kovidgoyal.net/kitty/overview/#configuring-kitty + +# pointer settings +default_pointer_shape arrow + +# background and color settings +background_opacity 0.9 + +# font settings +font_family Fira Code Nerd Font +bold_font auto +italic_font auto +bold_italic_font auto +font_size 12 + +# cursor settings +shell_integration no-cursor +cursor_shape underline +cursor_blink_interval 1 +cursor_underline_thickness 1.0 + +# tab settings +tab_bar_edge bottom +tab_bar_align left +tab_bar_style powerline +tab_powerline_style slanted + +# url settings +detect_urls yes +url_color #aa0000 +url_style dashed + +# bell settings +enable_audio_bell no + +# refresh settings +sync_to_monitor yes + +# scrollback settings +scrollback_lines 10000 + +# keyboard shortcuts +map ctrl+shift+c no_op +map ctrl+shift+v no_op +map ctrl+alt+c copy_to_clipboard +map ctrl+alt+v paste_from_clipboard diff --git a/config/psd/.psd.conf b/config/psd/.psd.conf new file mode 100644 index 0000000..29e6784 --- /dev/null +++ b/config/psd/.psd.conf @@ -0,0 +1,10 @@ +# Automatically generated file; DO NOT EDIT! +# The purpose is to snapshot the settings used when psd was activated. +# Any edits to the live config: /home/velvettear/.config/psd/psd.conf +# will be applied the _next_ time psd is activated. +# +USE_OVERLAYFS="yes" +USE_SUSPSYNC="" +BROWSERS="firefox" +USE_BACKUPS="yes" +BACKUP_LIMIT="1" diff --git a/config/psd/psd.conf b/config/psd/psd.conf new file mode 100644 index 0000000..a7a3c72 --- /dev/null +++ b/config/psd/psd.conf @@ -0,0 +1,70 @@ +# +# $XDG_CONFIG_HOME/psd/psd.conf +# +# For documentation, refer man 1 psd or to the wiki page +# https://wiki.archlinux.org/index.php/Profile-sync-daemon + +## NOTE the following: +## To protect data from corruption, in the event that you do make an edit while +## psd is active, any changes made will be applied the next time you start psd. + +# Uncomment and set to "yes" to use overlayfs instead of a full copy to reduce +# the memory costs and to improve sync/unsync operations. Note that your kernel +# MUST have this module available in order to use this mode. +# +USE_OVERLAYFS="yes" + +# Uncomment and set to "yes" to resync on suspend to reduce potential data loss. +# Note that your system MUST have gdbus from glib2 installed to use this mode. +# +#USE_SUSPSYNC="no" + +# List any browsers in the array below to have managed by psd. Useful if you do +# not wish to have all possible browser profiles managed which is the default if +# this array is left commented. +# +# Possible values: +# chromium +# chromium-dev +# conkeror.mozdev.org +# epiphany +# falkon +# firefox +# firefox-trunk +# google-chrome +# google-chrome-beta +# google-chrome-unstable +# heftig-aurora +# icecat +# inox +# luakit +# midori +# opera +# opera-beta +# opera-developer +# opera-legacy +# otter-browser +# qupzilla +# qutebrowser +# palemoon +# rekonq +# seamonkey +# surf +# vivaldi +# vivaldi-snapshot +# +BROWSERS=("firefox") + +# Uncomment and set to "no" to completely disable the crash recovery feature. +# +# The default is to create crash recovery backups if the system is ungracefully +# powered-down due to a kernel panic, hitting the reset switch, battery going +# dead, etc. Some users keep very diligent backups and don't care to have this +# feature enabled. +USE_BACKUPS="yes" + +# Uncomment and set to an integer that is the maximum number of crash recovery +# snapshots to keep (the oldest ones are deleted first). +# +# The default is to save the most recent 5 crash recovery snapshots. +BACKUP_LIMIT=1 diff --git a/scripts/scan/batch-scan.sh b/scripts/scan/batch-scan.sh new file mode 100755 index 0000000..68871c1 --- /dev/null +++ b/scripts/scan/batch-scan.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +# author: Daniel Sommer +# license: MIT + +trap 'printf "\n>> batch scan aborted after $SECONDS seconds!\n" && exit 0' SIGINT + +directory="$1" +tmp="$(mktemp -d)" +[[ -z "$directory" ]] && directory="$tmp" + +mkdir -p "$directory" +[[ ! -d "$directory" ]] && printf "error: directory '"$directory"' does not exist and can not be created!\n" >&2 && exit 1 + +printf ">> batch scan started...\n" + +postprocess() { + ocr="$(/home/velvettear/.dots/scripts/ocr.sh "$file")" + printf "> #"$3": ocr for file '"$file"' finished!\n" + printf "$ocr" > "$file.ocr" + if [[ "$directory" != "$tmp" ]]; then + mv "$file" "$directory" + mv "$file.ocr" "$directory" + fi +} + +counter=1 +while true; do + sleep 1 + file="$tmp/$(date '+%Y-%m-%d_%H%M%S.png')" + scanimage --format="png" --output-file "$file" --resolution "300" --mode "Color" 2> /dev/null + if [[ "$?" != "0" ]]; then + rm -rf "$file" 2> /dev/null + continue + fi + printf "> #"$counter": scanning to '"$file"' finished!\n" + postprocess "$file" "$directory" "$counter" + ((counter++)) +done diff --git a/scripts/scan/ocr.sh b/scripts/scan/ocr.sh new file mode 100755 index 0000000..ac12b8f --- /dev/null +++ b/scripts/scan/ocr.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +# author: Daniel Sommer +# license: MIT + +file="$1" +[[ ! -f "$file" ]] && printf "error: specified file '"$file"' does not exist!\n" >&2 && exit 1 + +export OMP_THREAD_LIMIT=1 + +tesseract "$file" - -l "deu+eng" diff --git a/scripts/scan/scan.sh b/scripts/scan/scan.sh new file mode 100755 index 0000000..45c7177 --- /dev/null +++ b/scripts/scan/scan.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +# author: Daniel Sommer +# license: MIT + +name="$1" +directory="$2" +[[ -z "$directory" ]] && directory="$(mktemp -d)" + +[[ -z "$name" ]] && name="$(date '+%Y-%m-%d_%H%M%S').png" +[[ "$name" != *".png" ]] && name="$name.png" + +mkdir -p "$directory" +[[ ! -d "$directory" ]] && printf "error: directory '"$directory"' does not exist and can not be created!\n" >&2 && exit 1 + +output="$directory/$name" + +scanimage --format="png" --output-file "$output" --resolution "300" --mode "Color" 2> /dev/null + +[[ ! -e "$output" ]] && printf "error: no document was scanned!\n" >&2 && exit 1 +if [[ "$(du "$output" | awk '{print $1}')" == "0" ]]; then + printf "error: scanned document '"$output"' is empty!\n" >&2 + rm -rf "$output" + exit 1 +fi + +printf "$output\n" diff --git a/scripts/update/alpine.sh b/scripts/update/alpine.sh new file mode 100755 index 0000000..698863f --- /dev/null +++ b/scripts/update/alpine.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env ash + +# author: Daniel Sommer +# license: MIT + +# exit on ctrl-c +trap 'printf ""$font_colored_bold"\n>> stopping system update after "$SECONDS" seconds..."$font_default"\n" && exit 1' SIGINT + +# font styles & colors +font_default="\e[0m" +font_colored="\e[32;1m" +font_colored_bold="\e[31;1m" + +[[ "$(id -u)" != "0" ]] && printf ""$font_colored_bold">> error: permission denied!"$font_default"\n" && exit 1 + +for arg in "$@"; do + case "$arg" in + -n|--noconfirm) + noconfirm="true" + ;; + -r|--reboot) + reboot="true"G + ;; + esac +done + +printf ""$font_colored_bold">> system update started..."$font_default"\n" + +printf ""$font_colored"> updating packages..."$font_default"\n" +[[ "$noconfirm" ]] && /sbin/apk update --progress || /sbin/apk update --progress --interactive +[[ "$noconfirm" ]] && /sbin/apk upgrade --progress || /sbin/apk update --progress --interactive + +printf ""$font_colored"> cleaning cache..."$font_default"\n" +/sbin/apk cache clean &> /dev/null +rm -rf "/var/cache//sbin/apk/*" + +orphans="$(/sbin/apk list --orphaned | awk '{print $1}' 2> /dev/null)" +if [[ "$orphans" ]]; then + orphans="$(printf "$orphans" | tr '\n' ' ')" + printf ""$font_colored"> removing orphaned packages..."$font_default"\n" + [[ "$noconfirm" ]] && /sbin/apk del --purge --progress $orphans || /sbin/apk del --purge --progress --interactive $orphans +fi + +[[ -f "/etc/motd" ]] && printf ""$font_colored"> removing '/etc/motd'..."$font_default"\n" && rm -f "/etc/motd" + +script="$(realpath $(dirname $0))/update-$(cat /etc/hostname).sh" +[[ -x "$script" ]] && printf ""$font_colored"> executing script "$script"..."$font_default"\n" && (. "$script") + +printf ""$font_colored_bold">> system updated finished!"$font_default"\n" + +[[ ! "$reboot" ]] && exit 0 + +timeout="5" +printf ""$font_colored"> rebooting system in " +while [[ "$timeout" -gt "0" ]]; do + printf "$timeout... " + timeout="$(( timeout - 1 ))" + sleep 1 +done +printf "now!"$font_default"\n" +reboot diff --git a/scripts/update/arch.sh b/scripts/update/arch.sh new file mode 100755 index 0000000..9bf229f --- /dev/null +++ b/scripts/update/arch.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash + +# author: Daniel Sommer +# license: MIT + +# font styles & colors +DEFAULT=$(tput sgr0) +BOLD=$(tput bold) +RED=$(tput setaf 1) +GREEN=$(tput setaf 2) +YELLOW=$(tput setaf 3) + +# exit on ctr-c +trap 'printf ""${BOLD}${RED}"\n>> system update aborted after "$SECONDS" seconds!"${DEFAULT}"\n" && exit 1' SIGINT + +# parse arguments +for arg in "$@"; do + case "$arg" in + -n|--noconfirm) + noconfirm="--noconfirm" + ;; + -r|--reboot) + reboot="true" + ;; + esac +done + +printf "${BOLD}${YELLOW}>> starting system update...${DEFAULT}\n" + +# upgrade installed packages +printf "${YELLOW}> upgrading packages...${DEFAULT}\n" +paru -Syu --sudoloop --combinedupgrade --devel --cleanafter $noconfirm +[[ "$?" != "0" ]] && printf "${RED}>> encountered an error upgrading packages!${DEFAULT}\n" && exit 1 +printf "${GREEN}> packages successfully upgraded!${DEFAULT}\n" + +# remove unused packages +unused="$(paru -Qtdq --sudoloop)" +if [[ -n "$unused" ]]; then + printf "${YELLOW}> removing unused packages...${DEFAULT}\n" + paru -Rns --sudoloop --devel --cleanafter $noconfirm $unused + [[ "$?" != "0" ]] && printf "${RED}>> encountered an error removing unused packages!${DEFAULT}\n" && exit 1 + printf "${GREEN}> successfully removed unused packages!${DEFAULT}\n" +fi + +# clean the pacman cache +printf "${YELLOW}> cleaning pacman & paru cache directories...${DEFAULT}\n" +sudo rm -rf "/var/cache/pacman/*" +sudo rm -rf "$HOME/.cache/paru" +[[ "$?" != "0" ]] && printf "${RED}>> encountered an error cleaning the pacman & paru cache directories!${DEFAULT}\n" && exit 1 +printf "${GREEN}> successfully cleaned the pacman & paru cache directories!${DEFAULT}\n" + +printf "${BOLD}${YELLOW}>> system updated finished after "$SECONDS" seconds!${DEfAULT}\n" + +[[ -z "$reboot" ]] && exit 0 + +# reboot the system +timeout="5" +while [[ "$timeout" -gt "0" ]]; do + if [[ "$timeout" -gt "3" ]]; then + color="${GREEN}" + elif [[ "$timeout" -gt "1" ]]; then + color="${YELLOW}" + else + color="${RED}" + fi + printf "\r${color}> system reboot in ${BOLD}$timeout${DEFAULT} seconds..." + timeout="$((timeout - 1))" + sleep 1 +done +printf "\r${color}> system going down for reboot ${BOLD}NOW!${DEFAULT}\n" +sudo systemctl reboot 2> /dev/null diff --git a/scripts/update/debian.sh b/scripts/update/debian.sh new file mode 100755 index 0000000..07ba510 --- /dev/null +++ b/scripts/update/debian.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +# author: Daniel Sommer +# license: MIT + +# exit on ctrl-c +trap 'printf ""$font_colored_bold"\n>> stopping system update after "$SECONDS" seconds..."$font_default"\n" && exit 1' SIGINT + +# font styles & colors +font_default="\e[0m" +font_colored="\e[32;1m" +font_colored_bold="\e[31;1m" + +[[ "$EUID" != "0" ]] && printf ""$font_colored_bold">> error: permission denied"$font_default"\n" && exit 1 + +for arg in "$@"; do + case "$arg" in + -n|--noconfirm) + noconfirm="true" + ;; + -r|--reboot) + reboot="true" + ;; + esac +done + +printf ""$font_colored_bold">> system update started..."$font_default"\n" + +printf ""$font_colored"> updating packages..."$font_default"\n" +/usr/bin/apt-get update +[[ "$noconfirm" ]] && /usr/bin/apt-get upgrade -y || /usr/bin/apt-get upgrade + +printf ""$font_colored"> cleaning cache..."$font_default"\n" +rm -rf "/var/cache//usr/bin/apt-get/*" +[[ "$noconfirm" ]] && /usr/bin/apt-get clean -y || /usr/bin/apt-get clean + +printf ""$font_colored"> removing orphaned packages..."$font_default"\n" +[[ "$noconfirm" ]] && /usr/bin/apt-get autoremove --purge -y || /usr/bin/apt-get autoremove --purge + +printf ""$font_colored_bold">> system updated finished after "$SECONDS" seconds!"$font_default"\n" + +[[ ! "$reboot" ]] && exit 0 + +timeout="5" +printf ""$font_colored"> rebooting system in " +while [[ "$timeout" -gt "0" ]]; do + printf "$timeout... " + timeout="$(( timeout - 1 ))" + sleep 1 +done +printf "now!"$font_default"\n" +systemctl reboot diff --git a/scripts/update/update.sh b/scripts/update/update.sh new file mode 100755 index 0000000..b820eb0 --- /dev/null +++ b/scripts/update/update.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +# author: Daniel Sommer +# license: MIT + +# get distro and update script path +distro="$(grep "^ID" /etc/*release | cut -d "=" -f2)" +script="$(dirname $(realpath $0))/$distro.sh" + +# check if update script exists +[[ ! -x "$script" ]] && printf "error: update script '"$script"' does not exist or is not executable!\n" >&2 && exit 1 + +args="" +for arg in "$@"; do + [[ -n "$args" ]] && args="$args " + args="$args$arg" +done + +# execute update script +if [[ "$EUID" == "0" ]]; then + "$script" $args +else + sudo "$script" $args +fi diff --git a/zsh/conf.d/fujitsu b/zsh/conf.d/fujitsu new file mode 100755 index 0000000..59c79d7 --- /dev/null +++ b/zsh/conf.d/fujitsu @@ -0,0 +1,15 @@ +#!/usr/bin/env zsh +# __ _ _ _ +# / _| (_|_) | +# | |_ _ _ _ _| |_ ___ _ _ +# | _| | | | | | __/ __| | | | +# | | | |_| | | | |_\__ \ |_| | +# |_| \__,_| |_|\__|___/\__,_| +# _/ | +# |__/ +# +# author: Daniel Sommer +# license: MIT + +# ----- kde ----- # +[[ -z "${DISPLAY}" ]] && [[ "${XDG_VTNR}" -eq 1 ]] && echo "EXECUTING PLASMA!" >> /tmp/derp && exec /usr/lib/plasma-dbus-run-session-if-needed /usr/bin/startplasma-wayland &> /dev/null diff --git a/zsh/zprofile b/zsh/zprofile new file mode 100755 index 0000000..17deb8e --- /dev/null +++ b/zsh/zprofile @@ -0,0 +1,36 @@ +#!/usr/bin/env zsh +# __ _ _ +# / _(_) | +# _____ __ _ __ ___ | |_ _| | ___ +# |_ / '_ \| '__/ _ \| _| | |/ _ \ +# _ / /| |_) | | | (_) | | | | | __/ +# (_)___| .__/|_| \___/|_| |_|_|\___| +# | | +# |_| +# +# author: Daniel Sommer +# license: MIT + +# ----- prompt ----- # +export PROMPT="%(!.%F{red}.)%n@%m > %/%(!.#.$) %f" + +# ------ general ----- # +export USER="$(whoami)" +export HOST="$(hostname)" +export HOSTNAME="$HOST" +export TMP="/tmp" +export TEMP="/tmp" +export TMPDIR="/tmp" +export EDITOR="nvim" +export VISUAL="nvim" +export PAGER="bat" + +# ----- history ----- # +export HISTFILE="$HOME/.zhistory" +export SAVEHIST="10000" +export HISTSIZE="10000" +export HISTTIMEFORMAT="%d.%m.%Y %H:%M:%S" +export HISTCONTROL="ignoredups" + +# ----- pfetch ----- # +export PF_INFO="ascii title host kernel memory wm shell editor pkgs uptime palette" diff --git a/zsh/zshrc b/zsh/zshrc new file mode 100755 index 0000000..5edc864 --- /dev/null +++ b/zsh/zshrc @@ -0,0 +1,64 @@ +#!/usr/bin/env zsh +# _ +# | | +# _______| |__ _ __ ___ +# |_ / __| '_ \| '__/ __| +# _ / /\__ \ | | | | | (__ +# (_)___|___/_| |_|_| \___| +# +# author: Daniel Sommer +# license: MIT + +# ----- keybindings ----- # +bindkey "^[[1;3C" forward-word +bindkey "^[[1;3D" backward-word + +# ----- history ----- # +setopt SHARE_HISTORY + +# ----- aliases ----- # +alias c='clear' +alias ..='cd ..' +alias whereami='realpath .' +alias rmr='rm -r' +alias rmrf='rm -rf' +alias cpr='cp -R' +alias cprf='cp -Rf' +alias mkdirp='mkdir -p' +alias vi='nvim' +alias vim='nvim' +alias eza='eza --icons --group --time-style long-iso --octal-permissions --git' +alias ls='eza' +alias ll='eza --long' +alias la='eza --all' +alias lla='eza --long --all' +alias pacsearch='pacman -Q | grep ' +alias df='duf' +alias du='gdu' +alias grep='rg -P' +alias grepa='rg -P --hidden' +alias find='fd' +alias findf='fd --type file' +alias findd='fd --type directory' +alias findl='fd --type symlink' +alias finds='fd --type socket' +alias findp='fd --type pipe' +alias findx='fd --type executable' +alias finde='fd --type empty' +alias diff='diff --color=auto' +alias bat='bat --style header-filename,header-filesize,grid,snip,changes,numbers' +alias cat='bat' +alias batp='bat --style plain' +alias catp='batp' +alias pfetch='printf "\n" && pfetch' +alias fetch='pfetch' +alias stats='pfetch' +alias icat='kitten icat' +alias ssh='kitty +kitten ssh' +alias update='$HOME/.dots/scripts/update/update.sh' + +# ----- conf.d ----- # +"$HOME/.dots/zsh/conf.d/$(hostname)" + +# ----- root ----- # +[[ "$EUID" != "0" ]] && return