Skip to content

Instantly share code, notes, and snippets.

@ZaneHannanAU
ZaneHannanAU / Cargo.toml
Created March 10, 2020 09:53
stupid structopt thing
[package]
name = "structopt-example"
version = "0.1.0"
authors = ["Zane Hannan <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
structopt = { version = "0.3.11", features = [ "paw" ] }
@ZaneHannanAU
ZaneHannanAU / add-event-listeners.js
Last active June 4, 2018 11:35
Event listener add multiple simultaneous.
Object.defineProperty(self || this, 'addEventListeners', {
value: function addEventListeners(target, listeners, opts = {}) {
if (listeners === undefined)
return addEventListeners(this, target, opts)
if ('function' === typeof opts.init) opts.init.call(target)
if (opts.addSelf) Object.defineProperty(target, 'string' === typeof opts.addSelf ? opts.addSelf : addEventListeners.name, {
enumerate: true,
value: addEventListeners
})
for (const listener in listeners)
@ZaneHannanAU
ZaneHannanAU / fuckItUp.js
Last active April 13, 2018 07:23
mangadex forums fuck up your text
// ==UserScript==
// @name Rainbowfy
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://mangadex.org/forum
// @match https://mangadex.org/forums
// @match https://mangadex.org/forum/*
// @match https://mangadex.org/forums/*
@ZaneHannanAU
ZaneHannanAU / test-totp.js
Last active March 30, 2018 12:46
integrated totp (nodejs)
const {fn: {b32_buf, buf_b32, getOTP}} = require('./totp')
const givea = fuck => console.log('%s %j', fuck.length.toString().padStart(4), fuck.toString())
const it = process.hrtime()
const rt = ([s,ns] = process.hrtime(it)) => console.log('%ss elapsed', (s+ns/1e9).toFixed(9).padStart(12))
rt()
const fucks = Buffer.from('Hi there fucks')
givea(fucks)
@ZaneHannanAU
ZaneHannanAU / HorribleSubs.user.js
Created March 27, 2018 05:37
horriblesubs magnet links only
// ==UserScript==
// @name HorribleSubs
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match http://horriblesubs.info/*
// @grant none
// ==/UserScript==
@ZaneHannanAU
ZaneHannanAU / nu-series-autoadd.js
Created March 27, 2018 02:02
autoadd series novelupdates
// ==UserScript==
// @name NovelUpdates Series autoadd
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://www.novelupdates.com/series/*
// @grant none
// ==/UserScript==
@ZaneHannanAU
ZaneHannanAU / badwords.txt
Created July 25, 2017 04:49
A function to remove "bad" words from generated XKCD passwords.
# Newline separated badwords filter using Regular expressions
assh.*
bitch.*
chink
cunt.*
daygo
dick.*
douche
fag.*
fatass
// Server side NodeJS.
var dateFormat = module.exports = {}
dateFormat.opts = {
day: 'numeric',
hour: 'numeric',
minute: 'numeric',
month: 'long',
weekday: 'long',
year: 'numeric',
timeZoneName: 'long'
// Grab all images
for(i=0;i<document.images.length;i++)
{
// if document.images[i].getAttribute("data-src"){ // If there's a "data-src" attribute on them
document.images[i].src = document.images[i].getAttribute("data-src"); // Set the src value to that of the data-src value
document.images[i].style.visibility = "visible";
document.images[i].style.opacity = 1;
// }
}