Skip to content

Instantly share code, notes, and snippets.

View dedayoa's full-sized avatar

Dayo Ayeni dedayoa

View GitHub Profile
@dedayoa
dedayoa / gen_dkim.py
Created October 21, 2023 20:16 — forked from lmammino/gen_dkim.py
Generate dkim keys and a TXT record file for AWS Route 53
#!/usr/bin/env python
# Usage
# ./gen_dkim.py mail.yourdomain.tld
import sys
from subprocess import call
from os import devnull
if len(sys.argv) < 2:
@dedayoa
dedayoa / main.py
Created November 14, 2022 09:23 — forked from stewartadam/main.py
Simple Python proxy server based on Flask and Requests with support for GET and POST requests.
"""
A simple proxy server, based on original by gear11:
https://gist.github.com/gear11/8006132
Modified from original to support both GET and POST, status code passthrough, header and form data passthrough.
Usage: http://hostname:port/p/(URL to be proxied, minus protocol)
For example: http://localhost:5000/p/www.google.com
"""
import re
@dedayoa
dedayoa / Docker Best Practices.md
Created September 19, 2021 17:35 — forked from StevenACoffman/Docker Best Practices.md
Docker Best Practices

Mistakes to Avoid: Docker Antipatterns

Whichever route you take to implementing containers, you’ll want to steer clear of common pitfalls that can undermine the efficiency of your Docker stack.

Don’t run too many processes inside a single container

The beauty of containers—and an advantage of containers over virtual machines—is that it is easy to make multiple containers interact with one another in order to compose a complete application. There is no need to run a full application inside a single container. Instead, break your application down as much as possible into discrete services, and distribute services across multiple containers. This maximizes flexibility and reliability.

Don’t install operating systems inside Docker containers

It is possible to install a complete Linux operating system inside a container. In most cases, however, this is not necessary. If your goal is to host just a single application or part of an application in the container, you need to install only the essential

@dedayoa
dedayoa / vox2astpp.py
Created February 3, 2019 20:03
A python script to convert voxbeam rates to form that can be imported into astpp
import csv
import os
import sys
from decimal import Decimal
import logging
stdout_handler = logging.StreamHandler(sys.stdout)
logging.basicConfig(
level=logging.DEBUG,
format='[%(asctime)s] %(levelname)s - %(message)s',
@dedayoa
dedayoa / hostname.lua
Created August 23, 2018 11:10 — forked from h1k3r/hostname.lua
Lua - get hostname
local _M = {}
function _M.getHostname()
local f = io.popen ("/bin/hostname")
local hostname = f:read("*a") or ""
f:close()
hostname =string.gsub(hostname, "\n$", "")
return hostname
end
return _M
@dedayoa
dedayoa / nigeria-cities-dialing-codes.json
Created February 22, 2018 22:26
Nigeria Cities Dialing Code as JSON
[
{
"city": "Aba",
"area_code": 82,
"dialing_code": "+234 82"
},
{
"city": "Abakaliki",
"area_code": 43,
"dialing_code": "+234 43"
@dedayoa
dedayoa / astpp-log-cleanup.sh
Last active February 6, 2018 20:51
Bash script to help clean up all filled logs on ASTPP
#!/bin/bash
# This bash script help release astpp from overfull logs To view the top 10 biggest directories cloggin up the HDD, run sudo du
# --block-size=M -a / | sort -n -r | head -n 10 empty astpp.logs
echo "Emptying astpp logs"
cd /var/log/astpp/
> astpp.log
# empty freeswitch logs
echo "Emptying freeswitch logs"
cd /usr/local/freeswitch/log/
@dedayoa
dedayoa / fail2ban-reset-log-db.sh
Created December 8, 2017 23:17 — forked from mitchellkrogza/fail2ban-reset-log-db.sh
Bash script to reset Fail2Ban - clears / truncates log file and deletes the sqlite database - stops and restarts service during this process.
#!/bin/bash
# Bash Script by https://gist.github.com/mitchellkrogza
# ************************************************************
# This script clears the log file and database of Fail2Ban
# This resets Fail2Ban to a completely clean state
# Useful to use after you have finished testing all your jails
# and completed your initial setup of Fail2Ban and are now
# putting the server into LIVE mode
# ************************************************************
@dedayoa
dedayoa / middleware.py
Created April 3, 2017 13:31
Django middleware to automatically log user out after X minutes
import arrow #you can use datetime here
from django.contrib import auth
from django.utils import timezone
from django.conf import settings # where I have set FORCE_LOGOUT_IN to 5
class AutoForceLogoutMiddleware(object):
SESSION_KEY = 'auto-force-logout'
def __init__(self, get_response=None):