Skip to content

Instantly share code, notes, and snippets.

@mtgto
mtgto / run.sh
Created August 12, 2014 01:30
icon image generator for iOS. Before execute, you need to create 1024x1024 png.
#!/bin/sh
convert Icon.png -resize 29x -strip +set date:create +set date:modify Icon-29.png
convert Icon.png -resize 58x -strip +set date:create +set date:modify [email protected]
convert Icon.png -resize 80x -strip +set date:create +set date:modify [email protected]
convert Icon.png -resize 57x -strip +set date:create +set date:modify Icon-57.png
convert Icon.png -resize 114x -strip +set date:create +set date:modify [email protected]
convert Icon.png -resize 120x -strip +set date:create +set date:modify [email protected]
convert Icon.png -resize 29x -strip +set date:create +set date:modify Icon-29.png
convert Icon.png -resize 58x -strip +set date:create +set date:modify [email protected]
convert Icon.png -resize 40x -strip +set date:create +set date:modify Icon-40.png
@mtgto
mtgto / httpd.rb
Created May 8, 2014 05:47
simple HTTP server
require 'webrick'
include WEBrick
s = HTTPServer.new(:Port => 10080)
s.mount_proc('/') do |req, res| res.body = 'hogehoge' end
s.start
@mtgto
mtgto / SampleSpec.scala
Created February 27, 2014 15:03
Specs2's mockito cannot mock the class which have the function returns AnyVal, but this example can be passes.
import org.specs2.mutable._
import org.specs2.mock._
trait Dummy extends Any
case class V(s: String) extends AnyVal with Dummy
class A {
def f: Dummy = new V("Hello")
}
@mtgto
mtgto / garoond.rb
Created January 31, 2014 07:36
ガルーンから今月&来月分のiCalデータを取ってきてくれるプロキシ
require 'sinatra'
require 'net/https'
require 'uri'
require 'date'
=begin
ガルーンから今月&来月分のiCalデータを取ってきてくれるプロキシです。
sinatraが必要なので、入れてなければgem install sinatraしてね。
使い方はこのプログラムを起動してから、iCalでカレンダーメニューの照会を開き、"http://localhost:10999/ical"を指定すればいけるはず。
=end
@mtgto
mtgto / proxy.rb
Created September 25, 2013 03:02
対sbt用proxy (ruby製。typoあり)
require 'socket'
require 'net/http'
require 'uri'
class Proxy
PORT = 8888
def initialize
@server_socket = TCPServer.open(nil, PORT)
@responses = {}
@mtgto
mtgto / proxy.rb
Last active December 20, 2015 05:49
ゴミHTTP Proxy (HEAD, GETのみ対応)
require 'socket'
require 'net/http'
require 'uri'
class Proxy
PORT = 8888
def initialize
@server_socket = TCPServer.open(nil, PORT)
end
@mtgto
mtgto / gist:5554562
Last active December 17, 2015 04:59
puzzle
00101100110001101010101010101100011011001011001001101100000111001010101010101100100111000000101000101100100001101100101001101100100111000001001011101100000011001011001010101100100111000101101010101100111011000001001000101100110011001110101010101100100001101001101000101100001011001010101010101100111011001010101000101100011011001110001001101100111011001011001001101100001001101110101010101100101011000011001010101100011011001110101001101100000111000000101010101100100111000011001000101100100001100100101001101100100111000100101010101100100011000001001001101100100111000011001010101100100011001001101000101100111011001010101000101100010011000110101001101100111011000100101000101100110011001110001001101100111011000101001011001100001001100000101011001100001001100001001000001100100001101100101001010000
@mtgto
mtgto / HogeSpec.scala
Last active December 16, 2015 15:49
Specs2でinのネストができなくなってた!
import org.specs2.mutable.Specification
class HogeSpec extends Specification {
"One" should {
"Two test" in {
2 === 2
}
"Two" in {
"Three test" in {
3 === 3
@mtgto
mtgto / Build.scala
Created April 8, 2013 16:15
lazy valを使わないとヌルポ (Play 2.1.1)
import sbt._
import Keys._
import play.Project._
object ApplicationBuild extends Build {
val appName = "test"
val appVersion = "1.0-SNAPSHOT"
/*lazy*/val main = play.Project(appName, appVersion, appDependencies).settings() // cause NullPointerException!
@mtgto
mtgto / gist:5331366
Created April 7, 2013 17:13
直近2日間のgitのブランチに対して変更した行数とファイル数を表示する
git log --shortstat --since "2 days ago" | grep "files changed" | awk '{files+=$1; inserted+=$4; deleted+=$6} END {print "files changed", files, "lines inserted:", inserted, "lines deleted:", deleted}'