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
#!/bin/zsh | |
usage() { | |
print "Usage: sudo rerouter -n network" | |
exit 1 | |
} | |
while getopts ':n:' arg; do | |
case $arg in | |
n) |
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 imp | |
from os import path | |
from setuptools import find_packages, setup | |
VERSION = imp.load_source('version', path.join('.', 'samplex', 'version.py')) | |
VERSION = VERSION.__version__ | |
REQUIRES = ['falcon>=1.1.0', 'bcrypt>=3.1.1', 'gunicorn>=19.6.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
# These commands will help you find and truncate a deleted file handle that is holding onto disk space. Why do my servers | |
# always fuck with me during the holidays? | |
# Run this to find files that have one link, which should equal a (deleted) file | |
$ lsof -nP +L1 | |
# Now, search through /proc to find these deleted files | |
$ find /proc/*/fd -ls | grep '(deleted)' | |
/proc/5225/fd/3 -> /var/log/ceph/ceph-mon.st1.log.1\ (deleted) |
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
# List all available versions | |
$ pyenv versions | |
system | |
# Install Python3 on machine as full binary | |
$ pyenv install 3.5.2 | |
# Create virtualenv out of 3.5.2 | |
$ pyenv virtualenv 3.5.2 developer | |
$ pyenv activate developer |
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 bcrypt | |
# Need to supply the password as a byte | |
hashed = bcrypt.hashpw(b'somepassword', bcrypt.gensalt()) | |
print(hashed) | |
#>> b'$2b$12$rbsEiL/dJymbH3453Tbhs.kEljGWNKTmp23s5iG71adGxv5jFj72S' | |
# To check the same password against the hashed value, use checkpw() | |
# The password you're testing comes first, the hashed value second. | |
# Getting it the other way around results in an Invalid Salt error. |
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 random | |
import string | |
randomish = ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(32)) | |
print(randomish) |