Skip to content
2 changes: 1 addition & 1 deletion config/zsh/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
antibody bundle < ~/dev/dotfiles/config/antibody/plugins.txt > ~/dev/dotfiles/config/antibody/plugins.zsh
source ~/dev/dotfiles/config/antibody/plugins.zsh

for file in ~/dev/dotfiles/config/zsh/*.zsh; do source $file; done
for file in ~/dev/dotfiles/config/zsh/*.zsh; do source $file; done
1 change: 1 addition & 0 deletions config/zsh/alias.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ alias ca='convert_audio_flac_to_aac_vbr_5'
alias cdf='cd_to_current_finder_window'
alias gh='git_open_repo_in_browser'
alias j='z'
alias sj='java_version_selection'
alias mi='mediainfo'
alias mkd='create_dir_and_cd_to_it'
alias update='update_all_and_cleanup'
Expand Down
11 changes: 7 additions & 4 deletions config/zsh/env.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
# VARIABLES
export EDITOR='code'
export VISUAL='nano' # set to nano to edit crontabs
export JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_202.jdk/Contents/Home"
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
export TERM="xterm-256color"
export USER_PATH="/Users/saltukkezer"
export DOTFILES_PATH="$USER_PATH/dev/dotfiles"

# PATHS
# Set ruby installed by Homebrew first in your PATH
Expand All @@ -14,7 +16,8 @@ export PATH="${PATH}:/usr/local/opt/findutils/libexec/gnubin"
export PATH="${PATH}:/usr/local/opt/grep/libexec/gnubin"
export PATH="${PATH}:/usr/local/opt/bc/bin"
export PATH="${PATH}:/usr/local/opt/fzf/bin"
export PATH="${PATH}:/Users/longdo/.gem/ruby/2.7.0/bin"
export PATH="${PATH}:/Users/longdo/.local/bin"
export PATH="${PATH}:/Users/longdo/repos/flutter/bin"
export PATH="${PATH}:$USER_PATH/.gem/ruby/3.0.0/bin"
export PATH="${PATH}:$USER_PATH/.local/bin"
export PATH="${PATH}:$USER_PATH/repos/flutter/bin"
export PATH="$HOME/.jenv/bin:$PATH"
export PATH=$JAVA_HOME/bin:$PATH
16 changes: 14 additions & 2 deletions config/zsh/functions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,18 @@ function open_arg_in_vs_code {
open -a "Visual Studio Code" "$argPath"
}

function java_environment_change() {
export JAVA_HOME=$(/usr/libexec/java_home -v $argv)
export PATH=$JAVA_HOME/bin:$PATH
launchctl setenv JAVA_HOME $JAVA_HOME
java -version
}

function java_version_selection() {
_selected=$(/usr/libexec/java_home -V 2>&1 | grep -Eo "\d+.\d.\d" | fzf +m)
java_environment_change $_selected
}

# Open File in vscode
of() {
local file
Expand Down Expand Up @@ -94,12 +106,12 @@ jj() {

# CTRL-X
fzf-script-launcher() {
SCRIPTS_PATH='/Users/longdo/dev/dotfiles/scripts/'
SCRIPTS_PATH="$DOTFILES_PATH/scripts/"

allfiles=$(rg -t sh --files $SCRIPTS_PATH)
# filteredfiles=$(echo $allfiles | grep -v "_templates/\|setup/")
# cutpaths=$(echo $filteredfiles | cut -c 36-)
cutpaths=$(echo $allfiles | cut -c 36-)
cutpaths=$(echo $allfiles | cut -c $(( ${#SCRIPTS_PATH} + 1 ))-)

local selected
if selected=$(echo $cutpaths | fzf --height 40% --preview "bat --style=grid --color=always '$SCRIPTS_PATH{}'" -q "$LBUFFER"); then
Expand Down
8 changes: 4 additions & 4 deletions scripts/brew/brew-cask.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
# [I]nstall/[U]ninstall brew casks or open the [H]omepage of the app
# > Confirm with <Enter>

_cask=$(brew search --casks | fzf-tmux --query="$1" +m --preview 'brew cask info {}')
_cask=$(brew casks | tail -n +2 | fzf-tmux --query="$1" +m --preview 'brew info --cask {}')

if [ "x$_cask" != "x" ]; then
echo "(I)nstall, (U)ninstall or open the (h)omepage of $_cask"
read -r input
if [ "$input" = "i" ] || [ "$input" = "I" ]; then
brew cask install "$_cask"
brew install --cask "$_cask"
fi
if [ "$input" = "u" ] || [ "$input" = "U" ]; then
brew cask uninstall "$_cask"
brew uninstall --cask "$_cask"
fi
if [ "$input" = "h" ] || [ "$input" = "H" ]; then
brew cask home "$_cask"
brew home --cask "$_cask"
fi
fi
2 changes: 1 addition & 1 deletion scripts/brew/brew-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# > Select files with <Tab>
# > Confirm with <Enter>

_selected=$(brew search | fzf -m)
_selected=$(brew formulae | fzf -m)

if [[ $_selected ]]; then
for brew in $_selected; do
Expand Down
4 changes: 2 additions & 2 deletions scripts/chmod-x-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# Log Helper
_ok() { echo -e "\033[32m[OK]\033[0m $1" ; }

_SCRIPTS_PATH='/Users/longdo/dev/dotfiles/scripts/'
_SCRIPTS_PATH="$DOTFILES_PATH/scripts/"

for script in $(rg -t sh --files $_SCRIPTS_PATH); do
for script in $(rg -t sh --files "$_SCRIPTS_PATH"); do
[[ $(stat -f "%OLp" "$script") == '644' ]] && chmod +x "$script" && _ok "$script"
done
12 changes: 6 additions & 6 deletions scripts/daily/_cronjob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Script which is running daily with crontab
#
# > Add following line to crontab:
# 30 23 * * * /Users/longdo/dev/dotfiles/scripts/daily/_cronjob.sh >/tmp/stdout.log 2>/tmp/stderr.log
# 30 23 * * * $DOTFILES_PATH/scripts/daily/_cronjob.sh >/tmp/stdout.log 2>/tmp/stderr.log

export PATH='/usr/local/opt/ruby/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/longdo/.local/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/bc/bin:/usr/local/opt/fzf/bin:/Users/longdo/.gem/ruby/2.7.0/bin:/Users/longdo/.local/bin'
export PATH="/usr/local/opt/ruby/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$USER_PATH/.local/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/bc/bin:/usr/local/opt/fzf/bin:$USER_PATH/.gem/ruby/3.0.0/bin:$USER_PATH/.local/bin"

# Log Helper
_info() { echo -e "\033[33m[INFO]\033[0m $1" ; }
Expand All @@ -14,15 +14,15 @@ date

_info "Running backup.sh"
# Answer every mackup prompt for overwriting with 'yes' when running backup.sh
yes | /Users/longdo/dev/dotfiles/scripts/daily/backup.sh
"$DOTFILES_PATH"/scripts/daily/backup.sh

_info "Running update.sh"
/Users/longdo/dev/dotfiles/scripts/daily/update.sh
"$DOTFILES_PATH"/scripts/daily/update.sh

_info "Running cleanup.sh"
/Users/longdo/dev/dotfiles/scripts/daily/cleanup.sh
"$DOTFILES_PATH"/scripts/daily/cleanup.sh

_info "Running rebuild-github-pages.sh"
/Users/longdo/dev/dotfiles/scripts/daily/rebuild-github-pages.sh
"$DOTFILES_PATH"/scripts/daily/rebuild-github-pages.sh

# TODO send mail on error log
2 changes: 1 addition & 1 deletion scripts/daily/rebuild-github-pages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
_ok() { echo -e "\033[32m[OK]\033[0m $1" ; }

# Load GITHUB_TOKEN from .env
export "$(grep -E -v '^#' "/Users/longdo/dev/dotfiles/.env" | xargs)"
export "$(grep -E -v '^#' "$DOTFILES_PATH.env" | xargs)"

# Declare repositories, where new build should be triggered
declare -a _repositories=("longpdo.github.io" "neumorphism")
Expand Down
7 changes: 3 additions & 4 deletions scripts/kodify/kodify.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
from helpers import os_utils
from helpers import mkv_utils


working_dir = os.getcwd()
backup_dir = '/Users/longdo/Downloads/old_macbook/filme/#fertig/#backup/'
mkvmerge_dir = '/Users/longdo/Downloads/old_macbook/filme/#fertig/#mkvmerge/'
output_dir = '/Users/longdo/Downloads/old_macbook/filme/#fertig/#output/'
backup_dir = os.environ['USER_PATH'] + '/Downloads/old_macbook/filme/#fertig/#backup/'
mkvmerge_dir = os.environ['USER_PATH'] + '/Downloads/old_macbook/filme/#fertig/#mkvmerge/'
output_dir = os.environ['USER_PATH'] + '/Downloads/old_macbook/filme/#fertig/#output/'
excluded_dirs = {'#backup', '#mkvmerge', '#output'}


Expand Down
4 changes: 2 additions & 2 deletions scripts/pdf/_cronjob-get-pdfs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
# Script which is running every 30 minutes
#
# > Add following line to crontab:
# */30 * * * * /Users/longdo/dev/dotfiles/scripts/pdf/_cronjob-get-pdfs.sh
# */30 * * * * $DOTFILES_PATH/scripts/pdf/_cronjob-get-pdfs.sh

