This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To get the most out of this .bashrc, install bash 4.x or higher along with the following tools: | |
# figlet | |
# screenfetch | |
# | |
# On Mac, install bash via brew and update the shell for the user: | |
# | |
# brew install bash | |
# sudo echo /usr/local/bin/bash >> /etc/shells | |
# chsh -s /usr/local/bin/bash | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Create the CA root signing key | |
openssl genrsa -out "./ca.key" 2048 | |
# Create the CA root certificate | |
openssl req -x509 -new -nodes \ | |
-days 3650 \ | |
-reqexts v3_req \ | |
-extensions v3_ca \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
get_bg_color() { | |
local -n bg_color="$1" | |
local ansi_sequence_query_bg='\e]11;?\e\' | |
local cur_stty=$(stty -g) | |
# enable stty raw echo | |
stty raw -echo min 0 time 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
get_bg_color() { | |
local -n bg_color="$1" | |
local ansi_sequence_query_bg='\e]11;?\e\' | |
local cur_stty=$(stty -g) | |
stty raw -echo min 0 time 0 | |
printf "%b" "${ansi_sequence_query_bg}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($shun_mismatched_payload = 1) { | |
return 403 'You shall not pass!!!'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $arg_FOO:$http_x_bar $shun_mismatched_payload { | |
"~^([^:]+):\1$" 1; | |
default 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($shun_if_client_is_a_baddy = 1) { | |
return 403 'You shall not pass!!!'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map $request_uri $uri_only { | |
"~^(?<u>[^\?]+)\?(?:.*)?" $u; | |
default $request_uri; | |
} | |
map $uri_only $shun_if_client_is_a_baddy { | |
"~\/\/" 1; | |
"~*%2f" 1; | |
default 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# if delimeter between two variables is ':' | |
map $thing1:$thing2 $do_things_match { | |
"~^([^:]+):\1$" 1; | |
default 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($thing1 = $thing2) { | |
return 301 "{'Error': 'Things don't match!'}"; | |
} |