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/bash | |
# Remove existing key and certificate files | |
rm -f *.key *.crt | |
# Set the file names and parameters | |
CA_KEY="ca.key" | |
CA_CERT="ca.crt" | |
CA_SERIAL="ca.srl" | |
SERVER_KEY="default_4430.key" |
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/bash | |
download_install(){ | |
python3 << END | |
from vive import get_message | |
print(get_message()) | |
END | |
} |
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 python3 | |
# -*- coding: utf-8 -*- | |
"""nginx config file formatter/beautifier with no additional dependencies. | |
Originally published under https://github.com/1connect/nginx-config-formatter, | |
then moved to https://github.com/slomkowski/nginx-config-formatter. | |
""" | |
import argparse |
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/bash | |
# sudo apt install -y pandoc texlive-latex-base texlive-xetex | |
# Script: md_to_pdf.sh | |
# Description: Convert Markdown files to PDF using pandoc. | |
# Function to display usage | |
usage() { | |
echo "Usage: $0 [-o output_directory] file1.md [file2.md ...]" | |
exit 1 |
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/bash | |
echo "- lazydocker installation" | |
LAZYDOCKER_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazydocker/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+') | |
curl -Lo lazydocker.tar.gz "https://github.com/jesseduffield/lazydocker/releases/latest/download/lazydocker_${LAZYDOCKER_VERSION}_Linux_x86_64.tar.gz" | |
tar -xvzf lazydocker.tar.gz> /dev/null 2>&1 && rm lazydocker.tar.gz | |
mv lazydocker /usr/local/bin/lazydocker && chmod a+x /usr/local/bin/lazydocker | |
echo "+ lazydocker installation" |
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 os | |
from redis import ConnectionPool, Redis | |
# Setup Redis connection pool | |
POOL = ConnectionPool( | |
host=os.getenv("REDIS_HOST"), | |
port=os.getenv("REDIS_PORT"), | |
db=os.getenv("REDIS_DB"), | |
password=os.getenv("REDISCLI_AUTH"), |
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 itsdangerous | |
import jwt | |
def start_encoding(salt, secret_key, **kwargs): | |
sz = itsdangerous.Serializer(salt=salt, secret_key=secret_key) | |
return jwt.encode({"enc": sz.dumps(kwargs)}, secret_key, algorithm="HS256") | |
def end_decoding(salt, secret_key, response): |
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 crypt | |
# TO run: | |
# PYTHONWARNINGS=ignore::DeprecationWarning python3 hash_password.py | |
password = "your_password_here" | |
salt = crypt.mksalt(crypt.METHOD_SHA512) | |
hashed_password = crypt.crypt(password, salt) | |
print(f"Hashed Password: {hashed_password}") |
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
from datetime import datetime | |
import pytz | |
UTC = pytz.UTC | |
WAT = pytz.timezone("Africa/Lagos") | |
def current_time(): | |
return datetime.now(pytz.utc).strftime("%Y-%m-%d %H:%M:%S %Z%z") |
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
from datetime import datetime | |
import pytz | |
data = { | |
"sub": [ | |
["a1", "2024-07-01 07:39:41 UTC+0000"], | |
["a3", "2024-07-01 07:39:41 UTC+0000"], | |
["j5", "2024-07-01 07:39:41 UTC+0000"], | |
] |
NewerOlder