export PATH='/usr/local/opt/ruby/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/longdo/.local/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/bc/bin:/usr/local/opt/fzf/bin:/Users/longdo/.gem/ruby/2.7.0/bin:/Users/longdo/.local/bin'
export PATH="/usr/local/opt/ruby/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:$USER_PATH/.local/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/bc/bin:/usr/local/opt/fzf/bin:$USER_PATH/.gem/ruby/3.0.0/bin:$USER_PATH/.local/bin"

_PDF_PATH="$HOME/Documents/broker/"
_WATCH_FOLDER_PATH="$HOME/Dropbox/Trade.Republic/"
Expand Down
20 changes: 12 additions & 8 deletions scripts/setup/brew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ _info "Installing antibody..."
curl -sfL git.io/antibody | sh -s - -b /usr/local/bin

_info "Installing the Tomorrow Night theme for iTerm (opening file)"
open "./themes/Dracula.itermcolors" && _ok ""
open "./config/iTerm2/Dracula.itermcolors" && _ok ""

_info "Setting ZSH as the default shell environment"
sudo sh -c "echo $(which zsh) >> /etc/shells"
Expand Down Expand Up @@ -67,6 +67,7 @@ _BINARIES=(
trash
wget
youtube-dl
shellcheck
)
for brew in "${_BINARIES[@]}"; do
_info "installing $brew"
Expand All @@ -90,11 +91,12 @@ for brew in "${_DEV_LIBRARIES[@]}"; do
done

