Skip to content

Instantly share code, notes, and snippets.

@espeed
espeed / 0_reuse_code.js
Created January 26, 2014 23:02
Here are some things you can do with Gists in GistBox.
// 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 January 1, 2016 14:39
Here's what you need to do to get the New Relic plugin working with a Clojure/Pedestal app on Heroku.
# 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 December 13, 2013 01:35
FizzBuzz Example in Python
# 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
@espeed
espeed / bulbs_server_side_scripts_example.py
Last active December 26, 2015 15:39
Bulbs/Rexster server-side Gremlin scripts example.
# Bulbs/Rexster server-side Gremlin script example.
# by James Thornton, http://jamesthornton.com
>>> from bulbs.rexster import Graph, DEBUG
>>> g = Graph()
>>> g.config.server_scripts = True
>>> g.config.set_logger(DEBUG)
>>> james = g.vertices.create(name="James")
POST url: http://localhost:8182/graphs/emptygraph/vertices
POST body: {"name":"James"}
@espeed
espeed / install-hyperdex-on-fedora-19.bash
Last active December 22, 2015 03:08
HOWTO Install HyperDex on Fedora 19 - The HyperDex packages in the HyperDex Fedora repo are for Fedora 17, and they don't work on Fedora 19. Here is what you need to do to build and install HyperDex on Fedora 19...
# How to Install HyperDex 1.0x on Fedora 19
# by James Thornton, http://jamesthornton.com
# First ensure you have these Fedora 19 packages installed
sudo yum install git autoconf automake autoconf-archive \
libtool python-devel pyparsing popt-devel \
cityhash-devel gcc-c++ glog-devel leveldb-devel \
bison gperf flex python-sphinx pandoc help2man
@espeed
espeed / secure-peer-messaging.textile
Last active December 21, 2015 19:19
Preliminary ideas for the design of a secure, decentralized (peer-to-peer) replacement for email (possibly based on Apache Wave).

Preliminary Ideas for a Secure p2p Email Replacement

Summary: Brainstorm for the design of a secure, decentralized (peer-to-peer) replacement for email.

Goals

  • Secure p2p messaging; Decentralized messaging platform (no centralized server).
  • Do not rely on central Certificates of Authority (CA).
  • Leverage modern environment where users have multiple, always-on devices.
@espeed
espeed / HOTAIRBALLOON
Last active September 26, 2023 11:51
This is the first program I ever wrote... It was on the Commodore 64, and it displays a hot air balloon bouncing around the screen in 16 colors. I was probably 7 or 8. This program is the first example in the "C64 Programmers Reference Guide - Chapter 3: Programming Graphics on the Commodore 64" -- http://www.commodore.ca/manuals/c64_programmers…
10 REM SPRITE EXAMPLE 1...
20 REM THE HOT AIR BALLOON
30 VIC=13*4096:REM THIS IS WHERE THE VIC REGISTERS BEGIN
35 POKEVIC+21,1:REM ENABLE SPRITE 0
36 POKEVIC+33,14:REM SET BACKGROUND COLOR TO LIGHT BLUE
37 POKEVIC+23,1:REM EXPAND SPRITE 0 IN Y
38 POKEVIC+29,1:REM EXPAND SPRITE 0 IN X
40 POKE2040,192:REM SET SPRITE 0'S POINTER
180 POKEVIC+0,100:REM SET SPRITE 0'S X POSITION
190 POKEVIC+l, 100:REM SET SPRITE 0'S Y POSITION
@espeed
espeed / gist:5898274
Last active December 19, 2015 04:38
Log4j 2 Notes

Log4j 2 Notes

Asynchronous Loggers for Low-Latency Logging

Log4j 2 contains next-generation Asynchronous Loggers based on the LMAX Disruptor library. In multi-threaded scenarios Asynchronous Loggers have 10 times higher throughput and orders of magnitude lower latency than Log4j 1.x and Logback. See Asynchronous Logging Performance for details. Otherwise, Log4j 2 performs faster than Log4j 1.x in critical areas and similarly to Logback under most circumstances. See Performance for more information. http://logging.apache.org/log4j/2.x/

@espeed
espeed / gist:5890056
Created June 29, 2013 06:08
http://localhost:8080/ -- no namespace error
Jun 29, 2013 1:07:02 AM com.google.appengine.tools.development.ApiProxyLocalImpl log
SEVERE: javax.servlet.ServletContext log: unavailable
java.lang.Exception: No namespace: airflow.app_servlet found
at clojure.core$the_ns.invoke(core.clj:3760)
at org.lpetit.ring.servlet.util$require_and_resolve.invoke(util.clj:7)
at org.lpetit.ring.servlet.RingHttpServlet_impl$_init_void.invoke(RingHttpServlet_impl.clj:9)
at org.lpetit.ring.servlet.RingHttpServlet.init(Unknown Source)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.lpetit.ring.servlet.RingHttpServlet.init(Unknown Source)
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440)
@espeed
espeed / gist:5890043
Last active December 19, 2015 03:28
$ ./dev_appserver.sh /home/james/projects/airflow/war
[james@life appengine-java-sdk-1.8.1.1]$ ./bin/dev_appserver.sh /home/james/projects/airflow/war
Jun 29, 2013 1:03:44 AM com.google.apphosting.utils.config.AppEngineWebXmlReader readAppEngineWebXml
INFO: Successfully processed /home/james/projects/airflow/war/WEB-INF/appengine-web.xml
Jun 29, 2013 1:03:44 AM com.google.apphosting.utils.config.AbstractConfigXmlReader readConfigXml
INFO: Successfully processed /home/james/projects/airflow/war/WEB-INF/web.xml
Jun 29, 2013 1:03:44 AM com.google.apphosting.utils.jetty.JettyLogger info
INFO: Logging to JettyLogger(null) via com.google.apphosting.utils.jetty.JettyLogger
Jun 29, 2013 6:03:44 AM com.google.apphosting.utils.jetty.JettyLogger info
INFO: jetty-6.1.x
Starting app with params: {:org.mortbay.jetty.webapp.NoTLDJarPattern start.jar|ant-.*\.jar|dojo-.*\.jar|jetty-.*\.jar|jsp-api-.*\.jar|junit-.*\.jar|servlet-api-.*\.jar|dnsns\.jar|rt\.jar|jsse\.jar|tools\.jar|sunpkcs11\.jar|sunjce_provider\.jar|xerces.*\.jar, :context-destroy airflow.context-text/shutdown, :c