Javaで多引数のコンストラクタを避けるために使われる Builder パターンは、Scala では名前付き引数呼び出しが使えるので必要ありません。
Builderパターンに制約を加えて条件に合わない場合、コンパイルエラーにしたい。
const {PassThrough} = require('stream')
const fs = require('fs')
const d = new PassThrough()
fs.createReadStream('tt2.js').pipe(d) // can be piped from reaable stream
d.pipe(process.stdout) // can pipe to writable stream
d.on('data', console.log) // also like readable
この記事は Scala Advent Calendar 2016(Adventar) 10日目の記事です。
今は 12/10 の 625時です。年明けなんて無かった。いいね?
さてさて、sbt の依存jarのダウンロードが遅い、というのは割とよく言われる事であります。
で、この原因の一旦に、sbtが Apache Ivy を使っている、という点があります。
import ( | |
"fmt" | |
"github.com/asaskevich/govalidator" | |
) | |
// You can use as well instead of *url.URL a string with your URL, in this case you might drop `u.String()` | |
// - transformation to string in method call. | |
func validateURL(u *url.URL) error { | |
valid := govalidator.IsRequestURL(u.String()) | |
if valid == false { |
""" Trains an agent with (stochastic) Policy Gradients on Pong. Uses OpenAI Gym. """ | |
import numpy as np | |
import cPickle as pickle | |
import gym | |
# hyperparameters | |
H = 200 # number of hidden layer neurons | |
batch_size = 10 # every how many episodes to do a param update? | |
learning_rate = 1e-4 | |
gamma = 0.99 # discount factor for reward |
import processing.core._ | |
import processing.serial._ | |
import cc.arduino._ | |
class FirmataApp extends PApplet { | |
var ard: Arduino = null | |
override def settings() { | |
size(300, 300) | |
} |
package utils | |
import akka.stream._ | |
import akka.stream.scaladsl._ | |
import akka.stream.stage._ | |
import akka.util.{ByteString, ByteStringBuilder} | |
import scala.annotation.tailrec | |
import java.security.SecureRandom | |
import java.security.{Key, KeyFactory, PublicKey, PrivateKey} | |
import java.security.spec.{PKCS8EncodedKeySpec, X509EncodedKeySpec} |
socat Examples | |
=============== | |
* 注意 | |
- SYSTEM で : を使う時は必ずエスケープすること | |
* 相手に接続 | |
# telnet, netcat, socat それぞれの場合 | |
$ socat - TCP:127.0.0.1:8000 |
Release/* | |
.xdchelp | |
config/* | |
.launches/* |
シーケンス図とかフローチャートをしごとで描画することになった場合、 テキストから生成できたら楽なので、それ系のツールまとめ