Skip to content

Instantly share code, notes, and snippets.

View int128's full-sized avatar

Hidetake Iwata int128

View GitHub Profile
@int128
int128 / parser.groovy
Last active August 29, 2015 14:15
Method Overload with Map and Closure in Groovy
@groovy.transform.ToString()
class Args {
Collection items
Map settings
Closure closure
static Args parse(Object[] objects) {
def args = new Args()
def stack = objects as LinkedList
if (stack.last() instanceof Closure) {
@int128
int128 / gist:6fee4e6179553b14d02b
Last active August 29, 2015 14:14
Groovy trait
trait T {
private a(x) { "--$x--" }
def b(x) { a(x) }
def c(xs) { xs.collect { x -> a(x) } }
}
class C {
}
def c = new C()
@int128
int128 / gist:48039a6f5f22b91cab1d
Last active October 14, 2017 08:23
Introduction of Gistnote
@int128
int128 / post.md
Last active August 7, 2021 04:24
How to use Ruby on Cygwin

How to use Ruby on Cygwin

It is strongly recommended to run on Linux or OS X. Maybe many problems will happen.

Prerequisite

  • Cygwin
  • apt-cyg
  • http_proxy is set if needed
@int128
int128 / README.md
Last active August 29, 2015 14:13
Making a HTTP request on Google App Engine

Making a HTTP request on App Engine

Use HttpURLClient in Groovy.

import groovyx.net.http.HttpURLClient

try {
  def client = new HttpURLClient(url: 'https://...')
  def response = client.request(query: query)
@int128
int128 / Dockerfile
Created December 17, 2014 02:26
Docker with Gradle application plugin
from dockerfile/java:oracle-java7
volume /usr/src/groovy-ssh
copy . /usr/src/groovy-ssh
run cd /usr/src/groovy-ssh && \
./gradlew --gradle-user-home=.gradle installApp && \
cp -a build/install/groovy-ssh /
workdir /groovy-ssh/bin
entrypoint ["./groovy-ssh"]
@int128
int128 / README.md
Created December 3, 2014 03:14
How to install mecab

How to install mecab on Linux

Fetch sources.

  • mecab-0.996
  • mecab-ipadic-2.7.0-20070801

Make and install.

@int128
int128 / Dockerfile
Created November 21, 2014 10:41
Dockerfile for Gradle
from dockerfile/java:oracle-java7
run mkdir -p /usr/src/app
workdir /usr/src/app
add . /usr/src/app
run ./gradlew assemble
cmd ["./gradlew", "run"]
@int128
int128 / README.md
Created November 12, 2014 15:17
Ubuntu desktop on Docker container

Ubuntu desktop on Docker

apt-get update
apt-get install xfce4 tightvncserver language-pack-ja fonts-vlgothic

export USER=root
export LANG=ja_JP.UTF-8
ssh {
outputLogLevel = LogLevel.LIFECYCLE
}
task example(type: SshTask) {
session(remotes.localhost) {
execute 'uname -a'
execute 'secret', logging: false