Skip to content

Instantly share code, notes, and snippets.

View ponkotuy's full-sized avatar
🗾

ponkotuy ponkotuy

🗾
View GitHub Profile
@ponkotuy
ponkotuy / Main.scala
Created July 3, 2014 02:05
Scala for sample
for {
i <- 1 to 9
j <- 1 to 9
if i != j
result = s"($i, $j)"
} {
println(result)
}
@ponkotuy
ponkotuy / main.org
Created June 27, 2014 23:58
Cocos2dx(Ver2)の闇な話

Cocos2dx(Ver2)が闇な話

@ponkotuy
ponkotuy / Sample.scala
Created June 17, 2014 02:40
なんでこれがコンパイルエラーなのか良く分からんちん
type Key = Long
implicit def strToKey(str: String): Long = str.toLong
@ponkotuy
ponkotuy / MyFleetGirls.org
Last active September 13, 2017 09:18
MyFleetGirls Presen

MyFleetGirls

@ponkotuy
ponkotuy / FinagleProxySample.scala
Created May 24, 2014 06:54
FinagleProxySample
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 / Main.scala
Last active August 29, 2015 13:56
補助コンストラクタでなぜかcompileできないパターン
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
}
@ponkotuy
ponkotuy / md5jasypt.scala
Created February 11, 2014 18:10
MD5総当たりjasypt版
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 / md5.scala
Created February 11, 2014 08:24
6桁数字をMD5で総当たりしてみた
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 / Reaper.scala
Last active December 20, 2015 04:09
Akka Actor Sample
import akka.actor._
import scala.collection.mutable.ArrayBuffer
object Reaper {
case class WatchMe(ref: ActorRef)
}
abstract class Reaper extends Actor {
import Reaper._
@ponkotuy
ponkotuy / Array.cs
Created June 30, 2013 10:46
AtCoderのContest14の問題Dの回答例(ただしどっちにせよ速度足りない) http://arc014.contest.atcoder.jp/tasks/arc014_4
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();