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
| use std::cell::RefCell; | |
| use std::io; | |
| use std::io::ErrorKind; | |
| use std::io::Write; | |
| use std::net::TcpStream; | |
| use std::thread; | |
| use std::time::Duration; | |
| fn main() { | |
| let mut writer = ReconnectableWriter::connect("127.0.0.1:24224".to_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
| import java.nio.ByteBuffer | |
| import java.util.concurrent.TimeUnit | |
| import org.openjdk.jmh.annotations._ | |
| @State(Scope.Thread) | |
| @BenchmarkMode(Array(Mode.Throughput)) | |
| @Warmup(iterations = 10, time = 1) | |
| @Measurement(iterations = 10, time = 1) | |
| @OutputTimeUnit(TimeUnit.SECONDS) |
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 main | |
| import ( | |
| "text/scanner" | |
| "strconv" | |
| "strings" | |
| "fmt" | |
| ) | |
| type Expression interface{} | |
| type ParenExpr struct { |
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 sys | |
| import gzip | |
| from itertools import islice | |
| class FileSpliter: | |
| def __init__(self, from_file, to_file_prefix): | |
| self.from_file = from_file | |
| self.to_file_prefix = to_file_prefix |
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 sandbox | |
| import java.time.Instant | |
| import java.time.format.{DateTimeFormatter, DateTimeFormatterBuilder} | |
| import java.util.concurrent._ | |
| import cats.instances.future._ | |
| import cats.syntax.cartesian._ | |
| import monix.eval.{Callback, Task} | |
| import monix.execution.{Ack, Cancelable, Scheduler} |
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
| trait Gettable<A> { | |
| fn run(&self) -> A; | |
| } | |
| #[derive(Debug)] | |
| struct Request { | |
| a: String, | |
| } | |
| #[derive(Debug)] |
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 cats.data.Coproduct | |
| import cats.free.{Free, Inject} | |
| import cats.{Id, ~>} | |
| // See [[http://underscore.io/blog/posts/2017/03/29/free-inject.html]] | |
| sealed trait FOp[A] | |
| object FOp { | |
| case object One extends FOp[Int] |
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 java.nio.charset.StandardCharsets._ | |
| import akka.{Done, NotUsed} | |
| import akka.actor.ActorSystem | |
| import akka.http.scaladsl.Http.HostConnectionPool | |
| import akka.http.scaladsl._ | |
| import akka.http.scaladsl.model.{HttpRequest, HttpResponse} | |
| import akka.stream.ActorMaterializer | |
| import akka.stream.scaladsl.{Flow, Sink, Source} |
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 shapeless._, labelled._, syntax._, ops.record._ | |
| import scala.annotation.implicitNotFound | |
| object derive { | |
| sealed trait KV | |
| case class Obj(xs: List[(KV, KV)]) extends KV { | |
| def ++(j: KV): KV = j match { | |
| case Obj(xxs) => copy(xs ++ xxs) |
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
| public class FizzBuzz{ | |
| public static void main(String...args){ | |
| java.util.stream.Stream.iterate(1, i -> i + 1) | |
| .map(i -> { | |
| String x=(i % 3 < 1 ? "Fizz" : "") + (i % 5 < 1 ? "Buzz" : ""); | |
| return x.equals("") ? i : x; | |
| }) | |
| .limit(100) | |
| .forEach(System.out::println); | |
| } |