Compare commits

..

1 commit

Author SHA1 Message Date
janolehuebner
f200a4704d Backed up pre-existing configs to local branch 2025-04-06 20:33:52 +02:00
22 changed files with 24 additions and 616 deletions

View file

@ -1,23 +0,0 @@
brew "cmake"
brew "exiv2"
brew "ffmpeg"
brew "git-filter-repo"
brew "go"
brew "jpeg"
brew "leveldb"
brew "neovim"
brew "nmap"
brew "node"
brew "pass"
brew "podman"
brew "python@3.12"
brew "restic"
brew "samba"
brew "subfinder"
brew "yarn"
brew "yt-dlp"
brew "zoxide"
cask "amethyst"
cask "amorphousdiskmark"
cask "android-platform-tools"
cask "iterm2"

View file

@ -1,28 +0,0 @@
[color]
diff = auto
status = auto
branch = auto
interactive = auto
ui = true
pager = true
submodule = true
fetch = true
pull = true
[push]
default = simple
[pull]
ff = only
[core]
excludesfile = ~/.gitignore
autocrlf = input
[status]
submoduleSummary = true
[pager]
log = less --chop-long-lines --shift 3
[alias]
graph = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
chronograph = graph --date-order
ff = merge --ff-only
amend = commit --amend --reuse-message=HEAD
[init]
defaultBranch = main

View file

@ -1,4 +0,0 @@
{
"suggest.noselect": false,
"suggest.enablePreselect": true
}

View file

@ -1,84 +0,0 @@
call plug#begin()
Plug 'semanser/vim-outdated-plugins'
" Show trailing whitespaces (this could also easily be achieved by settings,
" but the plugin is very neat)
Plug 'ntpeters/vim-better-whitespace'
Plug 'vim-airline/vim-airline'
Plug 'w0rp/ale'
Plug 'AndrewRadev/bufferize.vim'
Plug 'airblade/vim-gitgutter'
Plug 'hashivim/vim-terraform'
Plug 'tpope/vim-fugitive'
Plug 'tpope/vim-rhubarb'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
"Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
call plug#end()
"lua require'nvim-treesitter.configs'.setup{highlight={enable=true}}
" Explicitely set legacy colorscheme to overwrite the new neovim default
" colorscheme until I find the time to configure colors properly
colorscheme vim
set notermguicolors
" Add a set of commands that will make the 80th column of a document visible
highlight ColorColumn ctermbg=244 guibg=lightgrey
command Col let &colorcolumn=join(range(81,100),",")
command NoCol set colorcolumn=
Col
" Disable line wrapping and use some Unicode characters to signify overflow
" instead. This might obviously cause problems. Also make tabs and
" non-breaking spaces visible. Tab visibility may be toggled using ShowTabs
" and HideTabs.
set nowrap
set list
set showbreak=
set listchars=tab:╾─,extends:❱,precedes:❰,nbsp:␣
command ShowTabs set listchars-=tab:\ \
command HideTabs set listchars+=tab:\ \
set sidescroll=1
set sidescrolloff=8
set scrolloff=2
" Tweak the neovim popup-style(pum) wildmenu for file selection. Slightly
" alter the behaviour when you press the tab key and rotate the axis of the
" arrow keys. https://vi.stackexchange.com/a/22628
" FIXME: Pressing left during file selection moves up 2 levels in the dir
" tree. This is a problem with the wildmenu file selector in general.
set wildmode=longest:full,full
set wildcharm=<C-z>
cnoremap <expr> <down> wildmenumode() ? "\<C-n>" : "\<down>"
cnoremap <expr> <up> wildmenumode() ? "\<C-p>" : "\<up>"
cnoremap <expr> <left> wildmenumode() ? "\<up>" : "\<left>"
cnoremap <expr> <right> wildmenumode() ? " \<bs>\<C-z>" : "\<right>"
" Rebind Redo to U
nnoremap U <C-r>
" Classic
set number
set nofoldenable
" If this is not set, neovim will hide tabs instead of closing them, resulting
" in errors if you close a file as tab in one vim instance and subsecuently
" try to open it in another instance. I have not checked if this has other
" side effects.
set nohidden
" Yaml Indent
autocmd BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml foldmethod=indent
autocmd FileType yaml setlocal ts=2 sts=2 sw=2 expandtab indentkeys-=0# indentkeys-=<:>
" Treat .hcl files like terraform files (used by hashivim/vim-terraform)
autocmd BufNewFile,BufReadPost *.hcl set filetype=terraform
" Overwrite airblade/vim-gitgutter highlight colors.
" https://vi.stackexchange.com/questions/10897/how-do-i-customize-vimdiff-colors
hi DiffAdd gui=none guifg=NONE guibg=#bada9f
hi DiffChange gui=none guifg=NONE guibg=#e5d5ac
hi DiffDelete gui=bold guifg=#ff8080 guibg=#ffb0b0
hi DiffText gui=none guifg=NONE guibg=#8cbee2

