Skip to content

Commit

Permalink
Added some aliases/functions and re-order files
Browse files Browse the repository at this point in the history
  • Loading branch information
eko committed Sep 22, 2017
1 parent 55a346d commit a3c7382
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 15 deletions.
19 changes: 16 additions & 3 deletions .aliases
Expand Up @@ -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'

Expand Down
12 changes: 11 additions & 1 deletion .functions
Expand Up @@ -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";

Expand All @@ -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";
}
8 changes: 4 additions & 4 deletions Makefile
Expand Up @@ -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:
Expand Down
25 changes: 18 additions & 7 deletions README.md
Expand Up @@ -12,24 +12,35 @@ $ 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`

## [.gitignore](https://raw.github.com/eko/dotfiles/master/.gitignore)
* 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`

0 comments on commit a3c7382

Please sign in to comment.