Skip to content

Instantly share code, notes, and snippets.

View adammw's full-sized avatar
👨‍💻
Hacking on Kubernetes Platform @ Zendesk

Adam Malcontenti-Wilson adammw

👨‍💻
Hacking on Kubernetes Platform @ Zendesk
View GitHub Profile
/**
*
* Base64 encode / decode module for node.js
* Uses URL-specifc base64 encoding
* Based on http://www.webtoolkit.info/
*
**/
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=";
// private method for UTF-8 encoding
var utf8_encode = function (string) {
@adammw
adammw / gs_perm_alive.js
Created December 5, 2010 10:06
GrooveShark Permanent Alive
// This snippet will prevent Grooveshark from pausing every 30 minutes, and tell it that you are alive,
// restoring the old Flash-player behaviour.
// Please note: This "alive" check is done only to non-VIP users, and may be a way of ensuring idle users
// don't waste server resources. Please only use if you are actually listening to Grooveshark, or purchase VIP
GS.lightbox.open_=GS.lightbox.open;GS.lightbox.open=function(a,b){if(a=='interactionTime'){GS.player.resumeSong();return}GS.lightbox.open_(a,b)}
@adammw
adammw / gs_htmlswf_v8.js
Created January 14, 2011 17:07
Grooveshark HTML5 Audio Injector
/*
* Grooveshark HTML5 Audio Injector for Flash-less browsers
* <https://gist.github.com/gists/779895>
* Version 0.0.8
*
* To use, simply copy and paste this code into the Developer Console
* for the open Grooveshark page and hit enter. Only tested with Google Chrome.
*
* Porting to Javascript Copyright (C) 2011 Adam Malcontenti-Wilson <[email protected]>
* All other elements Copyright (C) Escape Media Group ("Grooveshark")
@adammw
adammw / YouTube Save Video RickRoll Remover.js
Created January 18, 2011 07:30
YouTube HTML5 "Save Video As..." RickRoll Remover
// Run this on the YouTube page - either in developer tools or elsewhere
if (document.querySelector('a.yt-uix-button-menu-item[href="http://www.youtube.com/watch?v=dQw4w9WgXcQ"]')) { document.querySelector('a.yt-uix-button-menu-item[href="http://www.youtube.com/watch?v=dQw4w9WgXcQ"]').href = document.querySelector('video').src; }
// Note to YouTube: This stupid stunt just makes people angry - don't rickroll the users of your site. In fact, adding the link just helps the downloaders as extensions need much less work to add a context menu now, all they have to do is hook into your save video as link.
@adammw
adammw / mafiawars_mobile_fight_bot.js
Created February 6, 2011 13:29
Mafia Wars Mobile Fight Bot
var MafiaWarsMobileFightBot = function() {
var fightUrl = 'mobileweb?xw_controller=fight&xw_action=view_mobile';
var estimateStrengthWeights = {mafia: 1.5, level: 1.0};
var strengthDifferenceThreshold = 0.15;
//TODO: add UI
//TODO: handle hospital case, if $('.hospital-block').length . heal-text and heal-button will describe action and cost
//TODO: implement lower end of strength threshold (e.g. don't fight too weak opponents)
function is_fights_page() {
@adammw
adammw / google_search.c
Created March 11, 2011 13:04
search from the command line
/*
* main.c
*
* Created on: 11/03/2011
* Author: adam
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
/* FILE: error1.c
* Week 2 lab exercise 1
* Author: Adam Malcontenti-Wilson <[email protected]>
* Last Modified <Wed Mar 9 10:57:24 EST 2011>
*/
#include <stdio.h>
int main()
{
@adammw
adammw / task4.c
Created March 23, 2011 10:01
HIT2080 Lab 3
/* FILE: tasks4.c
* Author: Adam Malcontenti-Wilson <[email protected]>
* Last Modified: 17/03/2011 12:20:00 PM
*
* Description: Printing hard-coded scores
* Inputs: none
* Outputs: Text in specifc format specified
*/
#include <stdio.h>
@adammw
adammw / tt2srt.py
Created April 12, 2011 09:44
Timed Text Captions to SRT Subtitles converter script
# Usage: python tt2srt.py source.xml output.srt
from xml.dom.minidom import parse
import sys
i=1
dom = parse(sys.argv[1])
out = open(sys.argv[2], 'w')
body = dom.getElementsByTagName("body")[0]
paras = body.getElementsByTagName("p")
for para in paras:
@adammw
adammw / nyancat.js
Last active September 25, 2015 23:58
Facebook Nyan Cat... Inject with `javascript:s=document.createElement('script');s.src='https://bit.ly/110kHu0';document.body.appendChild(s);`
/* Facebook Nyan Cat
* Works only in Webkit browsers
* Uses images + sound from http://nyan.cat
*/
var NyanCat = (function NyanCatFacebook() {
const updateInterval = 10;
var nyan, rainbows, sound;
var loadingPosts = false;
var top = 0;
var interval = null;