Changed files to templates

This commit is contained in:
Sebastian 2024-08-31 00:03:57 +02:00
parent d8103b5a0f
commit b7af0f9e53
7 changed files with 141 additions and 17 deletions

View file

@ -3,9 +3,9 @@
############# Packages to install ######################################## ############# Packages to install ########################################
macos_homebrew_essentials="python3 vim-nox tmux nano zsh git autossh mosh sshuttle lynx npm tidy mcfly ack ncdu" macos_homebrew_essentials="python3 vim-nox tmux nano zsh git autossh mosh sshuttle lynx npm tidy mcfly ack ncdu shfmt"
macos_homebrew_other_apps="calibre" macos_homebrew_other_apps="calibre"
raspberrypi_essentials="python3 python3-pip vim-nox python3-venv tmux nano zsh git htop ncdu autossh mosh sshuttle fail2ban avahi-daemon ufw lynx npm ssmtp apticron tidy nmon software-properties-common ack restic unrar" raspberrypi_essentials="python3 python3-pip vim-nox python3-venv tmux nano zsh git htop ncdu autossh mosh sshuttle fail2ban avahi-daemon ufw lynx npm ssmtp apticron tidy nmon software-properties-common ack restic unrar cmake"
raspberrypi_printer="cups printer-driver-gutenprint" raspberrypi_printer="cups printer-driver-gutenprint"
raspberrypi_camera="python3-opencv" raspberrypi_camera="python3-opencv"
@ -18,8 +18,8 @@ install_python_linters() {
} }
install_npm_linters() { install_npm_linters() {
npm install -g jsonlint sudo npm install -g jsonlint
npm install -g fixjson sudo npm install -g fixjson
} }
############# MacOS exclusive commands ################################### ############# MacOS exclusive commands ###################################
@ -69,7 +69,12 @@ if [ "$system_type" = "Linux" ]; then
if [ -n "$install_this_now" ]; then if [ -n "$install_this_now" ]; then
echo "Packages will be installed now!" echo "Packages will be installed now!"
sudo apt update && sudo apt install $install_this_now sudo apt update
for i in $install_this_now; do
sudo apt-get install -y $i
done
fi fi
fi fi

View file

@ -1,4 +1,3 @@
# run: git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# Auto install if not present # Auto install if not present
if "test ! -d ~/.tmux/plugins/tpm" \ if "test ! -d ~/.tmux/plugins/tpm" \
@ -10,14 +9,20 @@ set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-net-speed' set -g @plugin 'tmux-plugins/tmux-net-speed'
set -g @plugin 'tmux-plugins/tmux-resurrect' set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'tmux-plugins/tmux-continuum' set -g @plugin 'tmux-plugins/tmux-continuum'
set -g @resurrect-capture-pane-contents 'on' set -g @resurrect-capture-pane-contents 'on'
{% if yadm.os == "Darwin" %}
set -g @plugin 'tmux-plugins/tmux-battery'
{% endif %}
# Settings # Settings
set -g status-right "#{battery_status_bg} Batt: #{battery_percentage} | %H:%M" {% if yadm.os == "Darwin" %}
set -g status-right "#{battery_status_bg} Batt: #{battery_percentage} #{battery_remain}"
{% else %}
set -g status-right "#{net_speed} | %H:%M"
{% endif %}
set-option -g default-shell /bin/zsh # default shell set-option -g default-shell /bin/zsh # default shell
set -g default-terminal "screen-256color" set -g default-terminal "screen-256color"
setw -g mode-keys vi setw -g mode-keys vi

View file

@ -479,6 +479,10 @@ nmap <silent> <leader>g <Plug>(coc-definition)
" Don't hide stuff in tex files like \textbf{} " Don't hide stuff in tex files like \textbf{}
let g:tex_conceal="" let g:tex_conceal=""
" Load local config if there is one " Load local config if there is one
if filereadable($HOME . "/.vimrc.local") if filereadable($HOME . "/.vimrc.local")
source ~/.vimrc.local source ~/.vimrc.local

22
.zshrc
View file

