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 / point.c
Last active Jul 21, 2016
点を移動したりまわしたり
View point.c
#include <stdio.h>
#include <math.h>
typedef struct {
double x;
double y;
} point_t;
typedef struct {
point_t* center;
@ponkotuy
ponkotuy / ImageIOTest.scala
Created Jan 5, 2016
ImageIOのサンプル
View ImageIOTest.scala
import java.io.File
import javax.imageio.ImageIO
object Main extends App {
assert(args.nonEmpty)
val image = ImageIO.read(new File(args.head))
println(image.getWidth, image.getHeight)
}
@ponkotuy
ponkotuy / scalas
Created Dec 22, 2015
scalasスクリプト(sbt-extraユーザ向け)
View scalas
#!/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 Dec 22, 2015
SkinnyMicroScalas サンプル
View Main.scala
#!/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 / Main.scala
Last active Dec 8, 2015
Compare Changing Date to yyyymmddhh(Int)
View Main.scala
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")
View hero_tower_bot.sh
#!/bin/sh
# 勇者の塔を自動プレイする簡易スクリプト
# ただしNexus6(1440x2560)に限る
# 必要なもの: adb
# 条件: 兵士タブを開いた状態にし、スクロールを一番上にしておくこと
while :
do
@ponkotuy
ponkotuy / Main.scala
Last active Aug 29, 2015
jpexsのffdecで艦これの海域Flashから地図データぶっこ抜く
View Main.scala
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]) {
@ponkotuy
ponkotuy / Main.scala
Created Jun 27, 2015
jpexsのffdecからFlashのimageを取ってくるScala Sample
View Main.scala
import java.io._
import com.jpexs.decompiler.flash.SWF
object Main {
def main(args: Array[String]) {
val path = "/home/yosuke/01_01.swf"
val is = new FileInputStream(new File(path))
val swf = new SWF(is, path, "KanColle1_1", false)
@ponkotuy
ponkotuy / slow.sql
Last active Aug 29, 2015
SlowQueryとcreate table
View slow.sql
# Time: 150513 9:34:49
# User@Host: myfleet[myfleet] @ localhost [127.0.0.1]
# Thread_id: 63 Schema: myfleet QC_hit: No
# Query_time: 8.689849 Lock_time: 0.000136 Rows_sent: 2096 Rows_examined: 3635960
# Full_scan: Yes Full_join: No Tmp_table: Yes Tmp_table_on_disk: No
# Filesort: Yes Filesort_on_disk: No Merge_passes: 0 Priority_queue: No
SET timestamp=1431477289;
select br.area_id, br.info_no, br.cell, br.win_rank, ci.alphabet, count(1) as cnt from battle_result br left join cell_info ci on br.area_id = ci.area_id and br.info_no = ci.info_no and br.cell = ci.cell where br.created > 1396278000000 and br.created < 1431442800000 group by br.area_id, br.info_no, br.cell, br.win_rank order by br.area_id, br.info_no, br.cell, br.win_rank;
# 以下のように書き換えたら3倍ぐらい早くなった
@ponkotuy
ponkotuy / Main.scala
Created Mar 24, 2015
LittleProxyによる艦これProxyサンプル
View Main.scala
package com.ponkotuy
import java.nio.charset.Charset
import io.netty.channel.ChannelHandlerContext
import io.netty.handler.codec.http._
import org.littleshoot.proxy.impl.DefaultHttpProxyServer
import org.littleshoot.proxy.{HttpFilters, HttpFiltersAdapter, HttpFiltersSourceAdapter}
You can’t perform that action at this time.