Skip to content

Instantly share code, notes, and snippets.

View mitcdh's full-sized avatar

Mitchell Hewes mitcdh

View GitHub Profile
@mitcdh
mitcdh / _photo-box.scss
Last active January 13, 2024 08:33
SASS to give a responsive photo gallery the slight rotation of pictures spilled across a table effect
$photoRotation: 4deg; // Allows setting the alternating photo rotation
$breakpoints: (
1200: 4,
// 4 columns for screens wider than 1200px
800: 3,
// 3 columns for screens wider than 800px
600: 2,
// 2 columns for screens wider than 600px
400: 1 // 1 column for screens wider than 400px,
);
@mitcdh
mitcdh / countries.py
Last active February 17, 2023 09:14
Script to parse the wikipedia "List of alternative country names", map to 3166-1 and generate a list of dicts
import requests
import pycountry
import json
import unicodedata
from bs4 import BeautifulSoup
def unicodeNormalizeCasefold(str):
return unicodedata.normalize("NFKD", str).casefold()
# URL to crawl, note that all data is taken straight from the wikipedia page
@mitcdh
mitcdh / nss-style.css
Last active September 20, 2022 10:15
(Unofficial) IAEA Safety Standards and Nuclear Security Guidance CSS Style
/* Styles recreated from 'Template for IAEA Safety Standards and Nuclear Security Guidance 20-06-26.docx' */
h1 {
text-transform: uppercase;
text-align: center;
font-weight: bold;
margin-top: 18pt;
margin-bottom: 24pt;
font-size: 12pt;
text-indent: 0.51cm;
}
@mitcdh
mitcdh / reactor-power.sh
Created August 31, 2018 03:21
ANSTO OPAL Reactor Power
#!/bin/sh
curl -L -s http://neutron.ansto.gov.au/Bragg/proposal/reactor.jsp\?type\=CALIBRATED_REACTOR_POWER
@mitcdh
mitcdh / protective-marking.filter
Created August 31, 2018 01:23
Exim Filter for Australian Government protective marking expansion
# Exim filter
# Only run this on the first pass through the filter
if not first_delivery then
finish
endif
# Trap any errors
if error_message then
finish
@mitcdh
mitcdh / Hyper Key.ahk
Created July 7, 2018 05:26
Hyper Key for Windows
;; based on @babygau's answer here https://stackoverflow.com/a/40559502
#NoEnv ; recommended for performance and compatibility with future autohotkey releases.
#UseHook
#InstallKeybdHook
#SingleInstance force
SendMode Input
;; deactivate capslock completely
SetCapslockState, AlwaysOff
@mitcdh
mitcdh / pms-util-env
Created July 6, 2018 03:44
pms-docker environment variables for local operation
export LD_LIBRARY_PATH="/usr/lib/plexmediaserver"
export LANG="en_US.UTF-8"
export PLEX_MEDIA_SERVER_MAX_PLUGIN_PROCS="6"
export PLEX_MEDIA_SERVER_TMPDIR="/tmp"
export PLEX_MEDIA_SERVER_HOME="/usr/lib/plexmediaserver"
export PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR="/config/Library/Application Support"
@mitcdh
mitcdh / email2gcontact.txt
Last active May 24, 2018 04:04
Email To: to Google Contact Regex
# Written for use in atom :: https://atom.io/
# Regex in the format "First_Name Other_Names (Company) <email@address>"
(\w+)\s([\w\s']+)\s\(([^\)]+)\)\s<([^>]+)>,\s
# CSV Header
Name,Given Name,Additional Name,Family Name,Yomi Name,Given Name Yomi,Additional Name Yomi,Family Name Yomi,Name Prefix,Name Suffix,Initials,Nickname,Short Name,Maiden Name,Birthday,Gender,Location,Billing Information,Directory Server,Mileage,Occupation,Hobby,Sensitivity,Priority,Subject,Notes,Group Membership,E-mail 1 - Type,E-mail 1 - Value,Organization 1 - Type,Organization 1 - Name,Organization 1 - Yomi Name,Organization 1 - Title,Organization 1 - Department,Organization 1 - Symbol,Organization 1 - Location,Organization 1 - Job Description
# Replacement
"$1 $2","$1",,"$2",,,,,,,,,,,,,,,,,,,,,,,"* My Contacts ::: Cyber","* Work","$4",,"$3",,,,,,\n
@mitcdh
mitcdh / 20-system-info
Created March 6, 2018 00:43
Script for update-motd that includes a system information snapshot
#!/bin/sh
date=$(date)
load=$(cat /proc/loadavg | awk '{print $1}')
root_usage=$(df -h / | awk '/\// {print $(NF-1)}')
memory_usage=$(free -m | awk '/Mem/{printf("%3.1f%%"), $3/$2*100}')
swap_usage=$(free -m | awk '/Swap/{printf("%3.1f%%"), $3/$2*100}')
users=$(users | wc -w)
time=$(uptime | awk -F'( |,|:)+' '{print $6,$7",",$8,"hours,",$9,"minutes"}')
processes=$(ps aux | wc -l)
@mitcdh
mitcdh / config.gateway.json
Created February 28, 2018 07:12
USG IPv6 over PPPoE gateway config for Unifi versions 5.7.x
{
"interfaces":{
"ethernet":{
"eth0":{
"pppoe":{
"0":{
"ipv6":{
"address":{
"autoconf":"''"
},