Skip to content

Instantly share code, notes, and snippets.


Geoffrey Plitt GeoffreyPlitt

View GitHub Profile
GeoffreyPlitt / Feedly Export Bookmarklet
Last active Jan 16, 2021
Feedly Export Bookmarklet
View Feedly Export Bookmarklet
javascript: navigator.clipboard.writeText(Array.from(document.querySelectorAll('.entry')).map(block => {
var entry = block.childNodes[1];
var heading = entry.children[0];
var summary = entry.children[3];
return (heading.href + '\n' + heading.text + '\n' + summary.textContent.trim() + '\n\n')
GeoffreyPlitt / example.js
Created Jan 8, 2019
Debounce with class method
View example.js
const _ = require('lodash')
class MyClass {
trigger() {
_.debounce(this.func.bind(this, 7), 100)()
func(v) {
View num_to_cols.js
const _ = require('lodash')
const numbers_to_test = _.range(1, 20)
const cols = [3, 4]
const num_to_cols = (n) => {
// look for exact matches
const exact_matches = cols.filter(col => n % col === 0)
if(exact_matches.length>0) return exact_matches[0]
// otherwise, return the one with highest remainder (fewest holes)
GeoffreyPlitt / gist:3e793985bf588f0fdb1b05559d0d70b1
Created Apr 4, 2017
Android SDKs available as of April 2017
View gist:3e793985bf588f0fdb1b05559d0d70b1
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/build-tools/23.0.1/package.xml
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/build-tools/23.0.2/package.xml
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/build-tools/24.0.3/package.xml
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/build-tools/25.0.1/package.xml
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/build-tools/25.0.2/package.xml
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/emulator/package.xml
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/extras/android/m2repository/package.xml
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/extras/google/m2repository/package.xml
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/patcher/v4/package.xml
Info: Parsing /usr/local/Caskroom/android-sdk/25.2.3/platform-tools/package.xml
GeoffreyPlitt / blah.js
Last active Oct 13, 2016
Cloudinary REST upload via fetch()
View blah.js
function upload_to_cloudinary(uri) {
let timestamp = ( / 1000 | 0).toString()
let hash_string = 'timestamp=' + timestamp + cloudinary_config.api_secret
let signature = CryptoJS.SHA1(hash_string).toString()
let upload_url = '' + cloudinary_config.cloud_name + `/video/upload`
const formdata = new FormData()
formdata.append('file', {uri, type: 'video/mp4', name: 'upload.mp4'})
formdata.append('eager', 'c_fill,h_1280,w_720|c_fill,h_853,w_480')
formdata.append('eager_async', true)
View gist:3d7b088808d81ef2787f

NES30 "Mode 2" Keyboard Mapping

NES30 Mapped to
Up c
Down d
Left e
Right f
L k
GeoffreyPlitt /
Created Dec 29, 2014
Convert a folder of .URL files to a bookmarks.html file that can be imported into a browser
# Run this script in a folder full of ".url" files, and pipe output to an HTML file.
# Example: ./ > bookmarks.html
echo "<!DOCTYPE NETSCAPE-Bookmark-file-1>"
echo '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">'
echo '<TITLE>Bookmarks</TITLE>'
echo '<H1>Bookmarks</H1>'
echo '<DL><p>'
View gist:a1b8866c982817c97dfb
var fake_redis = require("fakeredis");
var QUEUE_NAME = 'incoming_mturk_events';
var concurrency = 1;
var max_size = 10;
var kue = require('kue');
var in_memory_queue = kue.createQueue({
redis: {
createClientFactory: function(){
GeoffreyPlitt / gist:be3601dce8cb740c960a
Created Oct 14, 2014
Use Python/Boto to upload SSL cert to Amazon CloudFront
View gist:be3601dce8cb740c960a
from boto import connect_iam
iam_conn = connect_iam()
_dir = '/some/folder/'
cert_name = 'wildcard'
cert_chain = open(_dir + 'gd_bundle-g2-g1.crt').read()
cert_body = open(_dir + 'mysite.crt').read()
private_key = open(_dir + '').read()
path = '/cloudfront/'
print iam_conn.upload_server_cert(cert_name, cert_body, private_key, cert_chain, path)

This is an example command for Backtick. A Backtick command consists of some executable JavaScript and a bit of metadata in JSON.

Here are the required steps to create a command:

  1. Create a new Gist with a command.js and command.json file, or simply fork this one.

  2. Write your JavaScript in command.js. This will be injected into and executed on the page the user is currently on when they run it.

  3. Add some metadata to the command.json file:

  • name: The name of the command.