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 | |
# | |
# How many times I've had to do this... this saves the trouble, especially of one-by-one | |
# recalling what the dependencies are by reading the output of ./configure ... | |
# | |
# - AG | |
# | |
set -eu | |
declare -r BUILD_DIR=~/nmap-build | |
declare -r NMAP_VERSION="7.92" |
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
"""An extension of requests.Session that provides an interface for specifying a PEM blob | |
This was created as a workaround for https://github.com/psf/requests/issues/4032 | |
This is really only useful if you have a sprawling application and/or many sessions | |
and you don't want to handle the NamedTemporaryFile solution outside of the Session | |
yourself | |
It's surprising at first that requests.Session doesn't provide the ability to specify | |
a StringIO (or other file stream like object) but when you see the OpenSSL interface |
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
[Unit] | |
Description=Redis In-Memory Data Store | |
After=network.target | |
[Service] | |
User=redis | |
Group=redis | |
ExecStart=/usr/local/bin/redis-server /db/redis.conf | |
ExecStop=/usr/local/bin/redis-cli shutdown | |
Restart=always |
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/sh | |
sysctl vm.overcommit_memory=1 | |
sysctl -w net.core.somaxconn=65535 | |
echo never > /sys/kernel/mm/transparent_hugepage/enabled | |
echo never > /sys/kernel/mm/transparent_hugepage/defrag | |
exit 0 |
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
[Unit] | |
Description=/etc/rc.local Compatibility | |
ConditionPathExists=/etc/rc.local | |
[Service] | |
Type=forking | |
ExecStart=/etc/rc.local start | |
TimeoutSec=0 | |
StandardOutput=tty | |
RemainAfterExit=yes |
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
################################## MODULES ##################################### | |
loadmodule /db/modules/libredis-roaring.so | |
loadmodule /db/modules/rejson.so | |
loadmodule /db/modules/redisearch.so | |
################################## NETWORK ##################################### | |
bind 127.0.0.1 | |
protected-mode yes |
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
#make directories | |
mkdir /git | |
mkdir /db | |
mkdir /db/modules | |
mkdir /downloads | |
#update packages, install gcc and redis | |
add-apt-repository ppa:chris-lea/redis-server -y && \ | |
apt-get update && \ | |
apt-get upgrade -y && \ |
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
"""Example extension of RotatingFileHandler that LZMA compresses the rotated files | |
Other examples I found didn't actually respect maxBackups, this does | |
- AG | |
""" | |
import codecs | |
import glob | |
import logging.handlers | |
import os |
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
import os | |
import yaml | |
import logging.config | |
import logging | |
import coloredlogs | |
def setup_logging(default_path='logging.yaml', default_level=logging.INFO, env_key='LOG_CFG'): | |
""" | |
| **@author:** Prathyush SP | |
| Logging Setup |
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 cachetools import cached | |
from cachetools.keys import hashkey | |
from random import randint | |
@cached(cache={}, key=lambda db_handle, query: hashkey(query)) | |
@cached(cache={}, key=lambda db_handle, query: hashkey(query)) | |
def find_object(db_handle, query): | |
saved = query | |
query = 5 |