Skip to content

Instantly share code, notes, and snippets.

View ponkotuy's full-sized avatar
🗾

ponkotuy ponkotuy

🗾
View GitHub Profile
@ponkotuy
ponkotuy / scalas
Created December 22, 2015 11:37
scalasスクリプト(sbt-extraユーザ向け)
#!/bin/sh
java -jar $HOME/.sbt/launchers/0.13.9/sbt-launch.jar -Dsbt.main.class=sbt.ScriptMain -Dsbt.boot.directory=$HOME/.sbt/boot "$@"
@ponkotuy
ponkotuy / Main.scala
Created December 22, 2015 11:36
SkinnyMicroScalas サンプル
#!/usr/bin/env scalas
/***
scalaVersion := "2.11.7"
resolvers += "sonatype releases" at "https://oss.sonatype.org/content/repositories/releases"
libraryDependencies += "org.skinny-framework" %% "skinny-micro-server" % "1.0.+"
*/
import skinny.micro._
@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();
@ponkotuy
ponkotuy / Prob44_2.d
Last active December 18, 2015 13:39
Project Euler の問題44より。 http://projecteuler.net/problem=44 Scala版は遅くて使い物にならないのだが何故?
import std.stdio;
import std.math;
class Penta
{
private:
pure uint pentagonal(uint n) {
return n*(3*n - 1)/2;
}
@ponkotuy
ponkotuy / C.java
Last active December 17, 2015 23:39
Java8のサンプル
package com.ponkotuy;
import java.util.function.Consumer;
/**
* Created with IntelliJ IDEA.
* User: yosuke
* Date: 13/05/31
* Time: 3:23
* 実装付きinterface
@ponkotuy
ponkotuy / gist:5379540
Last active December 16, 2015 04:49
Akka ActorでPipeline処理
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 / Main.scala
Last active December 8, 2015 05:26
Compare Changing Date to yyyymmddhh(Int)
import java.text.SimpleDateFormat
import java.util.{Calendar, Date}
import com.github.nscala_time.time.Imports._
object Main extends App {
def timer[A](name: String)(f: => A): A = {
val start = System.currentTimeMillis()
val result = f
println(s"${name}: ${System.currentTimeMillis() - start}ms")
@ponkotuy
ponkotuy / hero_tower_bot.sh
Created September 14, 2015 19:55
HeroTowerBot
#!/bin/sh
# 勇者の塔を自動プレイする簡易スクリプト
# ただしNexus6(1440x2560)に限る
# 必要なもの: adb
# 条件: 兵士タブを開いた状態にし、スクロールを一番上にしておくこと
while :
do
@ponkotuy
ponkotuy / Main.scala
Last active August 29, 2015 14:23
jpexsのffdecで艦これの海域Flashから地図データぶっこ抜く
import java.io._
import com.jpexs.decompiler.flash.SWF
import com.jpexs.decompiler.flash.tags.{ShowFrameTag, PlaceObject2Tag, DefineSpriteTag, DefineBitsJPEG3Tag}
import scala.collection.JavaConverters._
object Main {
val LineRegex = """line(\d)""".r
def main(args: Array[String]) {