Skip to content

Instantly share code, notes, and snippets.

@Glench
Glench / music.txt
Last active August 29, 2015 14:12
artist/title track listing from http://labrosa.ee.columbia.edu/millionsong/
This file has been truncated, but you can view the full file.
Faster Pussy cat<SEP>Silent Night
Karkkiautomaatti<SEP>Tanssi vaan
Hudson Mohawke<SEP>No One Could Ever
Yerba Brava<SEP>Si Vos Querés
Der Mystic<SEP>Tangle Of Aspens
David Montgomery<SEP>Symphony No. 1 G minor "Sinfonie Serieuse"/Allegro con energia
Sasha / Turbulence<SEP>We Have Got Love
Kris Kross<SEP>2 Da Beat Ch'yall
Joseph Locke<SEP>Goodbye
The Sun Harbor's Chorus-Documentary Recordings<SEP>Mama_ mama can't you see ?
var baseUrl = 'http://127.0.0.1:5000';
var wikipedify = function(best_guess) {
return 'https://en.wikipedia.org/wiki/Special:Search/'+best_guess;
};
var makeLink = function(href, text, title) {
return '<a href="'+href+'" target="_blank" title="'+title+'">'+text+'</a>';
};
$('img').each(function(i, img) {
var $img = $(img)
$.get(baseUrl+'?image_url='+window.location.href+img.getAttribute('src')).done(function(data) {
@Glench
Glench / gist:b1a99b5e75d50e162411
Last active August 29, 2015 14:09
Wikipedia visited
var body = document.querySelector('body');
var styleNode = document.createElement('style');
var cssTextNode = document.createTextNode('#content a:visited { color: rgb(41, 229, 41) !important; }');
styleNode.appendChild(cssTextNode);
body.appendChild(styleNode);
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
}
canvas {
@Glench
Glench / gist:8508781
Created January 19, 2014 18:19
get wikipedia titles in a file
curl http://dumps.wikimedia.org/enwiki/latest/enwiki-latest-all-titles-in-ns0.gz | gunzip | sed 's/_/ /g' | grep -v '(redirect)$'
@Glench
Glench / all_caesar_ciphers.py
Created January 19, 2014 05:46
Get all the caesar ciphers for a given string.
# print all caesar ciphers
# python caesar.py word
import sys
for offset in range(1,26):
word = ''
for letter in sys.argv[1].lower():
num_of_letter = ord(letter)
new_num = num_of_letter + offset
@Glench
Glench / format_twitter_favorites.js
Last active January 2, 2016 21:59
Format twitter favorites to make better for browsing.
$('.global-nav').remove()
$('.dashboard').remove()
$('.profile-header').remove()
$('#page-container').css({
'padding': 0,
'background': 'none'
})
$('.dogear').css({
display: 'none'
})
@Glench
Glench / generate_all_font.py
Last active January 1, 2016 15:19
Generate a web page of all fonts installed on your Mac. Sample here: http://glench.com/all-fonts.html
import Cocoa
from jinja2 import Template
template = Template(u"""
<html>
<head>
<title>All Fonts Preview</title>
<style>
html, body {
margin: 0;
@Glench
Glench / python-async-callback.py
Last active August 2, 2021 10:34
An example of how to vary a parameter for an async callback function in python. Hint: don't use lambda functions in loops!
"""
We want to run a function asychronously and run a
callback function with multiple parameters when it
returns!
In this example, we are pretending we're analyzing
the names and ages of some people. We want to print
out:
jack 0
@Glench
Glench / feelinglucky.xml
Created May 30, 2013 16:22
I'm Feeling Lucky Search in Chrome's Omnibar *with suggestions*. Open up javascript console ("developer tools") in chrome and run window.external.AddSearchProvider('URL TO RAW XML')
<SearchPlugin xmlns="http://www.mozilla.org/2006/browser/search/">
<ShortName>Google I'm Feeling Lucky</ShortName>
<Description>Google I'm Feeling Lucky Instant</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16">data:image/x-icon;base64,R0lGODlhEAAQAPfLAAATVikwdA8SnxUfgAsWpAAilholjxw4jBc7kwAlvQQ2sRMsoBUqqhMzuhY/vxw4tSgmiyM1mSUztiQ6sTE3sQ4qyxMxxRoyxiAuxR1CtBxJsBxasSJuuTFguBte0Rlf2xVc9h9W9xVjzxVr0gdj6BRh4R1o5yBcyiZbyydT1i9b2Ddb1iFY6CJg2Vpor1dzvEJu20Z0yi23QDy1REi2OUy0O1WzOVC4PU+tVUe5Sk2xQU2zRUO4UE21Ula2SmKEqWWF2HyPx2+a6X6e6Xqk1m+s78sUDs4UGdEQB9YfDdwaANEfHd0YEscjAM4mAM0qANIoD9IkGdslGswuItYgL4aP0ImP2YGZ36Opzaq2wq/S+rzX/7/e8MrS1MLO/sTb48rT8snX/83c89PZ+crq+cH1/9Dl/9Ln/93r/9fy/+Hf7P/42eDm/O7u/+T29uX2/eT2/+f4/+f5/+j/9u//8+3/9u7/9ur5/+j//+n//+v//u3//+7//e7//+////b66/T/6vX/6/f/7f/07fj/4fv/4Pj/5v/45v7/4/r+7/3/6fDw+Pfx//D/9/X/8fT/8/f/8ff/8/D///H///L8/fL///P///X7//b6/ff/+/T///b9//f///v19//w9v/09P/29v/x+f/y///z///1+v/1///2///3//j79P/58/z/8/z99/z/9v7/9P7/9vn7//v6//j9//n9//j///n//