Skip to content

Instantly share code, notes, and snippets.

View sirthias's full-sized avatar

Mathias sirthias

  • Freiburg, Germany
View GitHub Profile
@sirthias
sirthias / README.txt
Last active October 9, 2018 11:17
iterm_open_with.sh
Iterm2 / Preferences / Profiles / Advanced / Semantic History
"Run command ..." with
~/bin/iterm_open_with.sh \5 \1 \2
Verifying that +sirthias is my blockchain ID. https://onename.com/sirthias
Benchmark Mode Cnt Score Error Units
----------------------------------------------------------------------------------
json4SJacksonFromByteArrayInputStream thrpt 20 342.476 ± 2.362 ops/s
json4SJacksonFromString thrpt 20 306.034 ± 1.426 ops/s
sprayJsonParserToVectorBasedBasicAstFromBytes thrpt 20 266.198 ± 2.103 ops/s
sprayJsonParserToArrayBasedBasicAstFromBytes thrpt 20 265.217 ± 1.649 ops/s
argonautFromString thrpt 20 222.747 ± 2.226 ops/s
sprayJsonFromBytes thrpt 20 222.021 ± 1.681 ops/s
jawnFromString thrpt 20 212.218 ± 2.292 ops/s
sprayJsonFromString thrpt 20 206.116 ± 1.849 ops/s
@sirthias
sirthias / JValue-Array-Based.scala
Created July 27, 2015 22:38
Comparison of Vector-based and Array-based basic JValue ASTs
package org.json4s.basic.ast
import scala.annotation.tailrec
import scala.collection.immutable.VectorBuilder
/**
* Minimal AST for " The JavaScript Object Notation (JSON) Data Interchange Format"
* RFC 7159 (https://tools.ietf.org/html/rfc7159)
*/
sealed abstract class JValue extends Serializable with Product
/*
Stream Setup
============
requestIn +----------+
+-----------------------------------------------+--->| Termi- | requestRendering
| | nation +---------------------> |
+-------------------------------------->| Merge | |
| Termination Backchannel | +----------+ | TCP-
| | | level
@sirthias
sirthias / API-proposal.scala
Last active August 29, 2015 14:08
API proposal for TCP, SSL and HTTP stream APIs
object Tcp {
trait ConnectionDescriptor {
def remoteAddress: InetSocketAddress
def localAddress: InetSocketAddress
}
sealed trait ConnectionFlow extends Flow[ByteString, ByteString] {
def remoteAddress(mMap: MaterializedMap): InetSocketAddress
def localAddress(mMap: MaterializedMap): InetSocketAddress
@sirthias
sirthias / gist:f54dbc91790593768a60
Last active August 29, 2015 14:07
waves.io basic design concept
- Wave[T]
- not reusable stream of Ts
- Drain[T]
- not reusable stream sink for Ts
- Source[T]
- has `def newWave(): Wave[T]`, i.e. is creator for Wave[T] instances
- has implicit conversion to Wave[T], i.e. can be used whereever a Wave[T] is expected
- Sink[T]
- has `def newDrain(): Drain[T]`, i.e. is creator for Drain[T] instances
- has implicit conversion to Drain[T], i.e. can be used whereever a Drain[T] is expected
@sirthias
sirthias / gist:3179a1c47d6ee7030eef
Created September 22, 2014 09:31
Results from simple JSON parsing benchmark (from parboiled2)
Benchmark Score Score error Units
---------------------------------------------------------
json4S Jackson 310.069 5.641 ops/s
spray-json 1.3.0 224.355 1.546 ops/s
argonaut 172.488 1.558 ops/s
json4S Native 140.801 2.213 ops/s
parboiled2 JSON example 94.294 0.803 ops/s
spray-json 1.2.6 14.223 0.533 ops/s
Scala Parser Combinators 1.038 0.013 ops/s
@sirthias
sirthias / routing.patch
Created March 6, 2014 16:01
+ routing: add `conditional` support to FileAndResourceDirectives
diff --git a/spray-routing/src/main/resources/reference.conf b/spray-routing/src/main/resources/reference.conf
index 67c6177..08aaf84 100644
--- a/spray-routing/src/main/resources/reference.conf
+++ b/spray-routing/src/main/resources/reference.conf
@@ -21,6 +21,9 @@ spray.routing {
# the size of an individual chunk when streaming file content
file-chunking-chunk-size = 128k
+ # Enables/disables ETag and `If-Modified-Since` support for FileAndResourceDirectives
+ file-get-conditional = on