_info "Installing fonts..."
brew cask install font-hack-nerd-font || error "failed installing fonts"
brew install --cask font-hack-nerd-font || error "failed installing fonts"

_info "Installing dev tool casks..."
_DEV_CASKS=(
adoptopenjdk8
adoptopenjdk/openjdk/adoptopenjdk8
adoptopenjdk/openjdk/adoptopenjdk11
chromedriver
insomnia
intellij-idea
Expand All @@ -103,10 +105,12 @@ _DEV_CASKS=(
robo-3t
visual-studio-code
webstorm
docker
postman
)
for cask in "${_DEV_CASKS[@]}"; do
_info "installing $cask"
brew cask install "$cask" || error "failed brew cask install $cask"
brew install --cask "$cask" || error "failed brew install --cask $cask"
done

_info "Installing misc casks..."
Expand Down Expand Up @@ -138,11 +142,11 @@ _MISC_CASKS=(
ticktick
tunnelblick
whatsapp
zoomus
zoom
)
for cask in "${_MISC_CASKS[@]}"; do
_info "installing $cask"
brew cask install "$cask" || error "failed brew cask install $cask"
brew install --cask "$cask" || error "failed brew install --cask $cask"
done

_info "Installing quick look plugins..."
Expand All @@ -156,7 +160,7 @@ _PLUGINS=(
)
for cask in "${_PLUGINS[@]}"; do
_info "installing $cask"
brew cask install "$cask" || error "failed brew cask install $cask"
brew install --cask "$cask" || error "failed brew install $cask"
done

###############################################################################
Expand All @@ -178,7 +182,7 @@ gem install --user-install jekyll || _error "failed gem install jekyll"
# Mac App Store #
###############################################################################
_info "Installing apps from App Store..."
mas install 497799835 || _error "failed mas install Xcode" # Xcode
mas purchase 497799835 || _error "failed mas install Xcode" # Xcode

###############################################################################
# Other apps #
Expand Down
4 changes: 2 additions & 2 deletions scripts/shellcheck-scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Analyse all shell scripts with ShellCheck

_SCRIPTS_PATH='/Users/longdo/dev/dotfiles/scripts/'
_SCRIPTS_PATH="$DOTFILES_PATH/scripts/"

for script in $(rg -t sh --files $_SCRIPTS_PATH); do
for script in $(rg -t sh --files "$_SCRIPTS_PATH"); do
shellcheck "$script"
done