Skip to content

Instantly share code, notes, and snippets.

View mainyaa's full-sized avatar

Kazuyuki Mori mainyaa

  • Topgate, Inc.
  • Tokyo, JP
View GitHub Profile
@mainyaa
mainyaa / gce-boot2docker-image-boot.sh
Last active August 17, 2016 04:15
boot instance from boot2docker image on Google Compute Engine (WIP)
#!/usr/bin/env bash
VERSION="0.0.1"
set -e
[ -n "$DEBUG" ] && set -x
usage() {
printf "
Usage: $(basename $0) PROJECT_ID
@mainyaa
mainyaa / docker.rb
Last active August 29, 2015 13:56
Docker v0.8.0 Fomula for HomeBrew
require 'formula'
class Docker < Formula
homepage 'http://docker.io/'
url 'https://github.com/dotcloud/docker/archive/v0.8.0.tar.gz'
sha1 '1e9362dab2ac2ecb4a1f193a7e72d060000438c3'
depends_on 'go' => :build
depends_on 'mercurial' => :build
@mainyaa
mainyaa / angular-promise-all-nested-test.coffee
Last active December 31, 2015 22:39
unit testing nested $q.all().
'use strict'
# dependencies angularjs, karma, karma-mocha, mocha, chai, lodash
describe 'Unit: $q.all', () ->
describe 'should simulate nested promise', ->
scope = null
q = null
promise1resolved = false
@mainyaa
mainyaa / jetty.sh
Last active December 30, 2015 11:09
jetty.sh for supervisord with newrelic.
cd /var/www/HOGE
NR_JAR=/var/www/HOGE/newrelic/newrelic.jar
export NR_JAR
MAVEN_OPTS="$JAVA_OPTS -javaagent:$NR_JAR"
export MAVEN_OPTS
killall $(which java)
mvn clean compile jetty:run
@mainyaa
mainyaa / angular-promise.coffee
Last active December 30, 2015 08:29
unit testing $q.all
'use strict'
# dependencies angularjs, karma, karma-mocha, mocha, chai
describe 'Unit: $q.all', () ->
it 'should simulate promise', inject ($q, $rootScope) ->
deferred1 = $q.defer()
promise1 = deferred1.promise
deferred2 = $q.defer()
@mainyaa
mainyaa / runLengthEncoding.hs
Created November 29, 2012 11:30
run length encoding on haskell
import Data.List (group)
import Control.Arrow
main = putStrLn answer
solve = concatMap (uncurry (:) . (head &&& show.length)) . group
answer = solve "aaaabb"
@mainyaa
mainyaa / func.coffee
Created October 4, 2012 03:15
This is Functional Programming on CoffeeScript
_ = require "underscore"
assert = require "assert"
list = [1..6]
sum = _.chain(list)
.filter( (i) -> i % 2 == 0)
.map( (i) -> i * 2)
.reduce(
(seed, item) ->
seed + item
, 0)
@mainyaa
mainyaa / func.java
Created October 4, 2012 02:53
This is Functional Programming on Java
List<Integer> listI = list(1, list(2, list(3, list(4, list(5, list(6, emptyList()))))));
Integer sum = listI.filter(new Function1<Integer, Boolean>() {
public Boolean apply(Integer i){ return i % 2 == 0; }
})
.map(new Function1<Integer, Integer>() {
public Boolean apply(Integer i) { return i * 2; }
})
.foldLeft(0, new Function2<Integer, Integer, Integer>(){
public Integer apply(Integer seed, Integer item){ return seed + item; }
});
@mainyaa
mainyaa / unity3.5.5-unity4.0pre-side-by-side.diff
Created September 6, 2012 06:49
Diff Unity Docmentation 3.5.5 <-> 4.0pre
This file has been truncated, but you can view the full file.
Only in /Applications/Unity4.0/Documentation/: .DS_Store
Common subdirectories: /Applications/Unity/Documentation/Components and /Applications/Unity4.0/Documentation/Components
Common subdirectories: /Applications/Unity/Documentation/Images and /Applications/Unity4.0/Documentation/Images
Common subdirectories: /Applications/Unity/Documentation/Manual and /Applications/Unity4.0/Documentation/Manual
Common subdirectories: /Applications/Unity/Documentation/ScriptReference and /Applications/Unity4.0/Documentation/ScriptReference
diff --side-by-side /Applications/Unity/Documentation/legal.txt /Applications/Unity4.0/Documentation/legal.txt
UNITY 3.5 CONTAINS THE FOLLOWING THIRD PARTY LIBRARIES: UNITY 3.5 CONTAINS THE FOLLOWING THIRD PARTY LIBRARIES:
PhysX physics library. Copyright ? 2003-2008 by NVIDIA Corpor PhysX physics library. Copyright ? 2003-2008 by NVIDIA Corpor
Beast Copyright ? Autodesk, Inc.Raknet s Copyright ? Jenkin Beast Copyright ? Autodesk, Inc.Raknet s Copyright ? Jenkin
@mainyaa
mainyaa / appengine-log-downloader-forked.js
Created July 26, 2012 01:28
Google App Engine Log Downloader (forked by mainyaa)
// ==UserScript==
// @name Google App Engine Log Downloader (forked)
// @namespace gldf
// @description Google App Engine Log Downloader (forked by mainyaa)
// @include http://appengine.google.com/logs*
// @include https://appengine.google.com/logs*
// @author pto.developer (http://pto-s2.appspot.com/d/ or http://twitter.com/pto_developer)
// @author forked by mainyaa (http://twitter.com/mainyaa)
// ==/UserScript==