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
import argparse | |
# | |
# Long story short, using sed/printf does always handle strings that contain '/' them (e.g.: urls) | |
# | |
parser = argparse.ArgumentParser() | |
parser.add_argument('fileToSearch', type=file) | |
parser.add_argument('textToSearch', type=str) | |
parser.add_argument('textToReplace', type=str) |
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
import string | |
USABLE_SEQUENCE_WITH_LOWER = string.ascii_letters + string.digits | |
USABLE_SEQUENCE_WITHOUT_LOWER = string.ascii_uppercase + string.digits | |
def generate_secret(length=40, mixed_case=False): | |
""" | |
Produces a random, alphanumeric string of a desired length. | |
:param length: the length of the produced string. |
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
# Please add requirements to setup.py | |
-e . |
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
function setup_database_if_needed { | |
## | |
## Since Kong does not actually create the DB automatically, we need to do that here... | |
## | |
if [ ! -f ~/.pgpass ]; then | |
echo "*:*:*:${KONG_RDS_USER}:${KONG_RDS_PASS}" | tee -a ~/.pgpass | |
chmod 0600 ~/.pgpass | |
fi |
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
plsresolve() { | |
pls_resolve_rc=1 | |
until [ $pls_resolve_rc -eq 0 ]; do curl "$1"; let pls_resolve_rc=$?; sleep 5; done | |
} | |
alias plsresolve=plsresolve |
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
import string | |
import random | |
from functools import reduce | |
USABLE_SEQUENCE_WITH_LOWER = string.ascii_letters + string.digits | |
USABLE_SEQUENCE_WITHOUT_LOWER = string.ascii_uppercase + string.digits | |
def generate_secret(length=50, mixed_case=False): | |
""" |