Skip to content

Instantly share code, notes, and snippets.

@mboersma
mboersma / yaml2json
Last active July 31, 2023 12:34
YAML to JSON one-liner
python3 -c 'import sys, yaml, json; y=yaml.safe_load(sys.stdin.read()); print(json.dumps(y))'
@j5ik2o
j5ik2o / gist:1520836
Last active January 3, 2017 17:09
Scalaで使えそうなWeb系フレームワーク&ライブラリ
@matope
matope / Dynamo: Amazonの高可用性Key-value Store.markdown
Last active November 18, 2022 17:54
Dynamo: Amazonの高可用性Key-value Store[和訳]
@sidharthkuruvila
sidharthkuruvila / gist:3154845
Created July 21, 2012 06:30
Utility to functions to convert between camel case and underscore separated names
/**
* Takes a camel cased identifier name and returns an underscore separated
* name
*
* Example:
* camelToUnderscores("thisIsA1Test") == "this_is_a_1_test"
*/
def camelToUnderscores(name: String) = "[A-Z\\d]".r.replaceAllIn(name, {m =>
"_" + m.group(0).toLowerCase()
})
@taichi
taichi / java.md
Last active December 14, 2015 11:29
「作者の気持ち」以前に、揚げ足とる相手の最新状況くらい調べろ

「作者の気持ち」以前に、揚げ足とる相手の最新状況くらい調べろ

タイトルは元エントリを改変させて頂きました。

Java6は公式アップデートの終了した古いJavaです。
その古いAPIのみを対象としてJavaを批判するのはいささかフェアでない様に思われます。

現在最新のstable releaseである所のJava7では必要な部分だけ抜粋すると以下の様に記述出来ます。

@rxin
rxin / ByteBufferPerf.scala
Last active May 14, 2018 21:27
Comparison of performance over various approaches to read Java ByteBuffer. The best way is to use Unsafe, which also enables reading multiple primitive data types from the same buffer.
/**
* To compile:
* scalac -optimize ByteBufferPerf.scala
*
* JAVA_OPTS="-Xmx2g" scala IntArrayPerf 10
* 49 62 48 45 48 45 48 50 47 45
*
* JAVA_OPTS="-Xmx2g" scala ByteBufferPerf 10
* 479 491 484 480 484 481 477 477 472 473
@ueshin
ueshin / scalamatsuri2014.md
Created September 6, 2014 02:42
SparkSQL samples for ScalaMatsuri2014
@svrc-personal
svrc-personal / gist:5a8accc57219b9548fe1
Last active May 11, 2020 15:39
JDK 8 seems to use /dev/urandom and /dev/random more sensibly
Summary of Behaviour:
A. OpenJDK 7 b65.
1. Default in java.security is securerandom.source=/dev/urandom
2. If securerandom.source=/dev/urandom, NativePRNG is used, SecureRandom.nextBytes() is non-blocking via /dev/urandom ; SecureRandom.generateSeed(x) is blocking via /dev/random
3. if securerandom.source=/dev/random, then SHA1PRNG is used. Initial seed is blocking via /dev/random. No other accesses.
4. If securerandom.source=/dev/./urandom then SHA1PRNG is used. Initial seed is non-blocking via /dev/./urandom. No other accesses.
B. Oracle JDK 8 b25.
@gakuzzzz
gakuzzzz / file.md
Last active June 23, 2019 13:51
UserId など値型はどうするべきか

UserId などの型はどうするべきか

1. primitive 型をそのまま使う

case class Person(id: Long, name: String, organizationId: Long)
object Person {

  def groupByOrg: Map[Long, Seq[Person]] = ...