View file

@ -1,25 +0,0 @@
function autosource {
local zsh_function_dirs zsh_function_dir
# Check for required argument
if (( $# == 0 )); then
echo "autosource: basename of a file in ZSH_FUNC_PATH required"
echo "autosource: usage: autosource basename [arguments]"
return 1
fi
# Split ZSH_FUNC_PATH into an array
IFS=':' read -rA zsh_function_dirs <<< "${ZSH_FUNC_PATH}"
# Search each dir for a matching .zsh file
for zsh_function_dir in "${zsh_function_dirs[@]}"; do
if [[ -r "${zsh_function_dir}/${1}.zsh" ]]; then
source "${zsh_function_dir}/${1}.zsh" "${@:2}"
return
fi
done
echo "autosource: no ${1} in (${ZSH_FUNC_PATH})"
return 1
}

View file

@ -1 +0,0 @@
echo test autosourced

View file

@ -1,3 +0,0 @@
NAS_IP="127.0.0.1"
NAS_USER="janolehuebner"
NAS_TOKEN_NAME_IN_STORE="sudo-lana"

View file

@ -1,4 +0,0 @@
DOTFILES_ACTIVE=true
DOTFILES_DIR="${HOME}/.dotfiles"
DOTFILES_GITDIR="${HOME}/.dotgit"
ZSH_FUNC_PATH="${HOME}/.zsh_functions:${DOTFILES_DIR}/.zsh_functions"

View file

@ -1,4 +0,0 @@
GIT_AUTHOR_NAME=""
GIT_AUTHOR_EMAIL=""
GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME
GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL

View file

@ -1,5 +0,0 @@
insta_share_on_nas="192....../DATA"
insta_path_on_nas="social/insta"
insta_cookiefile=""
insta_mount_point="$HOME/NAS/insta"
insta_default_users=(user_a user_b)

View file

@ -1,10 +0,0 @@
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.cargo/bin:$PATH"
export PATH="$HOME/bin:$PATH"
if uname -r | grep -qi "truenas"; then
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
elif [[ "$OSTYPE" == darwin* ]]; then
export PATH="/opt/homebrew/bin:$PATH"
export PATH="$HOME/Library/Python/3.9/bin:$PATH"
fi

View file

@ -1,2 +0,0 @@
TUBE_TOKEN_NAME_IN_STORE="tube.lan"
TUBE_DEFAULT_USERS=("a" "b")

1
.gitignore vendored
View file

@ -10,4 +10,3 @@ public/
dev/
keyfile.keyx
*.log
.environment.d/01_nas.env

View file

@ -1,8 +1,15 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
export PATH="$PATH:$HOME/.local/bin:$HOME/bin"
# ── 2. Load .env files from ~/.environment.d/ ───────────────────
# Automatically export all variables defined while sourcing .env files
setopt allexport
for file in ~/.environment.d/*.env(.N); do
source "$file"
done
unset file
unsetopt allexport
# ── 3. Source ~/.zshrc (if this is a login shell sourcing a profile file) ─
# In Zsh, this is unnecessary in most setups unless you separate login/init logic.
[[ -r ~/.zshrc ]] && source ~/.zshrc

View file

@ -1,111 +0,0 @@
if ! typeset -f ytr >/dev/null; then
export PATH="$PATH:$HOME/.local/bin:$HOME/bin"
# ── 2. Load .env files from ~/.environment.d/ ───────────────────
# Automatically export all variables defined while sourcing .env files
setopt allexport
for file in ~/.environment.d/*.env(.N); do
source "$file"
done
unset file
unsetopt allexport
# Load a function that allows us to import other function definitions from
# the ZSH_FUNC_PATH without providing their exact location
source "$DOTFILES_DIR/.zsh_functions/autosource.sh"
# Load the rest of the zsh configs in ~/.zshrc.d/
setopt allexport
for file in ~/.zshrc.d/*.zsh(.N); do
source "$file"
done
source ~/.zsh_functions/youtube.zsh
fi
mdl () {
cwd=$(pwd)
share_on_nas="$NAS_IP/media"
path_on_nas="Music/__INBOX"
jelly_wait=150
check_smb_mount() {
mount | grep -q "$mount_point"
}
mount_point="$HOME/NAS/Music"
if [ ! -d "$mount_point" ]; then
echo "Creating mount point directory..."
mkdir -p "$mount_point"
fi
if ! check_smb_mount; then
echo "Mounting SMB share..."
/sbin/mount_smbfs "smb://janolehuebner:$(pass sudo-lana)@$share_on_nas" "$mount_point"
fi
if ! check_smb_mount; then
echo "Failed to mount SMB share. Exiting."
exit 1
fi
# Move to target directory
cd "$mount_point/$path_on_nas"
echo "SMB share mounted successfully."
if [[ "$*" == *"tidal.com"* ]]; then
echo "TIDAL DETECTED"
uvx tidal-dl -l $*
else
echo "Using qobuz-dl via uvx at: $(which uvx)"
echo "QOBUZ URL: $*"
uvx qobuz-dl dl $*
fi
echo "Unmounting SMB share..."
sleep 1
/sbin/umount -f "$mount_point"
cd $cwd
#if declare -f jelly_rescan > /dev/null; then
# echo "Waiting $jelly_wait secs before triggering automatic library scan..."
# sleep $jelly_wait
# jelly_rescan
# echo "done"
#fi
}
d () {
local url="${1:-$(pbpaste)}"
local used_clipboard=0
if [[ -z "$url" ]]; then
echo "No URL provided and clipboard is empty."
return 1
fi
# Check if URL came from clipboard
if [[ -z "$1" ]]; then
echo "started via clipboard"
used_clipboard=1
fi
case "$url" in
(*youtube*|*youtu.be*)
echo "Detected YouTube URL: $url"
ytr "$url"
;;
(*qobuz*)
echo "Detected Qobuz URL: $url"
mdl "$url"
if [[ $used_clipboard -eq 1 ]]; then
osascript -e "display dialog \"Done with Qobuz: $url\" buttons {\"OK\"}"
fi
;;
(*)
echo "Unknown URL: $url"
;;
esac
}

View file

@ -1,76 +0,0 @@
insta () {
local cwd=$(pwd)
check_smb_mount () {
/sbin/mount | grep -q "$insta_mount_point"
}
local stories_only=false
local user_list=()
while [[ $# -gt 0 ]]
do
case "$1" in
--cron)
local random_wait=$((RANDOM % 1800))
echo "--------------------------------------------"
echo "Waiting for $((random_wait / 60)) minutes..."
sleep $random_wait
stories_only=true
;;
--stories)
stories_only=true
;;
*)
user_list+=("$1")
;;
esac
shift
done
echo "-----$(date)------"
local is_local_nas=false
if [[ "$NAS_IP" == "127.0.0.1" || "$NAS_IP" == "localhost" ]]; then
is_local_nas=true
fi
if [ ! -d "$insta_mount_point" ]; then
echo "Creating mount point directory..."
mkdir -p "$insta_mount_point"
fi
if ! $is_local_nas; then
if ! check_smb_mount; then
echo "Mounting SMB share..."
/sbin/mount_smbfs "smb://janolehuebner:$(pass sudo-lana 2>/dev/null)@$insta_share_on_nas" "$insta_mount_point"
fi
if ! check_smb_mount; then
echo "Failed to mount SMB share. Exiting."
return 1
fi
fi
cd "$insta_mount_point/$insta_path_on_nas" || return 1
if [[ ${#user_list[@]} -eq 0 ]]; then
user_list=("${insta_default_users[@]}")
fi
#local cmd=(uvx --with browser_cookie3 instaloader -b Firefox -B '/Users/janolehuebner/Library/Application Support/zen/Profiles/frbi8zqc.insta/cookies.sqlite' "${user_list[@]}" --fast-update --abort-on=302,400,401,429)
local cmd=(uvx --with browser_cookie3 instaloader -b Safari "${user_list[@]}" --fast-update --abort-on=302,400,401,429)
if $stories_only; then
cmd+=(--stories --no-profile-pic --no-posts)
else
cmd+=(--stories --reels)
fi
"${cmd[@]}"
if ! $is_local_nas; then
echo "Unmounting SMB share..."
sleep 3
/sbin/umount -f "$insta_mount_point"
fi
cd "$cwd"
}

View file

@ -1,6 +0,0 @@
jelly_rescan(){
JELLYFIN_URL="http://$NAS_IP:8096"
API_KEY="$(pass jelly)"
LIBRARY_ID="8a05b0252259a1dbd62df97522638439"
curl -X POST -H "X-Emby-Token: $API_KEY" "$JELLYFIN_URL/Items/$LIBRARY_ID/Refresh?Recursive=true"
}

View file

@ -29,7 +29,7 @@ ytr () {
return 1
fi
local token="$(pass $TUBE_TOKEN_NAME_IN_STORE 2>/dev/null)"
local token="$(pass $TUBE_TOKEN_NAME_IN_STORE)"
local json_data=$(jq -n --arg youtube_id "$youtube_id" '{
data: [
{
@ -58,7 +58,7 @@ yts() {
fi
# Set the token and URL
local token="$(pass $TUBE_TOKEN_NAME_IN_STORE 2>/dev/null)"
local token="$(pass $TUBE_TOKEN_NAME_IN_STORE)"
# Initialize an empty array to store video data
local video_data="[]"
@ -66,8 +66,8 @@ yts() {
# Get the video IDs from yt-dlp and loop through each one
while read -r youtube_id; do
# Add each video ID to the array of data (accumulating in $video_data)
video_data=$(echo "$video_data" | jq --arg youtube_id "$youtube_id" '. + [{youtube_id: $youtube_id, status: "pending"}]')
done < <(uvx yt-dlp "https://www.youtube.com/@$1/shorts" --flat-playlist --print "%(id)s")
video_data=$(echo "$video_data" | jq --arg youtube_id "$youtube_id" '. + [{youtube_id: $youtube_id, status: "priority"}]')
done < <(yt-dlp "https://www.youtube.com/@$1/shorts" --flat-playlist --print "%(id)s")
# Check if video_data is still an empty array (meaning no videos were found)
if [[ "$video_data" == "[]" ]]; then
@ -90,7 +90,13 @@ yts() {
#
check_shorts() {
channels=("${TUBE_DEFAULT_USERS[@]}")
# List of channels to check (you can hardcode them or pass them as arguments)
channels=(
"DarkBlondii"
"littlesiha"
"lenaindica"
)
# Loop through each channel and call yts
for channel in "${channels[@]}"; do
echo "Checking shorts for channel: $channel"

36
.zshrc
View file

@ -1,36 +0,0 @@
export PATH="$PATH:$HOME/.local/bin:$HOME/bin"
# ── 2. Load .env files from ~/.environment.d/ ───────────────────
# Automatically export all variables defined while sourcing .env files
setopt allexport
for file in ~/.environment.d/*.env(.N); do
source "$file"
done
unset file
unsetopt allexport
# Load a function that allows us to import other function definitions from
# the ZSH_FUNC_PATH without providing their exact location
source "$DOTFILES_DIR/.zsh_functions/autosource.sh"
# Load the rest of the zsh configs in ~/.zshrc.d/
setopt allexport
for file in ~/.zshrc.d/*.zsh(.N); do
source "$file"
done
unset file
unsetopt allexport
autosource insta
autosource youtube
autosource milan
autosource nas
autosource fuck
autosource download
autosource jellyfin
eval "$(zoxide init --cmd cd zsh)"

View file

@ -1,9 +0,0 @@
# Aliases
alias vim="nvim"
alias vi="nvim"
alias nano="nvim"
alias tg="terragrunt"
alias tf="tofu"
alias terraform="tofu"
alias dotfiles="git --work-tree=$HOME --git-dir=$HOME/.dotgit "
alias instaloader="uvx --with browser_cookie3 instaloader"

View file

@ -1,61 +0,0 @@
install_dotfiles () {
echo "Installing stuff..."
# vim-plug
if ! [[ -f ~/.local/share/nvim/site/autoload/plug.vim ]]; then
echo "Dotfiles: Downloading vim-plug..."
if curl \
--fail \
--location \
--retry 5 \
--retry-delay 1 \
--create-dirs \
--progress-bar \
--output ~/.local/share/nvim/site/autoload/plug.vim \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
then
echo "Dotfiles: Done"
else
echo "Dotfiles: Error downloading vim-plug"
dotfiles_install_error="yes"
fi
fi
if [[ ! -d ~/.oh-my-zsh ]]; then
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended --keep-zshrc
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $HOME/.oh-my-zsh/themes/powerlevel10k
fi
# Path to Brewfile
BREWFILE="$HOME/.Brewfile"
if ! command -v brew &>/dev/null; then
echo "Homebrew not found. Installing..."
if uname -r | grep -qi "truenas"; then
mkdir $HOME/linuxbrew
sudo ln -s $HOME/linuxbrew /home/linuxbrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
#----uv
command -v uv >/dev/null 2>&1 || curl -LsSf https://astral.sh/uv/install.sh | sh
#
if [[ "$OSTYPE" == "darwin"* ]]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
if [[ -f "$BREWFILE" ]]; then
echo "Installing from Brewfile: $BREWFILE"
brew bundle --file="$BREWFILE"
else
echo "No Brewfile found at $BREWFILE"
fi
fi
fi
}

View file

@ -1,112 +0,0 @@
# Enable Powerlevel10k instant prompt. Should stay close to the top of ~/.zshrc.
# Initialization code that may require console input (password prompts, [y/n]
# confirmations, etc.) must go above this block; everything else may go below.
if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then
source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh"
fi
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="$HOME/.oh-my-zsh"
#------
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="powerlevel10k/powerlevel10k"
# Set list of themes to pick from when loading at random
# Setting this variable when ZSH_THEME=random will cause zsh to load
# a theme from this variable instead of looking in $ZSH/themes/
# If set to an empty array, this variable will have no effect.
# ZSH_THEME_RANDOM_CANDIDATES=( "robbyrussell" "agnoster" )
# Uncomment the following line to use case-sensitive completion.
# CASE_SENSITIVE="true"
# Uncomment the following line to use hyphen-insensitive completion.
# Case-sensitive completion must be off. _ and - will be interchangeable.
# HYPHEN_INSENSITIVE="true"
# Uncomment one of the following lines to change the auto-update behavior
# zstyle ':omz:update' mode disabled # disable automatic updates
# zstyle ':omz:update' mode auto # update automatically without asking
# zstyle ':omz:update' mode reminder # just remind me to update when it's time
# Uncomment the following line to change how often to auto-update (in days).
# zstyle ':omz:update' frequency 13
# Uncomment the following line if pasting URLs and other text is messed up.
# DISABLE_MAGIC_FUNCTIONS="true"
# Uncomment the following line to disable colors in ls.
# DISABLE_LS_COLORS="true"
# Uncomment the following line to disable auto-setting terminal title.
# DISABLE_AUTO_TITLE="true"
# Uncomment the following line to enable command auto-correction.
# ENABLE_CORRECTION="true"
# Uncomment the following line to display red dots whilst waiting for completion.
# You can also set it to another string to have that shown instead of the default red dots.
# e.g. COMPLETION_WAITING_DOTS="%F{yellow}waiting...%f"
# Caution: this setting can cause issues with multiline prompts in zsh < 5.7.1 (see #5765)
# COMPLETION_WAITING_DOTS="true"
# Uncomment the following line if you want to disable marking untracked files
# under VCS as dirty. This makes repository status check for large repositories
# much, much faster.
# DISABLE_UNTRACKED_FILES_DIRTY="true"
# Uncomment the following line if you want to change the command execution time
# stamp shown in the history command output.
# You can set one of the optional three formats:
# "mm/dd/yyyy"|"dd.mm.yyyy"|"yyyy-mm-dd"
# or set a custom format using the strftime function format specifications,
# see 'man strftime' for details.
# HIST_STAMPS="mm/dd/yyyy"
# Would you like to use another custom folder than $ZSH/custom?
# ZSH_CUSTOM=/path/to/new-custom-folder
# Which plugins would you like to load?
# Standard plugins can be found in $ZSH/plugins/
# Custom plugins may be added to $ZSH_CUSTOM/plugins/
# Example format: plugins=(rails git textmate ruby lighthouse)
# Add wisely, as too many plugins slow down shell startup.
plugins=(git)
source $ZSH/oh-my-zsh.sh
# User configuration
# export MANPATH="/usr/local/man:$MANPATH"
# You may need to manually set your language environment
# export LANG=en_US.UTF-8
# Preferred editor for local and remote sessions
# if [[ -n $SSH_CONNECTION ]]; then
# export EDITOR='vim'
# else
# export EDITOR='mvim'
# fi
# Compilation flags
# export ARCHFLAGS="-arch x86_64"
# Set personal aliases, overriding those provided by oh-my-zsh libs,
# plugins, and themes. Aliases can be placed here, though oh-my-zsh
# users are encouraged to define aliases within the ZSH_CUSTOM folder.
# For a full list of active aliases, run `alias`.
#
# Example aliases
# alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh"
# To customize prompt, run `p10k configure` or edit ~/.p10k.zsh.
[[ ! -f ~/.p10k.zsh ]] || source ~/.p10k.zsh