Skip to content

Instantly share code, notes, and snippets.

View GeoffreyPlitt's full-sized avatar

Geoffrey Plitt GeoffreyPlitt

  • AuditBoard
  • Los Angeles
View GitHub Profile
@GeoffreyPlitt
GeoffreyPlitt / Feedly Export Bookmarklet
Last active March 25, 2023 23:10
Feedly Export Bookmarklet
javascript: navigator.clipboard.writeText(
Array.from(document.querySelectorAll("article"))
.map((entry) => {
const note = entry.querySelector('.EntryNote__description')?.textContent;
return (
entry.querySelector('a').href +
"\n" +
entry.querySelector('a').text +
"\n" +
(note ? note + "\n" : '') +
@GeoffreyPlitt
GeoffreyPlitt / blah.js
Last active October 13, 2016 20:20
Cloudinary REST upload via fetch()
function upload_to_cloudinary(uri) {
let timestamp = (Date.now() / 1000 | 0).toString()
let hash_string = 'timestamp=' + timestamp + cloudinary_config.api_secret
let signature = CryptoJS.SHA1(hash_string).toString()
let upload_url = 'https://api.cloudinary.com/v1_1/' + 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)

NES30 "Mode 2" Keyboard Mapping

NES30 Mapped to
Up c
Down d
Left e
Right f
L k
@GeoffreyPlitt
GeoffreyPlitt / convert_url_files_to_bookmarks.sh
Created December 29, 2014 00:53
Convert a folder of .URL files to a bookmarks.html file that can be imported into a browser
#!/bin/bash
#
# Run this script in a folder full of ".url" files, and pipe output to an HTML file.
# Example: ./convert_url_files_to_bookmarks.sh > 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>'
@GeoffreyPlitt
GeoffreyPlitt / gist:a1b8866c982817c97dfb
Created December 12, 2014 05:15
Kue with fake_redis
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
GeoffreyPlitt / gist:be3601dce8cb740c960a
Created October 14, 2014 20:56
Use Python/Boto to upload SSL cert to Amazon CloudFront
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 + 'mysite.com.key').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.
@GeoffreyPlitt
GeoffreyPlitt / gist:7606362
Created November 22, 2013 20:33
Example Python code for accessing Amazon SQS
from boto.sqs.connection import SQSConnection
from boto.sqs.message import Message
import time
import simplejson as json
sqs_conn = SQSConnection(ACCESS, SECRET)
def _get_queue_by_name(name):
""" Gets existing queue; or makes one if it doesn't exist
@GeoffreyPlitt
GeoffreyPlitt / Vagrantfile
Created November 8, 2013 09:57
Simplest way to play with Coreos with synced folder
Vagrant.configure("2") do |config|
config.vm.box = "coreos"
config.vm.box_url = "http://storage.core-os.net/coreos/amd64-generic/dev-channel/coreos_production_vagrant.box"
config.vm.network :private_network, :ip =>'0.0.0.0', :auto_network => true
config.vm.synced_folder ".", "/home/core/share", id: "core", :nfs => true, :mount_options => ['nolock,vers=3,udp']
end
@GeoffreyPlitt
GeoffreyPlitt / gist:7365004
Last active December 27, 2015 17:49
Fastest way ever to play with Docker
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.provision "docker",
images: ["ubuntu"]
end