Skip to content

Instantly share code, notes, and snippets.

View nwtgck's full-sized avatar
:octocat:
Feel free to make my English natural by native speakers

Ryo Ota nwtgck

:octocat:
Feel free to make my English natural by native speakers
View GitHub Profile
@PhilOwen
PhilOwen / FirmataApp.scala
Last active July 9, 2017 03:18
ArduinoをFirmataでScalaから制御
import processing.core._
import processing.serial._
import cc.arduino._
class FirmataApp extends PApplet {
var ard: Arduino = null
override def settings() {
size(300, 300)
}
@xuwei-k
xuwei-k / ScalaNativeHttpGetExample.scala
Created March 31, 2018 08:45
scala-native http get example
package example
import java.net._
import java.io._
object ScalaNativeHttpGetExample {
def using[A <: Closeable, B] (a: A)(f: A => B): B =
try {
f(a)
} finally {
trait Memorized[T,R] {
import scala.collection.mutable._
val cache = new HashMap[T,R]
def cacheOrApply( t:T )( f: => R ):R = cache get(t) getOrElse{
val rv = f
cache += t -> rv
println("do %s:%s" format(t, rv))
rv
}
import cv2
import numpy as np
#動画ファイルパス
ESC_KEY = 27 # Escキー
INTERVAL= 33 # インターバル
FRAME_RATE = 30 # fps
#ウインドウ名の定義
import numpy as np
import cv2
FILE_ORG = "calibrated_output_background2.m4v"
WINDOW_ORG = "Orginal_frame"
FRAME_RATE = 30 # fps
class LocationDetector:
def __init__(self,
@gakuzzzz
gakuzzzz / sbt-coursier.md
Last active June 27, 2019 03:23
あなたの sbt update を爆速にする sbt-coursier の紹介

あなたの sbt update を爆速にする sbt-coursier の紹介

この記事は Scala Advent Calendar 2016(Adventar) 10日目の記事です。

今は 12/10 の 625時です。年明けなんて無かった。いいね?

さてさて、sbt の依存jarのダウンロードが遅い、というのは割とよく言われる事であります。

で、この原因の一旦に、sbtが Apache Ivy を使っている、という点があります。

@shimizu
shimizu / README.md
Last active October 23, 2019 22:25
Summer Wars - World Clock -

サマーウォーズのアレです。

@nukisashineko
nukisashineko / asyncfunction_vs_AsyncFunction.js
Last active March 18, 2020 22:02
nwtgckとの会話の派生でAsyncFunction isなんぞやって確認
// MDN: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/AsyncFunction
// 参考:https://javascript.developreference.com/article/14715429/ES+2017%3A+async+function+vs+AsyncFunction(object)+vs+async+function+expression
// Q何しようとしたの?
// A友人が話していたAsyncFunctionオブジェクトを触ってみる
// async function が利用するPromiseはグローバルではなくその場でのスコープ変数らしい。
// AsyncFunctionがスコープ変数を参照できなくしているのってPromiseが動的に書き換えられると面倒だからじゃない?って思ったので実験した
// 結果はまあよくわからなかった。
@uhyo
uhyo / gist:f97499872fb0685bd5a4b11fa0f55aef
Last active May 26, 2020 12:23
Sync way of obtaining promise result
Promise.prototype.then = (()=> {
const _then = Promise.prototype.then;
return function(...args) {
_then.call(this, (res) => {
promiseResultMap.set(this, res);
})
this.then = _then;
return _then.apply(this, args);
}
})();
@jeroenr
jeroenr / AkkaHttpMicroService.scala
Last active January 28, 2021 14:01
Akka HTTP API with CORS headers and custom Media types
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.stream.ActorMaterializer
object Boot extends App with Service with CorsSupport {
override implicit val system = ActorSystem()
override implicit val executor = system.dispatcher
override implicit val materializer = ActorMaterializer()
Http().bindAndHandle(corsHandler(routes), "0.0.0.0", 1337)