This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.github.edgecaseberg.test { | |
import scala.reflect.runtime.universe | |
import scala.reflect.runtime.universe.typeOf | |
import scala.util.Random | |
import org.scalatest._ | |
trait ParsingTest extends FlatSpec with Matchers { | |
val random = new Random() | |
def randomCase(s: String): String = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -eq 0 ]; then | |
echo "Usage: ./monitor.sh /my/log/file.log [sleep time (s)]" | |
echo "Will output a dot for each second monitored that there are no changes" | |
echo "Will stop script once no changes are detected to log file" | |
fi | |
if [ $# -eq 1 ]; then | |
LOGFILE=$1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [ $# -eq 0 ]; then | |
echo "Usage: ./monitor.sh /my/log/file.log" | |
fi | |
if [ $# -eq 1 ]; then | |
LOGFILE=$1 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Options("/generate/imageId/OneToOne/800").withHeaders(List(HttpHeaders.Origin(Seq(HttpOrigin("http", Host("allowedhost.com")))))) ~> myroute ~> check { | |
+ Options("/generate/imageId/OneToOne/800") ~> addHeader("Origin", "http://allowedhost.com") ~> myroute ~> check { | |
Above is scalatest spray example of adding headers to request |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Options("/generate/imageId/OneToOne/800").withHeaders(List(HttpHeaders.Origin(Seq(HttpOrigin("http", Host("allowedhost.com")))))) ~> myroute ~> check { | |
+ Options("/generate/imageId/OneToOne/800") ~> addHeader("Origin", "http://allowedhost.com") ~> myroute ~> check { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class testCase() { | |
val smallFile = Array[Byte](-1,-40,-1,-32,0,16,74,70,73,70,0,1,1,1,0,109,0,109,0,0,-1,-37,0,67,0,8,6,6,7,6,5,8,7,7,7,9,9,8,10,12,20,13,12,11,11,12,25,18,19,15,20,29,26,31,30,29,26,28,28,32,36,46,39,32,34,44,35,28,28,40,55,41,44,48,49,52,52,52,31,39,57,61,56,50,60,46,51,52,50,-1,-37,0,67,1,9,9,9,12,11,12,24,13,13,24,50,33,28,33,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-1,-64,0,17,8,1,0,1,0,3,1,34,0,2,17,1,3,17,1,-1,-60,0,31,0,0,1,5,1,1,1,1,1,1,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,-1,-60,0,-75,16,0,2,1,3,3,2,4,3,5,5,4,4,0,0,1,125,1,2,3,0,4,17,5,18,33,49,65,6,19,81,97,7,34,113,20,50,-127,-111,-95,8,35,66,-79,-63,21,82,-47,-16,36,51,98,114,-126,9,10,22,23,24,25,26,37,38,39,40,41,42,52,53,54,55,56,57,58,67,68,69,70,71,72,73,74,83,84,85,86,87,88,89,90,99,100,101,102,103,104,105,106,115,116,117,118,119,120,121,122,-125,-124,-123,-122,-121,-120,-119,-118,-110,-109,-108,-107,-106,-105,-1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Using vars, lots of local mutation | |
def getThemVar(th:Throwable)={ | |
var now=th | |
var li=List[Throwable](now) | |
var cause=now.getCause | |
while (cause!=null){ | |
li=cause::li | |
now=cause | |
cause=now.getCause | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ּ_בּ | |
בּ_בּ | |
טּ_טּ | |
כּ‗כּ | |
לּ_לּ | |
מּ_מּ | |
סּ_סּ | |
תּ_תּ | |
٩(×̯×)۶ | |
٩(̾●̮̮̃̾•̃̾)۶ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import akka.io.IO | |
import akka.actor._ | |
import akka.pattern.ask | |
import akka.util.Timeout | |
import spray.http._ | |
import spray.can.Http | |
import spray.routing._ | |
import spray.routing.RequestContext | |
import spray.routing.directives.CachingDirectives._ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import dis | |
>>> def addStr(s): | |
... return ">" + s + "<" | |
... | |
>>> dis.dis(addStr) | |
2 0 LOAD_CONST 1 ('>') | |
3 LOAD_FAST 0 (s) | |
6 BINARY_ADD | |
7 LOAD_CONST 2 ('<') | |
10 BINARY_ADD |