Added Dotfiles

This commit is contained in:
Nikolas Weger 2015-07-16 18:57:43 +02:00
parent 9cd2220adb
commit 9ea4faff29
17 changed files with 622 additions and 0 deletions

26
zsh/alias.zsh Normal file
View file

@ -0,0 +1,26 @@
# Listing
source ~/.dotfiles/zsh/aliases.d/list.zsh
# Grep
source ~/.dotfiles/zsh/aliases.d/grep.zsh
# Tail
source ~/.dotfiles/zsh/aliases.d/tail.zsh
# CD
source ~/.dotfiles/zsh/aliases.d/cd.zsh
# Du/Find
source ~/.dotfiles/zsh/aliases.d/find.zsh
# Stuff
source ~/.dotfiles/zsh/aliases.d/stuff.zsh
# Interactive
source ~/.dotfiles/zsh/aliases.d/interactive.zsh
# Own
source ~/.dotfiles/zsh/aliases.d/own.zsh
# Transfer
source ~/.dotfiles/zsh/aliases.d/transfer.zsh

28
zsh/aliases.d/cd.zsh Normal file
View file

@ -0,0 +1,28 @@
# CD
alias ..='cd ../'
alias ...='cd ../../'
alias ....='cd ../../../'
alias .....='cd ../../../../'
# Go up [n] directories
function up()
{
local cdir="$(pwd)"
if [[ "${1}" == "" ]]; then
cdir="$(dirname "${cdir}")"
elif ! [[ "${1}" =~ ^[0-9]+$ ]]; then
echo "Error: argument must be a number"
elif ! [[ "${1}" -gt "0" ]]; then
echo "Error: argument must be positive"
else
for i in {1..${1}}; do
local ncdir="$(dirname "${cdir}")"
if [[ "${cdir}" == "${ncdir}" ]]; then
break
else
cdir="${ncdir}"
fi
done
fi
cd "${cdir}"
}

5
zsh/aliases.d/find.zsh Normal file
View file

@ -0,0 +1,5 @@
# Du/Find
alias dud='du -d 1 -h'
alias duf='du -sh *'
alias fd='find . -type d -name'
alias ff='find . -type f -name'

4
zsh/aliases.d/grep.zsh Normal file
View file

@ -0,0 +1,4 @@
# Grep
alias grep='grep --color'
alias sgrep='grep -R -n -H -C 5 --exclude-dir={.git,.svn,CVS}'
alias psg='ps aux | grep -v grep | grep'

View file

@ -0,0 +1,5 @@
# Interactive
alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

10
zsh/aliases.d/list.zsh Normal file
View file

@ -0,0 +1,10 @@
# Listing
alias l='ls -lFh' #size,show type,human readable
alias la='ls -lAFh' #long list,show almost all,show type,human readable
alias lr='ls -tRFh' #sorted by date,recursive,show type,human readable
alias lt='ls -ltFh' #long list,sorted by date,show type,human readable
alias ll='ls -l' #long list
alias ldot='ls -ld .*'
alias lS='ls -1FSsh'
alias lart='ls -1Fcart'
alias lrt='ls -1Fcrt'

20
zsh/aliases.d/own.zsh Normal file
View file

@ -0,0 +1,20 @@
# Own Aliases
alias fuck='eval $(thefuck $(fc -ln -1 | tail -n 1)); fc -R'
alias clf='clf --color'
# The Fuck
alias fuck='eval $(thefuck $(fc -ln -1))'
# PClear
pclear () {
clear
printf '\033[3J'
}
# Create SSL One Line
sslcreate() {
openssl genrsa -out private/$1.key 2048
openssl req -new -key private/$1.key -out csr/$1.csr -sha256
openssl x509 -req -days 365 -in csr/$1.csr -signkey private/$1.key -out certs/$1.crt
}

7
zsh/aliases.d/stuff.zsh Normal file
View file

@ -0,0 +1,7 @@
# Stuff
alias h='history'
alias hgrep="fc -El 0 | grep"
alias j='jobs'
alias p='ps -f'
alias sortnr='sort -n -r'

2
zsh/aliases.d/tail.zsh Normal file
View file

@ -0,0 +1,2 @@
# Tail
alias t='tail -f'

View file

@ -0,0 +1,54 @@
#
# Defines transfer alias and provides easy command line file and folder sharing.
#
# Authors:
# Remco Verhoef <remco@dutchcoders.io>
#
transfer() {
# check arguments
if [ $# -eq 0 ];
then
echo "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"
return 1
fi
# get temporarily filename, output is written to this file show progress can be showed
tmpfile=$( mktemp -t transferXXX )
# upload stdin or file
file=$1
if tty -s;
then
basefile=$(basename "$file" | sed -e 's/[^a-zA-Z0-9._-]/-/g')
if [ ! -e $file ];
then
echo "File $file doesn't exists."
return 1
fi
if [ -d $file ];
then
# zip directory and transfer
zipfile=$( mktemp -t transferXXX.zip )
cd $(dirname $file) && zip -r -q - $(basename $file) >> $zipfile
curl --progress-bar --upload-file "$zipfile" "https://transfer.sh/$basefile.zip" >> $tmpfile
rm -f $zipfile
else
# transfer file
curl --progress-bar --upload-file "$file" "https://transfer.sh/$basefile" >> $tmpfile
fi
else
# transfer pipe
curl --progress-bar --upload-file "-" "https://transfer.sh/$file" >> $tmpfile
fi
# cat output link
cat $tmpfile
# cleanup
rm -f $tmpfile
}

35
zsh/antigen.zsh Normal file
View file

@ -0,0 +1,35 @@
# Load Antigen
source ~/.antigen/antigen.zsh
# Oh-My-ZSH Library
antigen use oh-my-zsh
# Theme
antigen theme pygmalion
# Load Plugins
antigen bundles <<EOBUNDLES
gem
bundler
composer
git
pip
vagrant
docker
python
extract
npm
archlinux
systemd
systemadmin
frontend-search
gitignore
command-not-found
colored-man
EOBUNDLES
# Apply Config
antigen apply