-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.bash_public
126 lines (109 loc) · 3.93 KB
/
.bash_public
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
# set PS1
PS1='[\u@\h \W]\$ '
# ranger indentation
[[ -n "${RANGER_LEVEL}" ]] && PS1="${PS1}"'(in ranger) '
# locale
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
# tools of choice
export PAGER=less
export EDITOR=vim
export VISUAL=vim
export BROWSER=firefox
export TERMINAL=urxvt
# env variables
export QT_QPA_PLATFORMTHEME=qt5ct
export NO_AT_BRIDGE=1
export TZ=":/etc/localtime"
export SAL_USE_VCLPLUGIN=gtk
export COLORFGBG="default;default"
export HISTCONTROL=ignorespace
export mesa_glthread=true
# https://old.reddit.com/r/archlinux/comments/htq7hk/urxvt_segfaults_on_exit_for_whatever_reason/g3a74u3/
export PERL_DESTRUCT_LEVEL=2
# lower-case XDG dirs
export XDG_DESKTOP_DIR="${HOME}/desktop"
export XDG_DOWNLOAD_DIR="${HOME}/downloads"
export XDG_TEMPLATES_DIR="${HOME}/templates"
export XDG_PUBLICSHARE_DIR="${HOME}/public"
export XDG_DOCUMENTS_DIR="${HOME}/documents"
export XDG_MUSIC_DIR="${HOME}/music"
export XDG_PICTURES_DIR="${HOME}/pictures"
export XDG_VIDEOS_DIR="${HOME}/videos"
#force configs to XDG dir
export GNUPGHOME="${HOME}/.config/gnupg"
export LEDGER_FILE="${HOME}/.config/hledger.journal"
export XDG_CACHE_HOME="${HOME}/.config/cache"
export PASSWORD_STORE_DIR="${HOME}/.config/password-store"
# less pager options
# courtesy http://blog.0x1fff.com/2009/11/linux-tip-color-enabled-pager-less.html
export LESS="-RSM~gIsw"
export LESS_TERMCAP_mb=$'\E[01;31m'
export LESS_TERMCAP_md=$'\E[01;31m'
export LESS_TERMCAP_me=$'\E[0m'
export LESS_TERMCAP_se=$'\E[0m'
export LESS_TERMCAP_so=$'\E[01;44;33m'
export LESS_TERMCAP_ue=$'\E[0m'
export LESS_TERMCAP_us=$'\E[01;32m'
# command default options
alias ip='ip -color'
alias ls='ls --color=auto --human-readable -l -v'
alias dfc='dfc -d -T -s -p -dev,tmpfs,overlay,devtmpfs,cgroup_root'
alias glances='glances --hide-kernel-threads'
alias grep='grep --color=auto'
alias diff='diff --color=auto'
alias tmux='tmux -f "${HOME}/.config/tmux.conf"'
# command verbosity
alias cp='cp --verbose'
alias rm='rm --verbose'
alias mv='mv --verbose'
alias mkdir='mkdir --verbose'
alias rmdir='rmdir --verbose'
alias chmod='chmod --verbose'
alias trash='trash --verbose'
# utility commands
alias weather='curl "https://wttr.in/?u"'
alias largefiles='sudo du -a / | sort -n -r | head -n 100'
alias badpkgs='for pkg in $(pacman -Qqd); do [[ -z $(comm -12 <(pactree -r $pkg -u | sort) <(pacman -Qqe | sort)) ]] && echo $pkg; done'
alias rsync-default='rsync --archive --verbose --progress -zz --human-readable --update'
alias pingtest='ping -v -c 4 -O -D archlinux.org'
alias pingstd='ping -v -c 4 -O -D'
alias dl='curl --location --remote-name'
alias wwwscan='nmap -A -T4 -v'
alias netscan='sudo nmap -v -Pn -sS -p80 -iR 0 -open'
alias localscan='nmap -sn -v 192.168.0.0/24'
alias downmix-flac='(for FILE in *.flac ; do ffmpeg -i "${FILE}" -f mp3 -ab 320000 -map_metadata 0 -id3v2_version 3 "`basename "${FILE}" .flac`.mp3" || break; done)'
alias downmix-m4a='(for FILE in *.m4a ; do ffmpeg -i "${FILE}" -f mp3 -ab 320000 -map_metadata 0 -id3v2_version 3 "`basename "${FILE}" .m4a`.mp3" || break; done)'
alias encrypt='openssl des3 <'
alias decrypt='openssl des3 -d <'
if [[ -z "${SSH_CONNECTION}" ]] && type xset >/dev/null 2>&1 && xset q >/dev/null 2>&1
then
xrdb < "${HOME}/.Xdefaults"
DISPLAY=":0" xset s off
DISPLAY=":0" xset s noblank
DISPLAY=":0" xset -dpms
fi
# https://stackoverflow.com/a/37840948
function urldecode()
{
: "${*//+/ }"
echo -e "${_//%/\\x}";
}
function rand
{
if [[ "${1}" == "page" ]]
then
find . -type f | shuf | head --lines=1 | while read line ; do echo "${line}" && zathura "${line}" ; done
elif [[ "${1}" == "img" ]]
then
find . -type f -print0 | shuf -z | xargs -0 sxiv -a
elif [[ "${1}" == "vid" ]]
then
find . -type f | shuf | head --lines=1 | while read line ; do echo "${line}" && mpv --no-resume-playback "${line}" ; done
fi
}
function genpass
{
tr -cd "a-zA-Z0-9" < /dev/urandom | head --bytes="${1:-120}" | tee >(xsel --input --clipboard)
echo
}