Skip to content

Instantly share code, notes, and snippets.

James Thornton espeed

Block or report user

Report or block espeed

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
@espeed
espeed / fbme.py
Last active May 20, 2019
Facebook Graph API Example in Python
View fbme.py
# Facebook Graph API Example in Python
# by James Thornton, http://jamesthornton.com
# Facebook API Docs
# https://developers.facebook.com/docs/graph-api/using-graph-api#reading
# Get Your Facebook Access Token Here...
# https://developers.facebook.com/tools/explorer/145634995501895/?method=GET&path=me
# Before running this script...
@espeed
espeed / file
Created Apr 1, 2017
freedom_public
View file
{"0.8782798733075599":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgMEShAYr1ojMCjtyssa+BIi3J1dfY4ATIhh\r\nW6bLseEYxnNJaX25/ecmGIfHwQ6sv0bSzmXbcdZ9zU6ykLKnmTjJ0s3/AAAACDxn\r\naXRodWI+wv8AAACOBBATCABA/wAAAAWCWN/Wjv8AAAACiwn/AAAACZBtT1Ym5Ex2\r\nX/8AAAAFlQgJCgv/AAAABJYDAQL/AAAAApsD/wAAAAKeAQAAS3cBAMjiOyXPpgIE\r\nxsQ/n6GV0Fl+iTHyFXipLHs3qK/l3uaZAP4npvRbZdAWQWug3MT/EEaEbmahxeJA\r\ntQmv7L7Lv9rjMs7/AAAAVgQAAAAAEggqhkjOPQMBBwIDBDS/b2Fja5QAZLp2mYfJ\r\n4pFrcyUCGkCpBn/YN/DlyNyzkqjqZXVh+YmQGOyEJpxBpZq8i/GU0UzN28m5Cnuq\r\nRdkDAQgHwv8AAABtBBgTCAAf/wAAAAWCWN/Wjv8AAAAJkG1PVibkTHZf/wAAAAKb\r\nDAAAt0YBAIxyeFYMf1dONyEuDpq4DDcfOvM3WuspacEevWli1Pt5AQD9UjKIbi1H\r\nW4Uyq2H+b1+iBriO9LDIs1pS2CGKGEKDPg==\r\n=qJ/3\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n"}
@espeed
espeed / setup.sh
Created May 6, 2012
Create and deploy a Python/Flask "hello world" app on Heroku.
View setup.sh
#!/bin/bash
# Create and deploy a Python/Flask "hello world" app on Heroku.
# by James Thornton, http://jamesthornton.com
# To run it, do:
# $ heroku login
# $ bash setup.sh helloworld
# $ cd helloworld
@espeed
espeed / device.py
Created Oct 20, 2011
Python ZeroMQ Streamer Device
View device.py
import time
import zmq
from zmq.devices.basedevice import ProcessDevice
from multiprocessing import Process, Pool
def create_socket(socket_type,uri):
context = zmq.Context()
socket = context.socket(socket_type)
socket.connect(uri)
@espeed
espeed / bulbs_titan_example.py
Last active May 28, 2016
Bulbs/Titan Example
View bulbs_titan_example.py
# by James Thornton, http://jamesthornton.com
from bulbs.titan import Graph, DEBUG
# TITAN_URI => "http://localhost:8182/graphs/graph"
# "graph" is the default graph name set in the Titan Server config
g = Graph()
g.config.set_logger(DEBUG)
@espeed
espeed / png-to-ico.sh
Created Nov 2, 2014
ImageMagick command to convert PNG file to transparent favicon.ico
View png-to-ico.sh
convert app-icon.png
\( -clone 0 -resize 16x16 \)
\( -clone 0 -resize 32x32 \)
\( -clone 0 -resize 48x48 \)
\( -clone 0 -resize 64x64 \)
-delete 0 -alpha on -background transparent favicon.ico
@espeed
espeed / binary16-uuid.clj
Last active Jan 7, 2016
Random UUID compressed into a Binary 16 byte array in Clojure.
View binary16-uuid.clj
;; Random UUID compressed into a Binary 16 byte array in Clojure.
;; by James Thornton, http://jamesthornton.com
(ns espeed.uuid
(require [clojure.data.codec.base64 :as b64]))
(defn uuid4 [] (java.util.UUID/randomUUID))
(defn uuid-as-byte-array []
@espeed
espeed / 0_reuse_code.js
Created Jan 26, 2014
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@espeed
espeed / heroku-clojure-newrelic-agent-log.bash
Last active Jan 1, 2016
Here's what you need to do to get the New Relic plugin working with a Clojure/Pedestal app on Heroku.
View heroku-clojure-newrelic-agent-log.bash
# How to configure a Clojure/Herokup app to use the New Relic add-on
# for monitoring and to prevent the app from sleeping.
#
# by James Thornton, http://jamesthornton.com
#
# Here's what you need to do to get the New Relic plugin working with a
# Clojure/Pedestal app on Heroku.
# It took some fiddling because there are several versions of docs
@espeed
espeed / fizzbuzz.py
Created Dec 13, 2013
FizzBuzz Example in Python
View fizzbuzz.py
# FizzBuzz Example in Python
# by James Thornton, http://jamesthornton.com
for num in range (1, 101):
fizz = "" if num % 3 else "FIZZ"
buzz = "" if num % 5 else "BUZZ"
print fizz + buzz if fizz or buzz else num
You can’t perform that action at this time.