Skip to content

Instantly share code, notes, and snippets.

(def ae-version "1.8.1.1")
(defproject airflow "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:repositories {"conjars" "http://conjars.org/repo/"
"clojars" "http://clojars.org/repo/"}
:dependencies [[org.clojure/clojure "1.5.1"]
;; /home/james/projects/airflow/src/airflow/context_test.clj
(ns airflow.context-test
(:require [org.lpetit.ring.servlet.util :as util]))
(defn start-up [ctx]
(println "Starting app with params: " (util/context-params ctx)))
(defn shutdown [ctx]
(println "Stopping app with params: " (util/context-params ctx)))
;; /home/james/projects/airflow/src/airflow/app_servlet.clj
(ns airflow.app-servlet)
(defn hello [request]
{:status 200
:headers {"Content-Type" "text/plain"}
:body "Hello, world!"})
@espeed
espeed / ring-java-servlet-projject.clj
Created June 29, 2013 04:33
Current ring-java-servlet project.clj -- trying to make it work with App Engine Dev Server
(defproject org.lpetit.ring/ring-java-servlet "0.2.0"
:description "Ring generic servlet for using ring without AOT."
:url "http://github.com/laurentpetit/ring-java-servlet"
:dependencies [[org.clojure/clojure "1.5.1"]
[ring/ring-servlet "1.1.0" :exclusions [javax.servlet/servlet-api]]]
:profiles {:provided
{:dependencies
[[javax.servlet/servlet-api "2.5"]]}}
:aot [org.lpetit.ring.servlet.RingHttpServlet org.lpetit.ring.servlet.RingServletContextListener])
@espeed
espeed / web.xml
Created June 29, 2013 04:27
App Engine web.xml -- trying to get App Engine Dev Server to play nicely with Clojure
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>Google App Engine Template</display-name>
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Blueprints-OrientGraph 2.4.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://oss.sonatype.org/content/repositories/snapshots/com/orientechnologies/orientdb-core/1.4.1-SNAPSHOT/maven-metadata.xml
Downloading: https://oss.sonatype.org/content/repositories/releases/com/orientechnologies/orientdb-core/1.4.1-SNAPSHOT/maven-metadata.xml
Downloading: https://oss.sonatype.org/content/repositories/releases/com/orientechnologies/orientdb-core/1.4.1-SNAPSHOT/orientdb-core-1.4.1-SNAPSHOT.pom
Downloading: https://oss.sonatype.org/content/repositories/snapshots/com/orientechnologies/orientdb-core/1.4.1-SNAPSHOT/orientdb-core-1.4.1-SNAPSHOT.pom
[WARNING] The POM for com.orientechnologies:orientdb-core:jar:1.4.1-SNAPSHOT is missing, no dependency information available
Downloading: https://os
@espeed
espeed / binary16-uuid.clj
Last active July 3, 2024 02:09
Random UUID compressed into a Binary 16 byte array in Clojure.
;; 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 / ids2vertices.groovy
Created April 30, 2013 03:35
Convert vertex IDs to vertices in Gremlin
// If you use an external search engine to return a list of vertex IDs,
// a common pattern in Gremlin for starting with Vertex IDs has been to
// convert the IDs to vertices and use the IdentityPipe to start the pipeline...
// See IdentityPipe https://github.com/tinkerpop/gremlin/wiki/Gremlin-Steps
start = [1,2,3,4].collect{ g.v(it) }
start._().filter{it.isActive}
// ...or as a one liner...
@espeed
espeed / gist:5395080
Created April 16, 2013 11:01
Example IDEA error when running all tets on blueprints-neo4j-graph
java.lang.NullPointerException
at com.tinkerpop.blueprints.EdgeTestSuite.testEdgeIterator(EdgeTestSuite.java:450)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.junit.runners.Suite.runChild(Suite.java:127)
at org.junit.runners.Suite.runChild(Suite.java:26)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
@espeed
espeed / bulbs_titan_example.py
Last active May 28, 2016 01:55
Bulbs/Titan Example
# 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)