Skip to content

Instantly share code, notes, and snippets.

View tkrs's full-sized avatar
🤯
I may be slow to respond.

Takeru Sato tkrs

🤯
I may be slow to respond.
  • Gunma, Japan
  • 02:49 (UTC +09:00)
View GitHub Profile
@tkrs
tkrs / parser.go.y
Created February 13, 2018 05:31
goyacc tutorial
%{
package main
import (
"text/scanner"
"strconv"
"strings"
"fmt"
)
type Expression interface{}
type ParenExpr struct {
@tkrs
tkrs / Main.scala
Last active September 17, 2021 21:51
Shapeless automatically derives BigQuery TableSchema from case class
import com.google.api.services.bigquery.model.TableFieldSchema
import com.google.api.services.bigquery.model.TableSchema
import org.joda.time.Instant
import shapeless._
import shapeless.ops.hlist.FillWith
import shapeless.ops.hlist.Mapper
import shapeless.ops.hlist.ToList
import shapeless.ops.record.Keys
import shapeless.ops.record.Values
@tkrs
tkrs / bigtable.sc
Last active January 3, 2021 19:50
Bigtable CLI
import $ivy.`com.github.tkrs::orcus-bigtable:0.25.2`
import $ivy.`com.github.tkrs::orcus-cats-effect:0.25.2`
import $ivy.`com.github.tkrs::mess-core:0.2.4`
import $ivy.`com.github.scopt::scopt:4.0.0`
import java.time.Instant
import cats.effect.IO
import cats.instances.map._
import cats.syntax.all._
@tkrs
tkrs / main.go
Created April 15, 2019 08:38
go gcsql
package main
import (
"database/sql"
"database/sql/driver"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
@tkrs
tkrs / Test.go
Last active April 1, 2019 10:20
Example golang of channels and syn.WaitGroup
package main
import (
"fmt"
"runtime"
"sync"
)
func init() {
fmt.Println("func init()")
@tkrs
tkrs / split.py
Last active October 18, 2018 06:48
Splits the file by the passed lines
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
[
{
"jmhVersion" : "1.21",
"benchmark" : "mess.bench.PackBench.encodeLong10",
"mode" : "thrpt",
"threads" : 1,
"forks" : 2,
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home/jre/bin/java",
"jvmArgs" : [
"-server",
@tkrs
tkrs / benchmark.log
Created July 20, 2018 03:59
orcus benchmark running on 1fc40f23aae7f351dc1b533c47089e7c9e009c59, GCP n1-highcpu-8
> sbt "benchmark/jmh:run -p threads=8,16,32 -t 8 -prof gc -rf json"
[info] Benchmark (size) (threads) Mode Cnt Score Error Units
[info] o.async.benchmark.ArrowsTwitterAsyncHandler.bench N/A 8 thrpt 20 20309.348 ± 1636.720 ops/s
[info] o.async.benchmark.ArrowsTwitterAsyncHandler.bench:·gc.alloc.rate N/A 8 thrpt 20 1118.660 ± 177.257 MB/sec
[info] o.async.benchmark.ArrowsTwitterAsyncHandler.bench:·gc.alloc.rate.norm N/A 8 thrpt 20 63807.306 ± 9571.187 B/op
[info] o.async.benchmark.ArrowsTwitterAsyncHandler.bench:·gc.churn.PS_Eden_Space N/A 8 thrpt 20 1194.851 ± 112.504 MB/sec
[info] o.async.benchmark.ArrowsTwitterAsyncHandler.bench:·gc.churn.PS_Eden_Space.norm
@tkrs
tkrs / jmh-result-fluflu-msgpack-circe.json
Last active June 19, 2018 11:17
fluflu-msgpack-circe vs mess
[
{
"jmhVersion" : "1.21",
"benchmark" : "PackBench.encodeLong10",
"mode" : "thrpt",
"threads" : 1,
"forks" : 2,
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre/bin/java",
"jvmArgs" : [
],
[
{
"jmhVersion" : "1.21",
"benchmark" : "fluflu.msgpack.AstBench.encodeLong10Circe",
"mode" : "thrpt",
"threads" : 1,
"forks" : 2,
"jvm" : "/Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home/jre/bin/java",
"jvmArgs" : [
"-XX:+UseG1GC",