@ -1,5 +1,6 @@
if [ -f ~/.bash_profile ]; then # Import from bash
source ~/.bash_profile; if [ -f $HOME/.bash_profile ]; then
source $HOME/.bash_profile;
fi fi
@ -34,12 +35,6 @@ _load_settings() {
} }
_load_settings "$HOME/.zsh/configs" _load_settings "$HOME/.zsh/configs"
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
# aliases
[[ -f ~/.aliases ]] && source ~/.aliases
# Save history # Save history
SAVEHIST=3000 SAVEHIST=3000
@ -77,3 +72,14 @@ zstyle ':completion:*' rehash true # Find new executables for autcompletion
stty -ixon # Ignore and pass through ctrl-s and ctrl-q as normal input (quicksave bin for vim) stty -ixon # Ignore and pass through ctrl-s and ctrl-q as normal input (quicksave bin for vim)
# Aliases
[[ -f ~/.aliases ]] && source ~/.aliases
alias venv-source="source ./venv/bin/activate"
alias tex-to-pdf="latexmk -pdf "
PATH="$HOME/bin:$PATH"
# Local config
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local

10
.zshrc.local##os.Darwin Normal file
View file

@ -0,0 +1,10 @@
# mcfly settings
eval "$(mcfly init zsh)"
export MCFLY_LIGHT=TRUE
# export MCFLY_KEY_SCHEME=vim
export MCFLY_FUZZY=2
export MCFLY_RESULTS=50
export MCFLY_RESULTS_SORT=LAST_RUN
export PATH="/usr/local/opt/openjdk/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"

3
.zshrc.local##os.Linux Normal file
View file

@ -0,0 +1,3 @@
# Aliases
alias wifi-setup="sudo nmtui"

91
bin/venv-new Executable file
View file

@ -0,0 +1,91 @@
#!/bin/sh
# Warn if still in a venv
if [ -n "$VIRTUAL_ENV" ]; then
echo "The current venv is still active! Run deactivate first!"
exit 1
fi
python_versions=""
for dir in $(echo "$PATH" | tr ':' ' '); do
for version in "$dir"/python3.[0-9]*; do
# Überprüfe, ob die Datei tatsächlich existiert (falls kein Treffer, wird $version auf "$dir/python3.[0-9]*" gesetzt)
if [ -e "$version" ]; then
# Überprüfe, ob die Datei existiert und ausführbar ist
if [ -x "$version" ] && "$version" --version >/dev/null 2>&1; then
python_versions="$python_versions $version"
fi
fi
done
done
if [ -z "$python_versions" ]; then
echo "No Python3 versions found."
exit 1
fi
# Entferne Duplikate und sortiere die Python-Versionen
python_versions=$(echo "$python_versions" | tr ' ' '\n' | sort -u -r | tr '\n' ' ')
# Nummerierte Liste der Python-Versionen anzeigen
echo "Installed Python3 versions:"
i=1
for version in $python_versions; do
echo "$i) $(basename "$version")"
i=$((i + 1))
done
# Benutzer nach der Auswahl fragen
echo "Select the number of the Python version you want to use:"
read user_choice
if [ -z "$user_choice" ]; then
user_choice=1
fi
# Überprüfen, ob die Eingabe eine Zahl ist
if echo "$user_choice" | grep -qE '^[0-9]+$'; then
i=1
for version in $python_versions; do
if [ "$i" -eq "$user_choice" ]; then
python_version=$(basename "$version")
break
fi
i=$((i + 1))
done
# Überprüfen, ob eine gültige Auswahl getroffen wurde
if [ -n "$python_version" ]; then
echo "You selected: $version"
else
echo "Invalid selection."
exit 1
fi
else
echo "Please enter a valid number."
exit 1
fi
# Additional parameter
additional_parameters="--upgrade-deps --clear"
echo "Should the venv have access to the system packages? (y/n)"
read -r add_system_packages
if [ "$add_system_packages" = "y" ]; then
additional_parameters="$additional_parameters --system-site-packages"
fi
# Create venv
$version -m venv venv $additional_parameters
source ./venv/bin/activate
# Install requirements.txt
echo "Install packages from requirements.txt? (y/n)"
read -r install_requirements_txt
if [ "$install_requirements_txt" = "y" ]; then
python3 -m pip install -r requirements.txt
fi