Repository navigation
Expand file tree
/
Copy path.bashrc
More file actions
executable file
·165 lines (152 loc) · 4.59 KB
/
Copy path.bashrc
File metadata and controls
executable file
·165 lines (152 loc) · 4.59 KB
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
#!/bin/bash
umask 0027
# Computer Specific Operations
if [ "$HOSTNAME" = "nuew" -o "$HOSTNAME" = "lyra" ]; then
dfsub=prog
elif [ "$HOSTNAME" = "thoth.cs.pitt.edu" ]; then
dfsub=private
source /opt/set_specific_profile.sh
fi
# VT Escape Sequences
FONT0="\e(" FONT1="\e)"
RESET="\e[0m" BRIGHT="\e[1m" DIM="\e[2m" UNDERSCORE="\e[4m" \
BLINK="\e[5m" REVERSE="\e[7m" HIDDEN="\e[8m"
BLACK="\e[30m" RED="\e[31m" GREEN="\e[32m" YELLOW="\e[33m" \
BLUE="\e[34m" MAGENTA="\e[35m" CYAN="\e[36m" WHITE="\e[37m"
BLACKBG="\e[40m" REDBG="\e[41m" GREENBG="\e[42m" YELLOWBG="\e[43m" \
BLUEBG="\e[44m" MAGENTABG="\e[45m" CYANBG="\e[46m" WHITEBG="\e[47m"
# Shell Options
shopt -s autocd cdspell extglob globstar histappend no_empty_cmd_completion
set -o vi
# Environment
function ps1_maybe_ev {
local ev=$?; [ $ev != 0 ] && echo -e " $ev"
}
export EDITOR=nvim PAGER='less -RM' SHELL=bash
export HISTSIZE=10000 HISTCONTROL=ignoredups
export PATH="$HOME/.local/bin:$PATH"
export MANPATH="$HOME/.local/share/man:$MANPATH"
export LD_LIBRARY_PATH="$HOME/.local/lib"
export PS1="\w"'$(ps1_maybe_ev)\$ ' PS2="> " PS3="% " PS4="+ "
export GPG_TTY=$(tty)
export LESSHISTFILE=-
# Aliases
alias RM='rm -rf'
alias cargo-fmt='rustup run nightly cargo fmt'
alias dhex='dhex -f $HOME/.config/dhexrc'
alias dig=drill
alias ip='ip -c'
alias less="$PAGER"
alias ls='ls -h --color=auto --group-directories-first'
alias lualatex='lualatex --shell-escape'
alias nc=ncat
alias open=xdg-open
alias pacsizes="pacman -Qi | awk '{ if (\$1 == \"Installed\") { print(\$4 \\
substr(\$5, 0, 1)) } else if (\$1 == \"Name\") { printf(\"%-30s \", \$3) }
}' | sort -rhk2"
alias phase='curl -s http://wttr.in/Moon?m'
alias please='sudo -- "${SHELL:-bash}" -c "$(fc -ln -1)"'
alias rc="git --git-dir=$HOME/$dfsub/rc/ --work-tree=$HOME"
alias sprunge='curl -F "sprunge=<-" http://sprunge.us'
alias timestamp='date +%s%3N'
alias traceroute=tracepath
alias vim=nvim
alias weather='curl -s http://wttr.in/Pittsburgh?m'
# Functions
function define { # Get the definition of a word from Wiktionary
curl -s "https://en.wiktionary.org/wiki/$1?action=raw" | \
sed -f "$HOME/prog/wikifmt.sed"
}
function genpass { # Generate a random password
local l=$1 c=$2
[ "$l" == "" ] && l=24
[ "$c" == "" ] && c="[:alnum:]"
printf "%s\n" $(tr -dc $c < /dev/urandom | head -c $l)
}
function gendiceware { # Generate a diceware-style password
local l=$1
[ "$l" == "" ] && l=6
curl -sS https://www.eff.org/files/2016/07/18/eff_large_wordlist.txt | \
awk '{ print $2 }' | \
shuf -rn ${l} --random-source=/dev/urandom | \
tr [:upper:] [:lower:] | \
sed -z 's/\n//g'
echo
}
function savedvd { # Save an ISO of the inserted DVD to disk
dd if=/dev/sr0 of=${1} bs=2048 count=$(isosize -d 2048 /dev/sr0) status=progress
}
# GCC Options
gcc_options='\
--param=ssp-buffer-size=4 \
-D_FORTIFY_SOURCE=2 \
-Wl,--sort-common,--as-needed,-z,relro \
-flto \
-fstack-protector-strong \
-march=native \
-pipe \
'
gcc_release_options="$gcc_options -DNDEBUG -Ofast -Wl,-O1"
gcc_development_options="$gcc_options \
-Og \
-Wall \
-Wcast-align \
-Wcast-qual \
-Wconversion \
-Wdate-time \
-Wdisabled-optimization \
-Wduplicated-cond \
-Wextra \
-Wfloat-equal \
-Wformat=2 \
-Winline \
-Wlogical-op \
-Wmaybe-uninitialized \
-Wmissing-declarations \
-Wmissing-format-attribute \
-Wmissing-include-dirs \
-Wnormalized \
-Wpacked \
-Wpadded \
-Wpedantic \
-Wredundant-decls \
-Wshadow \
-Wstack-protector \
-Wstrict-overflow=5 \
-Wsuggest-attribute=const \
-Wsuggest-attribute=format \
-Wsuggest-attribute=noreturn \
-Wsuggest-attribute=pure \
-Wsuggest-final-methods \
-Wsuggest-final-types \
-Wswitch-default \
-Wswitch-enum \
-Wtrampolines \
-Wundef \
-Wuninitialized \
-Wunsafe-loop-optimizations \
-Wunused-parameter \
-Wwrite-strings \
-fdiagnostics-color=auto \
-ggdb3 \
"
gcc_c_development_options="$gcc_development_options \
-Wbad-function-cast \
-Wmissing-prototypes \
-Wnested-externs \
-Wold-style-definition \
-Wstrict-prototypes \
-Wunsuffixed-float-constants \
"
gcc_cpp_development_options="$gcc_development_options \
-Wsuggest-override \
-Wuseless-cast \
-Wzero-as-null-pointer-constant \
"
alias gcc="gcc -std=gnu23 $gcc_c_development_options"
alias gccrel="gcc -std=gnu23 $gcc_release_options"
alias g++="g++ -std=gnu++23 $gcc_cpp_development_options"
alias g++rel="g++ -std=gnu++23 $gcc_release_options"
# Programmable Completions
[ -r /usr/share/bash-completion/bash_completion ] && . /usr/share/bash-completion/bash_completion
unset dfsub