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 sangria.ast._ | |
| import sangria.execution._ | |
| import sangria.schema.Context | |
| import sangria.marshalling.queryAst._ | |
| import java.util.concurrent.ConcurrentLinkedQueue | |
| import scala.concurrent.duration.FiniteDuration | |
| import scala.collection.JavaConverters._ |
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 play.api.libs.json.Json | |
| object Main{ | |
| def main(args: Array[String]): Unit = { | |
| println( | |
| Json.prettyPrint( | |
| Json.toJson(Seq("Hello", "World", "Cow")) | |
| ) | |
| ) | |
| } |
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
| 0: Tue Jun 6 21:03:41 DST 2017: OK | |
| 1: Tue Jun 6 21:07:28 DST 2017: OK | |
| 2: Tue Jun 6 21:11:15 DST 2017: OK | |
| 3: Tue Jun 6 21:15:02 DST 2017: OK | |
| 4: Tue Jun 6 21:18:48 DST 2017: OK | |
| 5: Tue Jun 6 21:22:39 DST 2017: OK | |
| 6: Tue Jun 6 21:26:24 DST 2017: OK | |
| 7: Tue Jun 6 21:30:07 DST 2017: OK | |
| 8: Tue Jun 6 21:33:49 DST 2017: OK | |
| 9: Tue Jun 6 21:37:32 DST 2017: OK |
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/bash | |
| export LANG=C | |
| for ((i=0;1;i++)) ; do | |
| if make -j16 >/dev/null 2>>log.txt ; then | |
| echo "$i: $(date): OK" >>log.txt | |
| else | |
| echo "$i: $(date): NG" >>log.txt | |
| 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
| package hello | |
| import java.io.ByteArrayOutputStream | |
| import chisel3._ | |
| import chisel3.iotesters.{Driver, PeekPokeTester} | |
| sealed trait Op | |
| object Op{ | |
| case class GotoIfZero(dest: Byte, valueAddr: Byte) extends Op |
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
| /** | |
| * Working with shapeless' records is great. However, you are limited to using only String, Integer, Boolean, and | |
| * (package) Objects as singleton keys as the singleton machinery requires a stable point (I don't really fully | |
| * understand this part but I have an intuition). I had asked if there was a way to use a tuple or case-class | |
| * as a key in the shapeless gitter channel and no one really knew. | |
| * | |
| * I was reading the shapeless source for the Witness type and an idea came to mind: since we can use a package Object | |
| * as a key, what if that key extends a trait (an abstract class can work as well)? Can we use those objects as | |
| * singleton keys and access the values specified in the trait? | |
| * |
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
| miles@frege:~$ ./shapeless.sh | |
| Loading... | |
| Welcome to the Ammonite Repl 0.5.2 | |
| (Scala 2.11.7 Java 1.8.0_51) | |
| @ val l = 23 :: "foo" :: true :: HNil | |
| l: Int :: String :: Boolean :: HNil = ::(23, ::("foo", ::(true, HNil))) | |
| @ |
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/bash | |
| test -e ~/.coursier/cr || (mkdir -p ~/.coursier && wget -q -O ~/.coursier/cr https://git.io/vgvpD && chmod +x ~/.coursier/cr) | |
| CLASSPATH="$(~/.coursier/cr fetch -q -p \ | |
| \ | |
| com.typesafe.play:play-netty-server_2.11:2.5.0 \ | |
| com.typesafe.play:play_2.11:2.5.0 \ | |
| com.lihaoyi:ammonite-repl_2.11.7:0.5.2 \ | |
| \ | |
| )" java \ | |
| -Dplay.crypto.secret=foo.bar.baz \ |
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 io.undertow.Undertow | |
| import io.undertow.server.HttpHandler | |
| import io.undertow.server.HttpServerExchange | |
| import io.undertow.util.Headers | |
| object server extends App { | |
| val server: Undertow = Undertow.builder().addHttpListener(8080, "localhost").setHandler(new HttpHandler() { | |
| override def handleRequest(exchange: HttpServerExchange): Unit = { | |
| exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "text/plain") | |
| exchange.getResponseSender().send("Hello, world!") |
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 akkahttptest | |
| import akka.http.Http | |
| import akka.stream.ActorFlowMaterializer | |
| import akka.actor.ActorSystem | |
| import akka.stream.scaladsl.{Sink, Source} | |
| import akka.http.model._ | |
| object TestClient extends App { |
NewerOlder