Skip to content

Instantly share code, notes, and snippets.

View jhazelwo's full-sized avatar

John Hazelwood jhazelwo

View GitHub Profile
@jhazelwo
jhazelwo / container.sh
Created November 4, 2017 01:55 — forked from jhazelwo-charter/container.sh
Docker script to aid with building and running containers
#!/bin/sh
#
# Default Example
contname="" # contname="spaceship"
image_name="" # image_name="zbeeblebrox/${contname}:1.0"
nodename="" # nodename="--hostname=${contname}"
runname="" # runname="--name=${contname}"
run_rm="" # run_rm="--detach"
build_rm="" # build_rm="--force-rm=true"
port="" # port="-p `hostname -i`:80:80 -p `hostname -i`:443:443"
#!/usr/bin/env python
def is_factor_of(number, factor):
if number % factor == 0:
return True
return False
def fizzbuzz(i):
fizz = 3
buzz = 5
@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
@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 / 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
def xkcd_1790(this):
# No, YOU fscking deal with this.
return this
words = ['aardvark',
'abaci',
'aback',
'abaft',
'abalone',
'abandon',
'abase',
'abased',
'abash',
'abashed',
@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
="--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 \

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: