diff --git a/.aliases b/.aliases index e53a190..4888e4a 100644 --- a/.aliases +++ b/.aliases @@ -5,23 +5,36 @@ alias ....="cd ../../.." alias .....="cd ../../../.." alias -- -="cd -" +# URLs +alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1]);"' + # cURL alias curltime="curl -w \"\nConnect: %{time_connect} TTFB: %{time_starttransfer} Total time: %{time_total} \n\"" -# Docker -alias dce="docker-compose exec" - # Recursively delete `.DS_Store` files alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" +# Docker +alias doc="docker-compose" +alias doce="docker-compose exec" + +# DNS +alias dnsclear="dscacheutil -flushcache && killall -HUP mDNSResponder" + # IP addresses alias ip="dig +short myip.opendns.com @resolver1.opendns.com" alias localip="ipconfig getifaddr en7" alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" +# Lock screen when going AFK +alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" + # Network interfaces alias ifactive="ifconfig | pcregrep -M -o '^[^\t:]+:([^\n]|\n\t)*status: active'" +# Copies public key to clipboard +alias pubkey="cat ~/.ssh/id_rsa.pub | pbcopy | echo '-> Public key copied to clipboard.'" + # Updates macOS applications and updates Homebrew packages alias update='sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup' diff --git a/.functions b/.functions index be4f0b9..64456dd 100644 --- a/.functions +++ b/.functions @@ -50,7 +50,7 @@ function dig_in_parallel() { function digscan() { set +m; - subdomains=( alert adm admin administration api apis assets back backend blog bo board build builds ci cloud conf config configuration console contact contacts dashboard database db dev demo directory dl doc documentation download downloads elasticsearch endpoint elk exchange exchanges free files front frontend ftp gateway geo git gitlab github grafana graph graphs group home host hosting int integ integration jenkins jira kibana kube kubectl kubernetes light live logs mail manager market marketing mobile monitor monitoring mongo mongodb mysql open openshift opensource order orders partner partners preprod private prive postgres postgresql recette root share sales source sources stats status stream test vpn webmail wiki www ) + subdomains=( a alert adm admin administration api apis api-gateway assets b back backend b2b b2c black blog bo board brown build builds c cache cached ceph cli client clients ci cloud conf config configuration console consul contact contacts contract contracts cust customer customers d dark dashboard database db dev demo directory display dl dns doc documentation domain domains download downloads e elasticsearch endpoint elk exchange exchanges ext extern external externals extra extranet f factory free files front frontend ftp g gateway geo git gitlab github go golang grafana graph graphs grey green group h health healths home host hosting hub hubs i int integ integration intra intranet j jenkins jira k kibana k8s kube kubectl kubernetes l light live logs m mail manager market marketing minio mobile monitor monitoring mongo mongodb mysql n nas new news no o open openshift opensource order orders p package packages packagist partner partners perso preprod priv private prive portal postgres postgresql pro pros purple q quality qualys r recette red redis reg registry rule rules root roots s s3 secret secrets share sale sales serv server servers smtp source sources ssh sso stat stats status storage store stream t test tests time timeline u v vault view views vol vols volume volumes vpn w web webmail white wiki work worker workers www x y yellow yes z zoo ) echo "Checking...\n"; @@ -61,3 +61,13 @@ function digscan() { wait set -m; } + +# Generates a password and returns hashed values +function genpasswd() { + passwd=`env LC_CTYPE=C tr -dc 'a-zA-Z0-9-_\$\?' < /dev/urandom | head -c 20`; + sha256=`echo $passwd | shasum -a 256`; + sha512=`echo $passwd | shasum -a 512`; + md5=`md5 -s $passwd | cut -d'=' -f2 | xargs` + + echo "Raw: $passwd\n\nSHA256: $sha256\nSHA512: $sha512\n\nMD5: $md5"; +} diff --git a/Makefile b/Makefile index 26e8e99..8f4679e 100644 --- a/Makefile +++ b/Makefile @@ -4,15 +4,15 @@ help: @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' install: ## Installs dotfiles into current environment - @$(MAKE) DOTFILE=.vimrc install_file + @$(MAKE) DOTFILE=.aliases install_file @$(MAKE) DOTFILE=.atom/config.cson install_file + @$(MAKE) DOTFILE=.exports install_file + @$(MAKE) DOTFILE=.functions install_file @$(MAKE) DOTFILE=.gitconfig install_file @$(MAKE) DOTFILE=.gitignore install_file @$(MAKE) DOTFILE=.hyper.js install_file - @$(MAKE) DOTFILE=.aliases install_file - @$(MAKE) DOTFILE=.exports install_file - @$(MAKE) DOTFILE=.functions install_file @$(MAKE) DOTFILE=.sources install_file + @$(MAKE) DOTFILE=.vimrc install_file @$(MAKE) DOTFILE=.zshrc install_file install_file: diff --git a/README.md b/README.md index dd11e64..5c8aee1 100644 --- a/README.md +++ b/README.md @@ -12,15 +12,19 @@ $ make install ``` Here is the detail of available dotfiles: - -## [.vimrc](https://raw.github.com/eko/dotfiles/master/.vimrc) - * Install to `~/.vimrc` - * Type `vim +PlugInstall +qall` to install vim plugins +## [.aliases](https://raw.github.com/eko/dotfiles/master/.aliases) + * Install to `~/.aliases` ## [.atom/config.cson](https://raw.github.com/eko/dotfiles/master/.atom/config.cson) * Download [Atom](https://atom.io) * Install to `~/.atom/config.cson` +## [.editorconfig](https://raw.github.com/eko/dotfiles/master/.editorconfig) + * Install to `project/` directory + +## [.exports](https://raw.github.com/eko/dotfiles/master/.exports) + * Install to `~/.exports` + ## [.gitconfig](https://raw.github.com/eko/dotfiles/master/.gitconfig) * Install to `~/.gitconfig` @@ -28,8 +32,15 @@ Here is the detail of available dotfiles: * Install to `~/.gitignore` * Type `git config --global core.excludesfile ~/.gitignore` -## [.editorconfig](https://raw.github.com/eko/dotfiles/master/.editorconfig) - * Install to `project/` directory - ## [.hyper.js](https://raw.github.com/eko/dotfiles/master/.hyper.js) * Install to `~/.hyper.js` + +## [.sources](https://raw.github.com/eko/dotfiles/master/.sources) + * Install to `~/.sources` + +## [.vimrc](https://raw.github.com/eko/dotfiles/master/.vimrc) + * Install to `~/.vimrc` + * Type `vim +PlugInstall +qall` to install vim plugins + +## [.zshrc](https://raw.github.com/eko/dotfiles/master/.zshrc) + * Install to `~/.zshrc`