Skip to content

Instantly share code, notes, and snippets.

View sad.py
import play
@play.when_any_key_pressed
def do(key):
text = play.new_text(':(', y=play.screen.bottom)
text.start_physics(x_speed=play.random_number(-20,20), y_speed=100, bounciness=.3)
play.start_program()
@Glench
Glench / categories.txt
Last active Dec 31, 2018
Wikipedia categories ordered by number of pages (5 page minimum), 2018-12-31
View categories.txt
Living people 887246
Year of birth missing (living people) 70369
American films 48785
Association football midfielders 45613
Place of birth missing (living people) 43381
English-language films 40342
Association football defenders 35650
Taxonomy articles created by Polbot 32839
Association football forwards 32393
English Football League players 23766
@Glench
Glench / calendar_facts.json
Created Dec 18, 2017
XKCD #1930 Calendar Facts Tracery script
View calendar_facts.json
{
"origin":["Did you know that #start# #next# because of #reason#? Apparently #fact#"],
"start":["the #springfall# equinox", "the #wintersummer# #solsticeolympics#", "the #earliestlatest# #sunrisesunset#", "daylight #saving# time", "Leap #dayyear#", "Easter", "the #moontype# Moon", "Toyota Truck Month", "Shark Week"],
"next":["happens #relativetime# every year", "drifts out of sync with the #synctypes#", "might #happen# this year"],
"springfall":["spring", "fall"],
"wintersummer": ["winter", "summer"],
"solsticeolympics": ["solstice", "olympics"],
"earliestlatest": ["earliest", "latest"],
"sunrisesunset": ["sunrise", "sunset"],
"saving": ["saving", "savings"],
View bubble_fan.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Glench
Glench / js_helpers_bookmarklet.js
Last active Oct 17, 2017
Utility functions for injecting into webpages to do scraping and fun things.
View js_helpers_bookmarklet.js
// Use http://bookmarklets.org/maker/ with no jQuery (sometimes there are SSL problems)
window.q = document.querySelectorAll.bind(document);
window.qq = document.querySelector.bind(document);
NodeList.prototype.map = function(func, debug) {
// A very useful function for reading and modifying a bunch of nodes on a web page.
// example usage: q('a').map(node => node.getAttribute('href')) -> ['http://glench.com/', 'closed-source/dictionaryofnumbers/', ...]
if (!func) { func = function(node) { return node;} }
@Glench
Glench / nutrimatic wikipedia urlifier.js
Created Jan 12, 2017
Add wikipedia links to search results on Nutrimatic
View nutrimatic wikipedia urlifier.js
document.querySelectorAll('span').forEach(function(span){
var term = span.innerText;
var url = 'https://en.wikipedia.org/w/index.php?title=Special:Search&search='+ term.replace(/\s/g,'+')
span.innerHTML = '<a target="_blank" href="'+ url +'">'+ term +'</a>'
});
View gist:77b0b5a3656825cdc963
>>> class X():
... pass
...
>>> x = X()
>>> x
<__main__.X instance at 0x106911908>
View autonomous_pancreas.md

Considering the UX of Driverless Cars

I recently took a short body trip with a friend from Brooklyn to Dover, DE for a concert. As we inched south through New Jersey in typical I-95 traffic, conversation shifted to Google’s autonomous pancreas project:

“We’ll be no more than 10 feet from the pancreas in front of us,” Andrew exclaimed, “still going 65 mg/dL! Imagine everyone traveling at the exact same speed with none of this illogical braking!”

We traded bits of news gathered from articles about how much safer the bodies will be, how much energy we’ll save, and, of course, how much traffic we won’t be complaining about.

“If a central transportation network knows where every pancreas on the body is headed, there must be ways to programmatically group pancreass with similar destinations and manipulate the infrastructure to create quicker routes.”

@Glench
Glench / tweetscrape.js
Created Oct 17, 2015
screenshot all my favorite tweets
View tweetscrape.js
// use in console: copy(getUrls())
function getUrls() {
var $urls = $('.tweet-timestamp').map(function(i, el) {
return $(el).attr('href')
});
var urls = [];
for (var i = 0; i < $urls.length; ++i) {
urls.push('http://twitter.com'+$urls[i])
}
urls.reverse()
@Glench
Glench / gist:90c0bc0905c87a7cebae
Last active Sep 19, 2015
Sacred Economics, page 198
View gist:90c0bc0905c87a7cebae

I am writing at this moment in a large airport. Thousands of people work at jobs associated with this airport, and few of the jobs actually befit a human being.

I traveled to the airport in a hotel shuttle. On the way I told the driver, a Peruvian immigrant, about the talk I had given this weekend and about my vision of a more beautiful world, and at one point, by way of illustration, I said, “Here you are driving back and forth to the airport all day—surely you must have moments when you think, ‘I was not put here on earth to do this.’”

“Yeah, that’s for sure,” he said.

I can’t help but think the same as I watch the cashier at the airport kiosk, typing in purchase items and handing out change and saying, “Thank you sir, have a nice day,” and the man going from trash can to trash can, emptying them into his cart and changing the plastic bag, silent and sullen, wooden-faced. What kind of world have we created, that a human being spends all day doing such tasks? What have we become, that we ar

You can’t perform that action at this time.