Skip to content

Instantly share code, notes, and snippets.

View spmallette's full-sized avatar

stephen mallette spmallette

View GitHub Profile
@derekwyatt
derekwyatt / microkernel-server.xml
Created May 11, 2011 12:07
My microkernel / jetty config
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure.dtd">
<!-- =============================================================== -->
<!-- Configure the Jetty Server -->
<!-- -->
<!-- Documentation of this file format can be found at: -->
<!-- http://wiki.eclipse.org/Jetty/Reference/jetty.xml_syntax -->
<!-- -->
<!-- Additional configuration files are available in $JETTY_HOME/etc -->
@jboner
jboner / latency.txt
Last active November 15, 2024 14:00
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@spmallette
spmallette / gist:3193858
Created July 28, 2012 16:08
Timing Batch Scripts
REM source: http://www.thesysadminhimself.com/2011/03/calculating-time-difference-in-batch.html
FOR /F "skip=1 tokens=1-6" %%A IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Second /Format:table ^| findstr /r "."') DO (
set Milisecond=%time:~9,2%
set Day=%%A
set Hour=%%B
set Minute=%%C
set Second=%%D
)
set /a Start=%Day%*8640000+%Hour%*360000+%Minute%*6000+%Second%*100+%Milisecond%
@spmallette
spmallette / gist:4463879
Created January 5, 2013 21:53
two shell lines to restart a cassandra cluster
pssh -i -h hosts.txt ps aux | grep cassandra | awk '{ print $2 }' |xargs sudo kill
pssh -i -h hosts.txt sudo /usr/local/apache-cassandra-1.1.2/bin/cassandra
@spmallette
spmallette / tinkergraph-save-times-sizes.groovy
Last active December 15, 2015 22:08
Comparison of TinkerGraph serialization options.
types = [(TinkerGraph.FileType.GRAPHSON) : '/tmp/tg/graphson',
(TinkerGraph.FileType.GML) : '/tmp/tg/gml',
(TinkerGraph.FileType.GRAPHML) : '/tmp/tg/graphml',
(TinkerGraph.FileType.JAVA) : '/tmp/tg/java']
m = [:]
types.each{ gt ->
graph = new TinkerGraph(gt.value, gt.key);
graph.createKeyIndex("index", Vertex.class);
@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 []
public class EZMap<T> {
public static void main(String[] args) {
Map<String,Object> m = hashMap(
bob -> 5,
TheGimp -> 8,
incredibleKoolAid -> "James Taylor",
heyArnold -> new Date()
);
System.out.println(m);
}
@spmallette
spmallette / gist:eee03b57e92ec85ac0f4
Last active August 29, 2015 14:00
Decoding Permanent Locking Exception
gremlin> b = [ 64, 0, 0, 0, 0, 0, 0, 202 ] as byte[]
==>[B@150858bb
gremlin> r = new com.thinkaurelius.titan.diskstorage.util.ReadArrayBuffer(b)
==>64-0-0-0-0-0-0-202
gremlin> com.thinkaurelius.titan.graphdb.database.idhandling.VariableLong.readPositive(r)
==>36028797018964042
gremlin> ks = new com.thinkaurelius.titan.graphdb.database.serialize.kryo.KryoSerializer(true)
==>com.thinkaurelius.titan.graphdb.database.serialize.kryo.KryoSerializer@2ba74026
gremlin> x = ks.getDataOutput(40, true).writeObjectNotNull("10000000038529").getStaticBuffer()

Keybase proof

I hereby claim:

  • I am spmallette on github.
  • I am spmallette (https://keybase.io/spmallette) on keybase.
  • I have a public key whose fingerprint is B076 D269 AF15 8264 2135 88BA F7A9 2444 A376 2BC4

To claim this, I am signing this object:

@spmallette
spmallette / titan-building-notes
Last active August 29, 2015 14:02
Building TinkerPop and Aurelius Stacks
# generate documentation
mvn -pl titan-dist package