This file contains hidden or 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/bash | |
# CONFIGURATION | |
openssl_config_file=$(openssl ca 2>&1 | grep "Using configuration from" | sed 's/Using configuration from //g') | |
################################################################################ | |
txtgrn='\e[0;32m' | |
txtred='\e[0;31m' | |
txtrst='\e[0m' | |
config_tempfile=$(mktemp --suffix openssl) |
This file contains hidden or 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
def split_sum_into_parts(limit=1500, min_parts=2, max_parts=5): | |
sample = sorted([0, limit] + random.sample(range(limit), random.randint(min_parts-1, max_parts-1))) | |
return [sample[i+1] - item for i, item in enumerate(sample) if i+1 < len(sample)] |
This file contains hidden or 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/bash | |
if [ -z $1 ] | |
then | |
echo "Usage: `basename $0` username password" | |
exit 0 | |
fi | |
sudo -u rabbitmq rabbitmqctl add_user "$1" "$2" | |
sudo -u rabbitmq rabbitmqctl add_vhost "$1" | |
sudo -u rabbitmq rabbitmqctl set_permissions -p "$1" "$1" ".*" ".*" ".*" |
This file contains hidden or 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
from django.http import HttpResponse | |
from mimetypes import guess_type | |
import settings | |
import re, os | |
class XSendFileError(Exception): | |
pass | |
class XSendFileResponse(HttpResponse): | |
def __init__(self, file_path, content_type=None): |