Skip to content

Instantly share code, notes, and snippets.

Glen Chiacchieri Glench

Block or report user

Report or block Glench

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Glench
Glench / body_reminder.py
Created Apr 26, 2019
A meditation reminder app when I'm using the computer
View body_reminder.py
# This Python file uses the following encoding: utf-8
import subprocess
import time
breathing_time = 30 # seconds
interval_between_breathing = 25 * 60 # seconds
applescript = """
display dialog "Breathe and make a home of your body" ¬
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()
You can’t perform that action at this time.