Skip to content

Instantly share code, notes, and snippets.

View huwcbjones's full-sized avatar

Huw Jones huwcbjones

View GitHub Profile
@huwcbjones
huwcbjones / autoexec.cfg
Last active June 30, 2019 11:39
CSGO AutoExec
// Crosshair
cl_crosshairalpha "255"
cl_crosshaircolor "5"
cl_crosshaircolor_b "255"
cl_crosshaircolor_r "255"
cl_crosshaircolor_g "0"
cl_crosshairdot "1"
cl_crosshairgap "0"
cl_crosshairsize "0"
cl_crosshairstyle "4"
@huwcbjones
huwcbjones / apache-users
Created February 20, 2018 15:34
A dropin replacement for apache-users.pl written in Python 3
#!/usr/bin/env python3
import sys
import threading
import argparse
import requests
import concurrent.futures
import logging
from urllib.parse import unquote
logging.basicConfig(format="%(asctime)s[%(levelname)8s][%(module)s] %(message)s", datefmt="[%m/%d/%Y %H:%M:%S]")
@huwcbjones
huwcbjones / maildump.py
Last active October 24, 2018 13:19
`sendmail` replacement to dump emails into files instead of sending them
#!/usr/bin/env python
import os
import sys
from datetime import datetime
from uuid import uuid4
out_dir = "/var/log/mail/" + datetime.now().strftime("%Y-%m-%d") + "/"
if not os.path.exists(out_dir):
@huwcbjones
huwcbjones / md5_sum.py
Last active January 4, 2019 23:01
create an md5sum for each file in a directory
#!/usr/bin/env python3
import os
import argparse
import re
import subprocess
from typing import Optional, Union
parser = argparse.ArgumentParser(description="Calculate or validate md5 sums for each file in a given directory")
parser.add_argument("mode", choices=["calculate", "validate"])
@huwcbjones
huwcbjones / f_to_c.user.js
Last active November 9, 2021 05:20
TamperMonkey script to auto convert Fahrenheit in Celsius
// ==UserScript==
// @name Fahrenheit to Celsius
// @namespace https://gist.github.com/huwcbjones/a7d24b0a237db9f2f5880e9e477518b8
// @version 0.2.1
// @description Converts Fahrenheit to Celsius
// @author huwcbjones
// @grant none
// @match *://*/*
// ==/UserScript==
@huwcbjones
huwcbjones / remove-modal-open.user.js
Last active November 2, 2018 23:57
Remove modal-open from body on window load
// ==UserScript==
// @name Remove "modal-open"
// @namespace https://gist.github.com/huwcbjones/86c9f3923a058ca5f0490871e1acebd3
// @version 0.1.2
// @description Remove modal-open from body on window load
// @author huwcbjones
// @grant none
// @match *://*/*
// ==/UserScript==
@huwcbjones
huwcbjones / stackoverflow-portrait-fixer.user.js
Last active November 24, 2018 20:35
Fix portrait view on new stackoverflow layout
// ==UserScript==
// @name Stackoverflow Portrait Fixer
// @namespace https://gist.github.com/huwcbjones/ed75b853f1a08fbf8ffa353ff1650205
// @version 0.1
// @description Fix portrait view on new stackoverflow layout
// @author huwcbjones
// @match *://stackoverflow.com/*
// @grant none
// ==/UserScript==
@huwcbjones
huwcbjones / checksum.py
Created December 18, 2018 19:01
Hy-Tek Checksum Functions
def calculate_hy3_sum(line: str) -> int:
data = "{:<128}".format(line) # pad to 128 chars
odd_sum = sum([ord(data[c]) for c in range(0, len(data), 2)]) # sum odd chars
even_sum = sum([ord(data[c]) for c in range(1, len(data), 2)]) # sum even chars
checksum = math.trunc((odd_sum + 2 * even_sum) / 21) # add odd + 2 * even, then /21, ignore decimal
checksum += 205 # add 205 to result
checksum = int(str(checksum)[:-3:-1]) # take last 2 digits of result and reverse
return checksum
@huwcbjones
huwcbjones / le-nginx.conf
Created March 9, 2019 18:45
Let's Encrypt nginx config
location /.well-known {
add_header Last-Modified "";
add_header X-Frame-Options "SAMEORIGIN";
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
alias /var/www/html/.well-known;
}
@huwcbjones
huwcbjones / transmission.rules
Last active May 21, 2019 23:53
iptables entry for a transmission kill switch if tun0 fails
# Generated by iptables-save v1.6.0 on Wed May 22 00:46:27 2019
# GID 111 is debian-transmission on debian-9
*filter
:INPUT ACCEPT [9605:9425451]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [14265:17182494]
# allow out from RPC port on local net (change to your own subnet)
-A OUTPUT -d 10.0.0.0/8 -p tcp --sport 9091 -m owner --gid-owner 111 -j ACCEPT