Skip to content

Instantly share code, notes, and snippets.

View samplereality's full-sized avatar

Mark Sample samplereality

View GitHub Profile
@samplereality
samplereality / bookimages.js
Last active August 29, 2015 14:06
Bookmarklet Code for Historical Book Images Search on Flickr
javascript:void(q=prompt('Enter%20search%20term:',getSelection()));if(q)void(location.href='https://www.flickr.com/search/?w=126377022@N07&q='+escape(q))
@samplereality
samplereality / through_the_park.py
Created June 28, 2014 14:29
Nick Montfort's "Through the Park" short story generator
#!/usr/bin/python
# Through the Park, copyright (c) 2013 Nick Montfort <nickm@nickm.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
@samplereality
samplereality / markovmelville.js
Last active August 29, 2015 13:57
Markov Chains using Moby-Dick
var rita = require('rita');
var fs = require('fs');
rm = new rita.RiMarkov(2), file = 'moby-dick.txt';
rm.minSentenceLength = 5;
rm.maxSentenceLength = 20;
@samplereality
samplereality / metro.js
Created March 26, 2014 13:13
In a Station of the Metro bot
var Twit = require('twit');
var rita = require('rita');
// In a Station of the Metro
//
// The apparition of these faces in the crowd:
// Petals on a wet, black bough.
@samplereality
samplereality / longlive.js
Last active August 29, 2015 13:57
longlive.js
// This is a code comment.
// Any line preceded by two slashes
// will not be executed as code.
// (Even if the line has otherwise functioning code in it.)
// You can also use these double slashes _after_ a line of code,
// to serve as an in-line comment on that line of code.
// (Kinda like a note in the margin.)
// This little program requires "libraries"--other programs that extend the functionality of the base node.js code
#!/usr/bin/env node
var OAuth = require('oauth').OAuth;
var colors = require('colors');
var access_token = null;
var access_token_secret = null;
var key = null;
var secret = null;
@samplereality
samplereality / gist:4176962
Created November 30, 2012 16:54
Zotero Bookmarklet
javascript:var d=document,s=d.createElement('script');s.src='https://www.zotero.org/bookmarklet/loader.js';(d.body?d.body:d.documentElement).appendChild(s);void(0);