diff --git a/ReadMe.md b/ReadMe.md new file mode 100644 index 0000000..3050386 --- /dev/null +++ b/ReadMe.md @@ -0,0 +1,7 @@ +# dotfiles + +## Install + +Clone repo do your user directory. + +```~/.dotfiles``` \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..0492575 --- /dev/null +++ b/install.sh @@ -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 diff --git a/ssh/hosts b/ssh/hosts new file mode 100644 index 0000000..4c013ae --- /dev/null +++ b/ssh/hosts @@ -0,0 +1,3 @@ +# Add the following to ~/.ssh/config +# Include ~/.dotfiles/ssh/hosts + diff --git a/ssh/settings b/ssh/settings new file mode 100644 index 0000000..796d77b --- /dev/null +++ b/ssh/settings @@ -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 diff --git a/zsh/alias b/zsh/alias new file mode 100644 index 0000000..a6179e2 --- /dev/null +++ b/zsh/alias @@ -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' diff --git a/zsh/bindings b/zsh/bindings new file mode 100644 index 0000000..23193f5 --- /dev/null +++ b/zsh/bindings @@ -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' diff --git a/zsh/env b/zsh/env new file mode 100644 index 0000000..4f713ad --- /dev/null +++ b/zsh/env @@ -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 \ No newline at end of file diff --git a/zsh/ffmpeg b/zsh/ffmpeg new file mode 100644 index 0000000..4ab8322 --- /dev/null +++ b/zsh/ffmpeg @@ -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" "$dir/$name.jpg"