mirror of
https://github.com/JanJastrow/.dotfiles.git
synced 2024-11-22 02:29:57 +01:00
Initial commit
This commit is contained in:
parent
afcbb7f004
commit
8bf8ae5e18
7
ReadMe.md
Normal file
7
ReadMe.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# dotfiles
|
||||||
|
|
||||||
|
## Install
|
||||||
|
|
||||||
|
Clone repo do your user directory.
|
||||||
|
|
||||||
|
```~/.dotfiles```
|
14
install.sh
Executable file
14
install.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
rm ~/.zshrc
|
||||||
|
ln -s ~/.dotfiles/zshrc ~/.zshrc
|
||||||
|
touch ~/.dotfiles/credentials
|
||||||
|
touch ~/.dotfiles/zsh/device-specific
|
||||||
|
sudo chsh -s $(which zsh) $USER
|
||||||
|
echo "Include ~/.dotfiles/ssh/hosts" >> ~/.ssh/config
|
||||||
|
chmod 600 ~/.dotfiles/ssh/hosts
|
||||||
|
chmod 600 ~/.ssh/config
|
||||||
|
rm ~/.bashrc
|
||||||
|
rm ~/.bash_logout
|
||||||
|
rm ~/.bash_history
|
||||||
|
zsh
|
3
ssh/hosts
Normal file
3
ssh/hosts
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Add the following to ~/.ssh/config
|
||||||
|
# Include ~/.dotfiles/ssh/hosts
|
||||||
|
|
20
ssh/settings
Normal file
20
ssh/settings
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# Add the following to ~/.ssh/config
|
||||||
|
# Include ~/.dotfiles/ssh/settings
|
||||||
|
|
||||||
|
host *
|
||||||
|
IdentityFile ~/.ssh/id_ed25519
|
||||||
|
UseKeychain yes
|
||||||
|
AddKeysToAgent yes
|
||||||
|
PubkeyAuthentication yes
|
||||||
|
PasswordAuthentication yes
|
||||||
|
ServerAliveInterval 5
|
||||||
|
ServerAliveCountMax 3
|
||||||
|
ChallengeResponseAuthentication no
|
||||||
|
ForwardX11 no
|
||||||
|
HashKnownHosts yes
|
||||||
|
Compression yes
|
||||||
|
SendEnv LANG LC_*
|
||||||
|
KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256
|
||||||
|
HostKeyAlgorithms ssh-ed25519-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-ed25519,ssh-rsa
|
||||||
|
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr
|
||||||
|
#MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-ripemd160-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,umac-128@openssh.com
|
69
zsh/alias
Normal file
69
zsh/alias
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
#--------------------------------
|
||||||
|
# filename: /zsh/alias
|
||||||
|
#--------------------------------
|
||||||
|
|
||||||
|
# Better LS
|
||||||
|
if [[ $platform == 'Linux' ]]; then
|
||||||
|
alias bls='pwd; ls -lahp --color=auto --group-directories-first'
|
||||||
|
elif [[ $platform == 'macOS' && -x `which gls` ]]; then
|
||||||
|
alias bls='pwd; gls -lahpG --group-directories-first'
|
||||||
|
elif [[ $platform == 'macOS' ]]; then
|
||||||
|
alias bls='/bin/ls -lahG'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Better exa
|
||||||
|
if [[ -x `which exa` ]]; then
|
||||||
|
alias exa='pwd; exa -la --group-directories-first --git -g'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Better lsd
|
||||||
|
if [[ -x `which lsd` ]]; then
|
||||||
|
alias lsd='pwd; lsd -laF --group-dirs=first --icon=never'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Update aliases
|
||||||
|
if [[ -x `which brew` ]]; then
|
||||||
|
alias brewupdate='brew update; brew upgrade; brew upgrade --cask; brew cleanup'
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $platform == 'Linux' ]]; then
|
||||||
|
alias aptupdate='sudo apt update; sudo apt upgrade; sudo apt autoremove; sudo apt autoclean'
|
||||||
|
fi
|
||||||
|
|
||||||
|
# For fun
|
||||||
|
alias fucking='sudo'
|
||||||
|
alias please='sudo'
|
||||||
|
|
||||||
|
# aria2c
|
||||||
|
alias a2='aria2c -x4 -c -m3'
|
||||||
|
|
||||||
|
# screen reconnect/init
|
||||||
|
alias sc='screen -R'
|
||||||
|
|
||||||
|
# Only download mp4 version of youtube
|
||||||
|
alias ytmp4='youtube-dl -f "bestvideo[ext=mp4]+bestaudio[ext=m4a]/mp4"'
|
||||||
|
|
||||||
|
# rsync; archive, progress, partial, relative, humanreadable (add -z for compression)
|
||||||
|
alias rrsync='rsync -avhP'
|
||||||
|
|
||||||
|
# better scp
|
||||||
|
alias bcp='rsync -avzuh --progress --partial'
|
||||||
|
|
||||||
|
# generate pseudo-random hash
|
||||||
|
alias random32="echo $(date +%s | md5sum | head -c 32)"
|
||||||
|
|
||||||
|
# tar
|
||||||
|
alias targz='tar -czvf'
|
||||||
|
alias untargz='tar -xzvf'
|
||||||
|
|
||||||
|
# linux stuff
|
||||||
|
alias journ='journalctl -xfe -t'
|
||||||
|
|
||||||
|
# own this dir (+subs)
|
||||||
|
alias makeitmine='sudo chown -R $(whoami) ./'
|
||||||
|
|
||||||
|
# ---
|
||||||
|
# .dotfiles
|
||||||
|
|
||||||
|
alias dotf='cd ~/.dotfiles'
|
||||||
|
alias dotfu='cd ~/.dotfiles; git pull; cd -; source ~/.zshrc'
|
13
zsh/bindings
Normal file
13
zsh/bindings
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#--------------------------------
|
||||||
|
# filename: /zsh/bindings
|
||||||
|
#--------------------------------
|
||||||
|
|
||||||
|
#if [[ $platform == 'Linux' ]]; then
|
||||||
|
# bindkey "^[[1;5C" forward-word
|
||||||
|
# bindkey "^[[1;5D" backward-word
|
||||||
|
# bindkey "^[[1;5A" history-beginning-search-backward
|
||||||
|
# bindkey "^[[1;5B" history-beginning-search-forward
|
||||||
|
#fi
|
||||||
|
|
||||||
|
bindkey "^[[A" 'history-search-backward'
|
||||||
|
bindkey "^[[B" 'history-search-forward'
|
82
zsh/env
Normal file
82
zsh/env
Normal file
@ -0,0 +1,82 @@
|
|||||||
|
#--------------------------------
|
||||||
|
# filename: /zsh/env
|
||||||
|
#--------------------------------
|
||||||
|
|
||||||
|
# set default editor
|
||||||
|
export EDITOR="nano"
|
||||||
|
|
||||||
|
# set `ll` command - b(etter)ls per default
|
||||||
|
alias ll=bls
|
||||||
|
if [[ -x `which /usr/local/bin/exa` || -x `which /opt/homebrew/bin/exa` ]]; then
|
||||||
|
alias ll=exa
|
||||||
|
fi
|
||||||
|
if [[ -x `which /usr/local/bin/lsd` || -x `which /opt/homebrew/bin/lsd` ]]; then
|
||||||
|
alias ll=lsd
|
||||||
|
fi
|
||||||
|
|
||||||
|
# set language
|
||||||
|
export LANGUAGE=en_US.UTF-8
|
||||||
|
export LC_ALL=en_US.UTF-8
|
||||||
|
export LANG=en_US.UTF-8
|
||||||
|
export LC_TYPE=en_US.UTF-8
|
||||||
|
|
||||||
|
#
|
||||||
|
# Path additions
|
||||||
|
#
|
||||||
|
|
||||||
|
if test -d "/opt/homebrew/"; then
|
||||||
|
export PATH="/opt/homebrew/bin/:$PATH"
|
||||||
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -d "$HOME/go"; then
|
||||||
|
export PATH="$HOME/go/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -d "$HOME/.rbenv"; then
|
||||||
|
export PATH="$HOME/.rbenv/bin:$PATH"
|
||||||
|
eval "$(rbenv init -)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -d "$HOME/.cargo"; then
|
||||||
|
export PATH="$HOME/.cargo/bin:$PATH"
|
||||||
|
eval "$(rbenv init -)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -d "$HOME/.local"; then
|
||||||
|
export PATH="$HOME/.local/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Add syncthing synced binary folder to $PATH
|
||||||
|
if [[ $platform == 'macOS' ]]; then
|
||||||
|
if [[ $arch == 'arm' ]]; then
|
||||||
|
export PATH="$HOME/SyncMac/Apps/bin/arm64:$PATH"
|
||||||
|
export PATH="$HOME/SyncMac/Apps/bin/universal:$PATH"
|
||||||
|
export PATH="$HOME/SyncMac/Apps/bin/x86_64_rosetta2:$PATH"
|
||||||
|
elif [[ $arch == 'i386' ]]; then
|
||||||
|
export PATH="$HOME/SyncMac/Apps/bin/universal:$PATH"
|
||||||
|
export PATH="$HOME/SyncMac/Apps/bin/x86_64:$PATH"
|
||||||
|
export PATH="$HOME/SyncMac/Apps/bin/x86_64_rosetta2:$PATH"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -d "/usr/local/opt/ruby"; then
|
||||||
|
export PATH="/usr/local/opt/ruby/bin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test -d "/usr/local/sbin"; then
|
||||||
|
export PATH="/usr/local/sbin:$PATH"
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# evals
|
||||||
|
#
|
||||||
|
|
||||||
|
# TheFuck
|
||||||
|
if [[ -x `which thefuck` ]]; then
|
||||||
|
eval "$(thefuck --alias)"
|
||||||
|
# You can use whatever you want as an alias, like for Mondays:
|
||||||
|
eval "$(thefuck --alias FUCK)"
|
||||||
|
|
||||||
|
alias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R'
|
||||||
|
fi
|
62
zsh/ffmpeg
Normal file
62
zsh/ffmpeg
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#--------------------------------
|
||||||
|
# filename: /zsh/ffmpeg
|
||||||
|
#--------------------------------
|
||||||
|
|
||||||
|
# ffmpeg-recontainer
|
||||||
|
# source: https://yohanes.gultom.me/2016/05/21/bash-script-to-batch-convert-mkv-to-mp4-linux/
|
||||||
|
function ff-mp4() {
|
||||||
|
findpath=$1
|
||||||
|
: ${findpath:="."}
|
||||||
|
find "$findpath" \( -iname '*.mkv' -o -iname '*.flv' -o -iname '*.mov' \) | while read f ; do
|
||||||
|
dir=$(dirname "$f");
|
||||||
|
file=$(basename "$f");
|
||||||
|
# ext="${filename##*.}";
|
||||||
|
name="${file%.*}";
|
||||||
|
ffmpeg -i "$f" -map 0 -c copy -movflags faststart "$dir/$name.mp4" </dev/null;
|
||||||
|
# rm -f "$f";
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# ffmpeg-convert
|
||||||
|
# source: https://yohanes.gultom.me/2016/05/21/bash-script-to-batch-convert-mkv-to-mp4-linux/
|
||||||
|
function ff-ac3-to-stereo() {
|
||||||
|
findpath=$1
|
||||||
|
: ${findpath:="."}
|
||||||
|
find "$findpath" \( -iname '*.mkv' -o -iname '*.flv' -o -iname '*.mov' -o -iname '*.mp4' \) | while read f ; do
|
||||||
|
dir=$(dirname "$f");
|
||||||
|
file=$(basename "$f");
|
||||||
|
# ext="${filename##*.}";
|
||||||
|
name="${file%.*}";
|
||||||
|
ffmpeg -i "$f" -map 0 -c:v copy -c:a libfdk_aac -b:a 192k -ac 2 -af volume=2 -movflags faststart "$dir/$name.mp4" </dev/null;
|
||||||
|
# rm -f "$f";
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
# ffmpeg audio-to-ac3
|
||||||
|
function ff-input-to-ac3() {
|
||||||
|
ffmpeg -i "$1" -movflags faststart -map 0 -c:v copy -c:s copy -c:a ac3 -b:a 448k "_$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ffmpeg fix 16:9 AR
|
||||||
|
function ff-ar16-9() {
|
||||||
|
ffmpeg -i "$1" -c copy -bsf:v "h264_metadata=sample_aspect_ratio=4/3" -aspect 16:9 -movflags faststart "_$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# ffmpeg fix Non-monotonous DTS
|
||||||
|
function ff-dts() {
|
||||||
|
ffmpeg -fflags +igndts -i "$1" -c copy -movflags faststart "_$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
## ffmpeg wma-to-m4a
|
||||||
|
function ff-wma-m4a() {
|
||||||
|
findpath=$1
|
||||||
|
: ${findpath:="."}
|
||||||
|
find "$findpath" -name '*.wma' | while read f ; do
|
||||||
|
dir=$(dirname "$f");
|
||||||
|
file=$(basename "$f");
|
||||||
|
# ext="${filename##*.}";
|
||||||
|
name="${file%.*}";
|
||||||
|
ffmpeg -i "$f" -map 0 -vn -b:a 160k -c:a libfdk_aac "$dir/$name.m4a" </dev/null;
|
||||||
|
# rm -f "$f";
|
||||||
|
done
|
||||||
|
}
|
36
zsh/scripts
Normal file
36
zsh/scripts
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
#--------------------------------
|
||||||
|
# filename: /zsh/scripts
|
||||||
|
#--------------------------------
|
||||||
|
|
||||||
|
# Search for string in all files in pwd
|
||||||
|
function f() {
|
||||||
|
grep -rnw ./ -e "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
# mkdir and cd
|
||||||
|
function mkcd() {
|
||||||
|
mkdir -p "$@" && cd "$_";
|
||||||
|
}
|
||||||
|
|
||||||
|
# pushover notification
|
||||||
|
function pushover() {
|
||||||
|
curl -s \
|
||||||
|
--form-string "token=$pushover_token" \
|
||||||
|
--form-string "user=$pushover_user" \
|
||||||
|
--form-string "title=$HOST" \
|
||||||
|
--form-string "message=$1" \
|
||||||
|
https://api.pushover.net/1/messages.json
|
||||||
|
}
|
||||||
|
|
||||||
|
# png to jpg 85
|
||||||
|
function png2web() {
|
||||||
|
findpath=$1
|
||||||
|
: ${findpath:="."}
|
||||||
|
find "$findpath" -name '*.png' | while read f ; do
|
||||||
|
dir=$(dirname "$f");
|
||||||
|
file=$(basename "$f");
|
||||||
|
name="${file%.*}";
|
||||||
|
magick convert "$f" pnm:- | cjpeg -progressive -quality 85 > "$dir/$name.jpg" </dev/null
|
||||||
|
rm -f "$f";
|
||||||
|
done
|
||||||
|
}
|
77
zsh/settings
Normal file
77
zsh/settings
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
#--------------------------------
|
||||||
|
# filename: /zsh/settings
|
||||||
|
#--------------------------------
|
||||||
|
|
||||||
|
# Set up the prompt
|
||||||
|
|
||||||
|
# Share shell history between sessions
|
||||||
|
setopt histignorealldups sharehistory
|
||||||
|
|
||||||
|
# Use emacs keybindings even if our EDITOR is set to vi
|
||||||
|
bindkey -e
|
||||||
|
|
||||||
|
# Keep 10000 lines of history within the shell and save it to ~/.dotfiles/zsh/history:
|
||||||
|
HISTSIZE=10000
|
||||||
|
SAVEHIST=10000
|
||||||
|
HISTFILE=$HOME/.dotfiles/zsh/history
|
||||||
|
|
||||||
|
# zstyle completion
|
||||||
|
zstyle ':completion:*' auto-description 'specify: %d'
|
||||||
|
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
||||||
|
zstyle ':completion:*' format 'Completing %d'
|
||||||
|
zstyle ':completion:*' group-name ''
|
||||||
|
zstyle ':completion:*' menu select=2
|
||||||
|
zstyle ':completion:*' list-colors "=(#b) #([0-9]#)*=36=31"
|
||||||
|
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
||||||
|
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
|
||||||
|
zstyle ':completion:*' menu select=long
|
||||||
|
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
||||||
|
zstyle ':completion:*' use-compctl false
|
||||||
|
zstyle ':completion:*' verbose true
|
||||||
|
# pasting with tabs doesn't perform completion
|
||||||
|
zstyle ':completion:*' insert-tab pending
|
||||||
|
|
||||||
|
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||||
|
|
||||||
|
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
||||||
|
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
||||||
|
|
||||||
|
#
|
||||||
|
# Basic (recommended) zsh setup above
|
||||||
|
# Additional setup below
|
||||||
|
#
|
||||||
|
|
||||||
|
# This makes cd=pushd
|
||||||
|
setopt AUTO_PUSHD
|
||||||
|
|
||||||
|
# why would you type 'cd dir' if you could just type 'dir'?
|
||||||
|
setopt AUTO_CD
|
||||||
|
|
||||||
|
# blank pushd goes to home
|
||||||
|
setopt PUSHD_TO_HOME
|
||||||
|
|
||||||
|
# 10 second wait if you do something that will delete everything. I wish I'd had this before...
|
||||||
|
setopt RM_STAR_WAIT
|
||||||
|
|
||||||
|
# Don't overwrite, append!
|
||||||
|
setopt APPEND_HISTORY
|
||||||
|
|
||||||
|
# Killer: share history between multiple shells
|
||||||
|
setopt SHARE_HISTORY
|
||||||
|
|
||||||
|
# If I type cd and then cd again, only save the last one
|
||||||
|
setopt HIST_IGNORE_DUPS
|
||||||
|
|
||||||
|
# Even if there are commands inbetween commands that are the same, still only save the last one
|
||||||
|
setopt HIST_IGNORE_ALL_DUPS
|
||||||
|
|
||||||
|
# Pretty Obvious. Right?
|
||||||
|
setopt HIST_REDUCE_BLANKS
|
||||||
|
|
||||||
|
# Save the time and how long a command ran
|
||||||
|
setopt EXTENDED_HISTORY
|
||||||
|
|
||||||
|
# Don't log commands beginning with space
|
||||||
|
# (+ Hack to exclude jrnl)
|
||||||
|
setopt HIST_IGNORE_SPACE
|
||||||
|
alias jrnl=" jrnl"
|
45
zshrc
Normal file
45
zshrc
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
#--------------------------------
|
||||||
|
# filename: /zshrc
|
||||||
|
#--------------------------------
|
||||||
|
|
||||||
|
autoload -Uz promptinit && promptinit
|
||||||
|
autoload -U compinit && compinit
|
||||||
|
|
||||||
|
# Default prompt design (color)
|
||||||
|
prompt fade red
|
||||||
|
|
||||||
|
# Load zsh settings
|
||||||
|
source $HOME/.dotfiles/credentials
|
||||||
|
source $HOME/.dotfiles/zsh/settings
|
||||||
|
|
||||||
|
# Define platform
|
||||||
|
platform='Unknown'
|
||||||
|
if [[ $(uname) == 'Linux' ]]; then
|
||||||
|
platform='Linux'
|
||||||
|
elif [[ $(uname) == 'Darwin' ]]; then
|
||||||
|
platform='macOS'
|
||||||
|
fi
|
||||||
|
arch='Unknown'
|
||||||
|
if [[ $(uname -p) == 'arm' ]]; then
|
||||||
|
arch="arm"
|
||||||
|
elif [[ $(uname -p) == 'i386' ]]; then
|
||||||
|
arch="i386"
|
||||||
|
elif [[ $(uname -p) == 'x86_64' ]]; then
|
||||||
|
arch="x86_64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Load additional settings
|
||||||
|
source $HOME/.dotfiles/zsh/env
|
||||||
|
source $HOME/.dotfiles/zsh/alias
|
||||||
|
source $HOME/.dotfiles/zsh/bindings
|
||||||
|
source $HOME/.dotfiles/zsh/scripts
|
||||||
|
source $HOME/.dotfiles/zsh/ffmpeg
|
||||||
|
source $HOME/.dotfiles/zsh/device-specific
|
||||||
|
|
||||||
|
# Addons addons
|
||||||
|
|
||||||
|
## NNotes
|
||||||
|
nnotesaddon="$HOME/.nnotes/.zsh-integration"
|
||||||
|
if [[ -f $nnotesaddon ]]; then
|
||||||
|
source $nnotesaddon
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user