Skip to content

Instantly share code, notes, and snippets.

View mavc's full-sized avatar

maverick mavc

  • Vancouver, BC
View GitHub Profile
package alg;
import java.util.Arrays;
import java.util.Collection;
public class BinaryHeap<T extends Comparable<? super T>> {
private Object[] m_itemArray;
private int m_length;
private int m_capacity;
// ==UserScript==
// @name Lyric Select
// @namespace github.com/mavc
// @include http://www.kasi-time.com/*
// @include http://j-lyric.net/*
// @include https://www.uta-net.com/*
// @version 1.0
// @grant unsafeWindow
// ==/UserScript==
@mavc
mavc / x_to_mintty.py
Last active October 19, 2017 23:39
Convert 16-color X resources themes to MinTTY
import argparse
import re
import sys
PAT = re.compile(r'^\*\.?(\w+):\s+#([a-fA-F0-9]{6})')
MAPPING = {
'cursorColor': 'CursorColour',
'background': 'BackgroundColour',
'foreground': 'ForegroundColour',
@mavc
mavc / hybrid-new-window.gesture.js
Created September 28, 2017 17:08
Foxy Gestures: Hybrid New Window | Open Link In New Window
executeInBackground(async (data) => {
return browser.windows.create({url: data.element.linkHref});
}, [data]).catch((e) => {
console.error(e);
});
@mavc
mavc / hybrid-new-tab.gesture.js
Created September 28, 2017 17:08
Foxy Gestures: Hybrid New Tab | Open Link In New Tab
executeInBackground((data) => {
return data.element.linkHref
? commandOpenLinkInNewTab(data)
: commandNewTab(data);
}, [data]).catch((e) => {
console.error(e);
});
@mavc
mavc / close-tab-focus-left.gesture.js
Last active September 28, 2017 03:24
Foxy Gestures: Close Tab and Focus Left
executeInBackground(async () => {
const tabs = await browser.tabs.query({currentWindow: true});
const activeTab = tabs.find((t) => t.active);
if (activeTab.index > 0) {
// Set the current tab to the tab on the left.
let nextTab = tabs.find((t) => t.index == activeTab.index - 1);
await browser.tabs.update(nextTab.id, {active: true});
}
// Close the current tab.
await browser.tabs.remove(activeTab.id);
from __future__ import print_function
import os
from os import path
from PIL import Image
import shutil
from sys import argv
EXTENSIONS = ('.jpg', '.png')
WALLPAPER_RATIO_MIN = 1.25
// ==UserScript==
// @name twimg-icon
// @namespace github.com/mavc
// @description Download source images on Twitter.
// @include https://twitter.com/*
// @exclude https://twitter.com/i/*
// @version 1.1.1
// @require https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js
// @grant none
// ==/UserScript==
@mavc
mavc / th.rafo.user.js
Created August 30, 2016 04:22
Add < Prev and Next > Navigation for RAFO threads.
// ==UserScript==
// @name Thread.And.Find.Out
// @namespace mavc
// @description Add < Prev and Next > Navigation for RAFO threads.
// @match http://*.readandfindout.com/*
// @version 1.0.0
// ==/UserScript==
function getNext(t) {
// get first child, next sibling, or getNext() of parent.
// ==UserScript==
// @name Kasi-Time Select
// @namespace github.com/mavc
// @include http://www.kasi-time.com/*
// @version 1.0
// @grant unsafeWindow
// ==/UserScript==
(function() {
/*