Skip to content

Instantly share code, notes, and snippets.

View jhazelwo's full-sized avatar

John Hazelwood jhazelwo

View GitHub Profile
@jhazelwo
jhazelwo / docker-on-efs.txt
Created December 16, 2016 13:14
Docker SystemD AWS EFS
install -d -m 0700 -o 0 -g 0 /etc/systemd/system/docker.service.d
echo '[Service]' > /etc/systemd/system/docker.service.d/efs.conf
echo 'ExecStart=' >> /etc/systemd/system/docker.service.d/efs.conf
echo "ExecStart=/usr/bin/dockerd -H fd:// -s devicemapper -g /data/$(hostname)/docker" >> /etc/systemd/system/docker.service.d/efs.conf
@jhazelwo
jhazelwo / fail.py
Last active December 31, 2023 20:59
Supress traceback for custom Python exceptions
#!/usr/bin/env python3
""" -*- coding: utf-8 -*-
Example Python3 Raise Exception without Traceback
Example Python3 Hide Traceback
Python3 Custom Exception Class
Python3 custom exception suppress traceback example
Python3 custom exception without traceback example
Example Python Raise Exception without Traceback
Example Python Hide Traceback
Python Custom Exception Class

Keybase proof

I hereby claim:

  • I am jhazelwo on github.
  • I am jhazelwo (https://keybase.io/jhazelwo) on keybase.
  • I have a public key whose fingerprint is 0C3C 5EE8 0632 3C11 6E37 B2F5 6ED0 B1E5 62A9 479C

To claim this, I am signing this object:

="--cap-add AUDIT_CONTROL \
--cap-add AUDIT_READ \
--cap-add AUDIT_WRITE \
--cap-add BLOCK_SUSPEND \
--cap-add CHOWN \
--cap-add DAC_OVERRIDE \
--cap-add DAC_READ_SEARCH \
--cap-add FOWNER \
--cap-add FSETID \
--cap-add IPC_LOCK \
@jhazelwo
jhazelwo / reclaimWindows10.ps1
Created January 7, 2017 19:14 — forked from alirobe/reclaimWindows10.ps1
"Reclaim Windows 10" turns off a bunch of unnecessary Windows 10 telemetery, removes bloatware, and privacy invasions. Review and tweak before running. Scripts for reversing are included and commented. Fork via https://github.com/Disassembler0 (different defaults)
##########
# Win10 Initial Setup Script
# Author: Disassembler <[email protected]>
# Version: 1.7, 2016-08-15
# dasm's script: https://github.com/Disassembler0/Win10-Initial-Setup-Script/
# THIS IS A PERSONALIZED VERSION
# This script leaves more MS defaults on, including MS security features.
# Tweaked based on personal preferences for @alirobe 2016-11-16 - v1.7.1
words = ['aardvark',
'abaci',
'aback',
'abaft',
'abalone',
'abandon',
'abase',
'abased',
'abash',
'abashed',
def xkcd_1790(this):
# No, YOU fscking deal with this.
return this
@jhazelwo
jhazelwo / confirm_delete.sh
Created March 25, 2017 18:22
Example shell script to confirm, with optional override, before doing something destructive.
#!/bin/sh
#
# confirm_delete.sh - Example shell script to confirm, with optional override, before doing something destructive.
#
removeit() {
# Code that does something destructive.
exit 0
}
if [ "$1" = "--force" ]; then
removeit
@jhazelwo
jhazelwo / iptables.sh
Last active October 12, 2024 17:45
iptables rules to only allow VPN traffic AND let user SSH to VPN server itself.
#!/bin/sh
# by: "John Hazelwood" <[email protected]>
#
# iptables rules to only allow VPN traffic AND let user SSH to VPN server itself.
# Use this on a CentOS/RedHat server you have set up to be a NAT firewall for your network.
# This will force ALL Internet traffic to go over the VPN
# and will BLOCK ALL Internet TRAFFIC if VPN is not running!
#
# use `service iptables save` to save the rules to /etc/sysconfig/iptables
# made
@jhazelwo
jhazelwo / idledots.sh
Created June 2, 2017 15:33
Visualize CPU idle time as dots on the command line.
#!/bin/sh
# idle cpu as dots
vmstat -n 1 | while read line; do
length=`echo $line|awk '{print $15}'|egrep "^[0-9]+$"`
test -n "$length" && {
echo -n $length
for e in `seq 1 $length `; do echo -n .; done;
echo '';
} || true
done