-
Notifications
You must be signed in to change notification settings - Fork 0
/
bashrc_macosx
146 lines (114 loc) · 4.83 KB
/
bashrc_macosx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
#################################################################################
## # User specific aliases and functions
#################################################################################
## to change your default shell run the following
# chsh -s /bin/sh
# ## FUNCTIONS
#################################################
function echo_and_run {
echo "$" "$@"
eval $(printf '%q ' "$@") < /dev/tty
}
alias ear='echo_and_run'
PS1='\[\e[1;32m\][\u]@\[\e[1;37m\]\h \W]\$\[\e[0m\] '
# say -v Daniel "who is the boss?"
# zip -r -X archive_name.zip folder_to_compress
# tar --extract --file={tarball.tar} {file}
## # PATH
# ## mongodb
export PATH=/Users/gfranchini/Workspace/mongoUniv/mongodb/bin:$PATH
export PATH=/usr/local/go/bin:$PATH
# ## Add my own script
export PATH=/Users/gfranchini/bin:$PATH
# ## virtualenv setup
# virtualenv -p /usr/bin/python2.7 venv
# source venv/bin/activate
# pip install requests
# deactivate
# ## Jupyter notebook
# cd /Users/gfranchini/Workspace/JupyterNotebook; source venv/bin/activate ; jupyter notebook
# convert byte to human readable format
# printf %s\\n 559868908 | numfmt --to=iec-i
## # downl -r recur -l (depth level) -A "type"
# wget http://www.mon.url/listefichier.html -r -l 1 -A pdf
# wget -c -i liste-url.txt
# vim -- delete the first 5character of a line:
# :%s/^.\{0,5\}//
# ss -lntp | grep 6379
# ## ALIASES
#################################################
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias lr='ls -R' # recursive ls
alias lx='ll -BX' # sort by extension
alias lz='ll -rS' # sort by size
alias lt='ll -rt' # sort by date
alias lm='la | less'
alias drygrep='grep -Ev "(^$|#)"'
alias prettyjson='python -m json.tool'
alias ipen0='ipconfig getifaddr en0' # for wireless
alias ipen1='ipconfig getifaddr en1' # for ethernet
alias mymacaddr="ifconfig en0 | grep ether | awk '{ print $2 }'"
# how2 hunt down disk space
alias ducks='du -cks * | sort -rn | head'
alias ducks2='du -hsx * | sort -rn | head -10'
#alias ducks3="find . -type f -size +100000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'"
# mac os x updatedb
alias updatedb='sudo /usr/libexec/locate.updatedb'
# list|info mounted volumes
# diskutil list # diskutil info /dev/desk4s1
# VBoxManage
# VBoxManage startvm "VM name" --type headless
# VBoxManage controlvm "VM name" (poweroff|pause|reset|savestate)
# for i in $(vbm list runningvms | awk '{ print $1 }' | sed 's/"//g'); do echo $i; vbm controlvm ${i} savestate; done
alias vbm='VBoxManage'
# ansible -- alias
# ansible-playbook -i "localhost," -c local helloworld.yml
# ansible-doc -l # ansible-doc yum
# ansible webservers -m git -a "repo=git://foo.example.org/repo.git dest=/srv/myapp version=HEAD"
# ansible all -m setup
# generate a hash of 12 character
#date +%s | shasum5.16 | base64 | head -c 12 | awk '{print toupper($0)}'
# go -- prog language
export GOBIN="$HOME/Workspace/go/bin"
export GOPATH="$HOME/Workspace/go/src"
export GOROOT=/usr/local/go
# ELK -- alias
FILEBEAT_HOME=/Users/gfranchini/Workspace/filebeat-1.3.0-darwin
alias filebeatstart='sudo ${FILEBEAT_HOME}/filebeat -e -c ${FILEBEAT_HOME}/filebeat.yml -d "publish"'
alias rabbitmqstart='/Users/gfranchini/Workspace/rabbitmq_server-3.6.5/sbin/rabbitmq-server -detached'
# AWS -- alias
# $ ssh -v -i /pathto/[certfilename].pem ec2-user@[ec2hostname]
alias ssh-aws-es1='ssh -v -i ~/.aws_ssh/aws-es-sshkeypair.pem [email protected]'
alias ssh-aws-es2='ssh -v -i ~/.aws_ssh/aws-es-sshkeypair.pem [email protected]'
alias ssh-aws-es3='ssh -v -i ~/.aws_ssh/aws-es-sshkeypair.pem [email protected]'
# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true
# create a python3 virtualenv
#virtualenv -p python3 ${ENV_DIR}
#source ${ENV_DIR}/bin/activate
# docker -- alias
# docker-compose up
# docker run -t -i elasticsearch /bin/bash
# Kill all running containers.
alias dockerkillall='docker kill $(docker ps -q)'
# Delete all stopped containers.
alias dockercleanc='printf "\n>>> Deleting stopped containers\n\n" && docker rm $(docker ps -a -q)'
# Delete all untagged images.
alias dockercleani='printf "\n>>> Deleting untagged images\n\n" && docker rmi $(docker images -q -f dangling=true)'
# Delete all stopped containers and untagged images.
alias dockerclean='dockercleanc || true && dockercleani'
# stream2es
# ./stream2es wiki --target http://elastic:changeme@localhost:9200/tmp --log debug
# got a bash history with timestamp
export HISTTIMEFORMAT="%h %d %H:%M:%S "
# rot13 encryption
## echo '[email protected]' | tr '[A-Za-z]' '[N-ZA-Mn-za-m]'
alias rot13="tr '[A-Za-z]' '[N-ZA-Mn-za-m]'"
## echo '[email protected]' | rot13