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
git fetch --all --prune | |
git branch -r --merged | grep feature | ruby -pane'gsub /^\*origin\//, ""' | xargs git push origin --delete | |
git branch -r --merged | grep fix | ruby -pane'gsub /^\*origin\//, ""' | xargs git push origin --delete |
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 com.google.cloud.datastore._ | |
import com.google.cloud.datastore.testing._ | |
object Main extends App { | |
val localDatastoreHelper = LocalDatastoreHelper.create() | |
localDatastoreHelper.start() | |
val ds = localDatastoreHelper.options.service |
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
def parseFacebookTZ(src: String): Option[String] = | |
"""([-+])?(\d+)(?:\.(\d+))""".r.findFirstMatchIn(src).map { | |
m => ("+" + m.group(1)).last + "%02d:%02d".format(m.group(2).toInt, m.group(3).toInt) | |
} | |
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
#!/bin/ruby | |
require 'net/http' | |
require 'uri' | |
require 'json' | |
require 'fileutils' | |
if ARGV.size < 4 | |
$stderr.puts("Usage: ruby #{$0} $slackWebHook $scovarageNewXml $scovarageOldXml") | |
exit -1 |
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.UTF_8 | |
import java.util.Base64 | |
import javax.crypto.Cipher | |
import javax.crypto.spec.IvParameterSpec | |
import javax.crypto.spec.SecretKeySpec | |
object EasyCrypto { | |
private[this] val IV = "prVznW_57".getBytes(UTF_8) |
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
#!/bin/sh | |
DNS_SERVER=127.0.0.1 | |
# Appends $DNS_SERVER to the DNS server list. | |
cat /etc/resolv.conf | awk '/^\s*nameserver\W/ { print $2 }' | xargs -J '%' sudo networksetup -setdnsservers 'Wi-Fi' '%' $DNS_SERVER | |
# Flushes DNS resolver caches. | |
sudo killall -HUP mDNSResponder |
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 jp.segfault.jdbc_sample.util.functional | |
import scala.language.higherKinds | |
import scalaz._ | |
import scalaz.Scalaz._ | |
sealed trait FreeA[F[_], +A] { | |
import PartialFreeA._ |
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
val Int.incr: Int get() = this + 1 | |
val Int.decr: Int get() = this - 1 | |
fun main(b: Boolean) { | |
println(if (b) Int::incr else Int::decr) | |
} |
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
class Human(val name: String, val age: Int, val children: List<Human>) | |
val age: Int? = null | |
print(::Human.curry() `$` "John" `*` age `*` listOf<Human>()) // == null | |
print(::Human.curry() `$` "Mary" `*` 999 `*` listOf<Human>()) // != null |
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
#!/bin/sh | |
HOST=$1 | |
PORT=$2 | |
echo 'stats slabs' | nc $HOST $PORT | sed -rn 's/^STAT ([0-9]+):.*/stats cachedump \1 0/p' | uniq | nc $HOST $PORT | awk '/^ITEM / { print $2 }' |