Skip to content

Instantly share code, notes, and snippets.

@UnixSage
UnixSage / SES-Send.sh
Created September 17, 2020 20:01
Send email via AWS SES from the command line
#!/bin/bash
DOMAIN="example.com"
MAILFROM="cmdline@${DOMAIN}"
MAILTO="someone@example.com"
SUBJECT="Amazon SES SMTP Test from ${HOSTNAME}"
USER="AWSKEY"
PASSWORD="AWSSMTPPASSWORD"
SMTPHOST="email-smtp.us-east-1.amazonaws.com:587"
@UnixSage
UnixSage / CalcHours.py
Last active August 1, 2020 22:52
Evenly split arbitrary groups of hours evenly across work days in a month
#!/usr/bin/env python3
import calendar, datetime, holidays
import math
import os, json
# hours.json format
#
# {
# "Client1": 116,
@UnixSage
UnixSage / MonitorIP.py
Last active July 5, 2020 17:39
Simple script that will monitor a list of names and make sure the IPs match. Useful if you not using CNAMES for APEX domains. Output can be put on a web server and monitored for status.
#!/usr/bin/env python3
import socket
import datetime
domainlist = {
'home.mydomain.com': 'user.myisp.net',
'mydomain.com': 'account.myhosting.com'
}
@UnixSage
UnixSage / MemorablePassword.py
Last active December 31, 2019 15:24
Generate random word password that are "Datacenter Compatable" meaning realistically typable into a console.
#!/usr/bin/env python3
from random import choice,shuffle
import string
password=[]
words=[]
shortwords=[]
wordfile=open("/usr/share/dict/words")
@UnixSage
UnixSage / CertBotDuckDNS-AuthHook.sh
Last active November 13, 2019 17:05
Script to use with CertBot's --manual-auth-hook switch
#!/bin/sh
TOKEN="Your-Duck-DNS-Token"
BASEDOMAIN=`echo ${CERTBOT_DOMAIN} | awk -F. '{OFS="."; print $(NF-1),$(NF)}'`
echo $CERTBOT_DOMAIN
curl "https://www.duckdns.org/update?domains=${CERTBOT_DOMAIN}&token=${TOKEN}&txt=${CERTBOT_VALIDATION}"
@UnixSage
UnixSage / DataDogExtract.py
Last active September 12, 2019 15:24
Get a filtered Hostlist and Tags from DataDog
#!/usr/bin/env python3
import json
import requests
import os,sys,time,getopt
import configparser
helpinfo="""
Usage:
-s IncludeList
@UnixSage
UnixSage / 6to4haproxy.cfg
Last active September 21, 2018 13:07
IPv6 to IPv4 Proxy
frontend localnodes
bind :::443 v4v6
mode tcp
default_backend nodes
timeout client 1m
backend nodes
mode tcp
balance roundrobin
server W.X.Y.Z:443
@UnixSage
UnixSage / rock-bottom-calc.pl
Last active March 17, 2018 14:53
Rock Bottom Table Generator
#!/usr/bin/perl
# mod-ead-calc
# By: John C. Place
# http://www.unixsage.com
print <<EOT
Assumptions:
<ul>
<li>Stressed diver SAC rate 1cf/min
<li>1 min to sort out problem at depth
@UnixSage
UnixSage / mod-ead-calc.pl
Last active March 17, 2018 14:35
Generate EAD (Equivalent Air Depth) tables For SCUBA Diving
#!/bin/perl
# mod-ead-calc
# By: John C. Place
# http://www.unixsage.com
print "<title>Maximim Operating Depth and Eqivlant Air Depth Table</title>\n";
print "<table border cellpadding=\"3\">\n";
print "<caption>Maximim Operating Depth and Eqivlant Air Depth Table (fsw)</caption>";
for($x=20; $x <= 100; $x+=2) {
@UnixSage
UnixSage / haproxy.cfg
Last active March 17, 2018 14:20
Using haproxy as a shim between a SSLv3 Interface and a modern browser
global
daemon
maxconn 1028
tune.ssl.default-dh-param 1024
user haproxy
group haproxy
log 127.0.0.1 local0
defaults
timeout connect 5000ms