Skip to content

Instantly share code, notes, and snippets.

View matthiassb's full-sized avatar
🎯
Focusing

Matthias Brooks matthiassb

🎯
Focusing
View GitHub Profile
@matthiassb
matthiassb / Purge_CloudWatchAlarms.py
Created February 24, 2020 04:59 — forked from jonathanwcrane/Purge_CloudWatchAlarms.py
Purge CloudWatch alarms for instances that no longer exist
#Step 1: Get a list of all alarms in INSUFFICIENT_DATA status
#Step 2: Get a list of all instances (stopped and started)
#Step 3: Find all alarms on instances that don't exist, and delete them
###################################################
#Step 1: Get alarms in INSUFFICENT_DATA state
###################################################
#The max that we can get per loop is 100; all alarms for nonexistent instances will be in
#INSUFFICIENT_DATA state so let's just go through those.
insuff_alarms = []
loops = 1
@matthiassb
matthiassb / dns-sync.sh
Last active March 20, 2024 12:12
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO
install
text
reboot
url --url http://mirror.centos.org/centos/6/os/x86_64
lang en_US.UTF-8
keyboard us
skipx
network --device eth0 --bootproto dhcp
rootpw test1234
@matthiassb
matthiassb / auth-duo.py
Created July 31, 2016 03:31
PAM LDAP Authentication with two-factor authentication with DUO in python
import duo_client
import ldap
auth_api = duo_client.Auth(
ikey='<ikey>',
skey='<skey>',
host='<host>',
)
LDAP_SERVER = 'ldap://10.1.0.143'
@matthiassb
matthiassb / importCert.sh
Last active April 1, 2022 08:50
Bash script for importing certificate chain into a JAVA truststore
#!/usr/bin/env bash
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
usage() {
echo "
-h [required] <hostname>
@matthiassb
matthiassb / SSLPoke.java
Last active August 29, 2015 14:13 — forked from 4ndrej/SSLPoke.java
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import java.io.*;
/** Establish a SSL connection to a host and port, writes a byte and
* prints the response. See
* http://confluence.atlassian.com/display/JIRA/Connecting+to+SSL+services
*/
public class SSLPoke {
public static void main(String[] args) {
git log | perl -n -e '/commit (.*)/ && print "$1\n"' | awk "NR==`git status | grep -Po "(\d) commit" | tr -d [a-z] | xargs -n 1 expr 1 +`" | xargs -n 1 git reset --soft