-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmacos.rcfile
82 lines (79 loc) · 2.94 KB
/
macos.rcfile
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
# Exports
export FZF_DEFAULT_OPTS="
--layout=reverse
--info=inline
--height=95%
--multi
--preview '([[ -f {} ]] && (bat --style=numbers --color=always {} || cat {})) || ([[ -d {} ]] && (tree -C {} | less)) || echo {} 2> /dev/null | head -200'
--bind=ctrl-k:preview-down
--bind=ctrl-j:preview-up
"
export FZF_DEFAULT_COMMAND='fd --follow --hidden'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export BAT_PAGER=''
export LESS_TERMCAP_mb=$'\e[1;32m'
export LESS_TERMCAP_md=$'\e[1;32m'
export LESS_TERMCAP_me=$'\e[0m'
export LESS_TERMCAP_se=$'\e[0m'
export LESS_TERMCAP_so=$'\e[01;33m'
export LESS_TERMCAP_ue=$'\e[0m'
export LESS_TERMCAP_us=$'\e[1;4;31m'
export SPACESHIP_TIME_SHOW=true
export HISTCONTROL=ignoreboth
export PATH=$PATH:/opt/homebrew/bin
# Aliases
alias f='fzf'
alias gitn='git --no-pager'
alias awsn='aws --no-cli-pager'
alias tt='tmux -u new -s default'
alias t='tmux -u a -t default'
alias ts='tmux -u new -s'
alias ta='tmux -u a -t'
alias tls='tmux list-sessions'
alias vim=nvim
alias c=clear
alias l='lsd -l'
alias la='lsd -la'
alias ip4='ifconfig | grep -oE "\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}" | grep -v "127.0.0.1" | grep -vE ".+\.255$"'
alias pubip="curl -s ipinfo.io | jq -r -M '.ip'"
alias sshide='ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null"'
alias ruid='python3 -c "import uuid; print(uuid.uuid4())"'
alias sruid='ruid | grep -oE ".{4}-.{4}-.{4}" | cat'
alias utcnow='date -u +"%Y-%m-%dT%H:%M:%S+00:00"'
alias sessionrec='script -f $HOME/session-$(date +"%d-%b-%y_%H-%M-%S").log'
# Functions
ipinfo(){curl -s ipinfo.io/$1/json | jq '{CITY:.city, REGION:.region, COUNTRY:.country, POSTAL:.postal, OWNER:.org}'}
fencrypt(){openssl aes-256-ecb -a -in "$1" -out "$1.enc"}
fdecrypt(){openssl aes-256-ecb -a -d -in "$1" -out "$(echo $1 | sed 's/\.enc//')"}
forlinear(){
for i in {0..$1}
do eval $2
done
}
reprint() {
if [[ -z $1 ]]; then
cat /dev/random | head -c 400 | base64 | tr -d '=+/\n' | head -c 400; echo ""
elif [[ -z $2 && $1 =~ "[0-9]+" ]]; then
cat /dev/random | head -c $1 | base64 | tr -d '=+/\n' | head -c $1; echo ""
elif [[ $1 == "seq" ]]; then
if [[ -z $2 ]]; then
echo "provide length for sequence"
else
alpha={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,x,y,z}
eval echo -n $alpha$alpha$alpha$alpha | tr -d " " | head -c $2; echo ""
fi
elif [[ $1 == "rep" ]]; then
if [[ -z $2 || -z $3 ]]; then
echo "provide number of reps followed by string for repetition"
else
for i in {1..$2}; do echo -n $3; done; echo ""
fi
else
echo "Usage: reprint [[len_random]|seq|rep] [len_seq|len_rep] [char_rep]"
fi
}
# Set cursor to vertical line
keymap-for-cursor-shape() { echo -ne '\e[5 q' }
zle-line-init() { keymap-for-cursor-shape }
# Host-only (usually not for use within containers)
alias dockernonerm='for i in $(docker images -f dangling=true -q); do docker image rm $i; done'