Skip to content

Instantly share code, notes, and snippets.

ponkotuy ponkotuy

Block or report user

Report or block ponkotuy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ponkotuy
ponkotuy / gist:5379540
Last active Dec 16, 2015
Akka ActorでPipeline処理
View gist:5379540
import scala.concurrent.Await
import scala.concurrent.duration._
import akka.actor._
import akka.pattern.gracefulStop
object Main extends App {
implicit val duration = 5.seconds
val system = ActorSystem()
// 初期化時に、データを渡すAcotrRefを引数にして初期化する
val ref = {
@ponkotuy
ponkotuy / C.java
Last active Dec 17, 2015
Java8のサンプル
View C.java
package com.ponkotuy;
import java.util.function.Consumer;
/**
* Created with IntelliJ IDEA.
* User: yosuke
* Date: 13/05/31
* Time: 3:23
* 実装付きinterface
@ponkotuy
ponkotuy / Prob44_2.d
Last active Dec 18, 2015
Project Euler の問題44より。 http://projecteuler.net/problem=44 Scala版は遅くて使い物にならないのだが何故?
View Prob44_2.d
import std.stdio;
import std.math;
class Penta
{
private:
pure uint pentagonal(uint n) {
return n*(3*n - 1)/2;
}
@ponkotuy
ponkotuy / Array.cs
Created Jun 30, 2013
AtCoderのContest14の問題Dの回答例(ただしどっちにせよ速度足りない) http://arc014.contest.atcoder.jp/tasks/arc014_4
View Array.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AtCoder {
class Cont014_4 {
static void Main(string[] args) {
string fst = Console.ReadLine();
@ponkotuy
ponkotuy / Reaper.scala
Last active Dec 20, 2015
Akka Actor Sample
View Reaper.scala
import akka.actor._
import scala.collection.mutable.ArrayBuffer
object Reaper {
case class WatchMe(ref: ActorRef)
}
abstract class Reaper extends Actor {
import Reaper._
@ponkotuy
ponkotuy / md5.scala
Created Feb 11, 2014
6桁数字をMD5で総当たりしてみた
View md5.scala
import java.security.MessageDigest
val md5 = MessageDigest.getInstance("MD5")
def equals[T](xs: Array[T], ys: Array[T]): Boolean = {
if(xs.size != ys.size) return false
var i = 0
while(i != xs.size) {
if(xs(i) != ys(i)) return false
@ponkotuy
ponkotuy / md5jasypt.scala
Created Feb 11, 2014
MD5総当たりjasypt版
View md5jasypt.scala
import scala.collection.GenSeq
import org.jasypt.util.digest.Digester
object Main {
val digester = new Digester("MD5")
def main(args: Array[String]): Unit = {
val salt = "hoge".getBytes("UTF8")
val digest = digester.digest(salt ++ toBytes(567890))
val single = timer { println(bruteForceSingle(salt, digest)) }
@ponkotuy
ponkotuy / Main.scala
Last active Aug 29, 2015
補助コンストラクタでなぜかcompileできないパターン
View Main.scala
object Main extends App {
val hoge = new Hoge()
println((hoge.hoge, hoge.fuga))
}
class Hoge(val hoge: Int, val fuga: Int) {
import Hoge._
def this() = this(init, init) // Compile Erorr! not found init
}
View FinagleProxySample.scala
package com.ponkotuy.proxy
import com.twitter.finagle.builder.ClientBuilder
import com.twitter.finagle.{Http, Service, http}
import org.jboss.netty.handler.codec.http.{HttpMethod, HttpResponse, HttpRequest}
import com.twitter.util.{Await, Future}
import com.github.theon.uri.Uri
class FinagleProxySample(hosts: String, port: Int, inter: Intercepter) {
val client = ClientBuilder().codec(http.Http()).hosts(hosts).build()
@ponkotuy
ponkotuy / MyFleetGirls.org
Last active Sep 13, 2017
MyFleetGirls Presen
You can’t perform that action at this time.