This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export GIT_DIR=`git rev-parse --git-dir` | |
hookname=`basename $0` | |
FILE=`mktemp` | |
trap 'rm -f $FILE' EXIT | |
cat - > $FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
StringBuilder sb = new StringBuilder() | |
new File('wiki.txt').eachLine { line -> | |
// link | |
line = line.replaceAll(/\[\[(.*):(https*:.*)\]\]/, '[$1]($2)') | |
if (line.startsWith('#geshi')) { | |
// code | |
sb << line.replaceFirst(/^#geshi\((.*)\)\s*\{\{$/, '```$1') | |
} else if (line.startsWith('}}')) { | |
sb << line.replace('}}', '```') | |
} else if (line.matches(/^\|.*\|h$/)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
apply plugin: 'idea' | |
sourceCompatibility = 1.8 | |
version = '0.0.1-SNAPSHOT' | |
repositories { | |
mavenCentral() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apply plugin: 'java' | |
apply plugin: 'idea' | |
sourceCompatibility = 1.7 | |
tasks.withType(AbstractCompile) { options.encoding = 'UTF-8' } | |
version = '1.0' | |
configurations { | |
provided | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./gradlew tasks --debug | |
(省略) | |
15:49:07.706 [ERROR] [org.gradle.BuildExceptionReporter] FAILURE: Build failed with an exception. | |
15:49:07.707 [ERROR] [org.gradle.BuildExceptionReporter] | |
15:49:07.707 [ERROR] [org.gradle.BuildExceptionReporter] * Where: | |
15:49:07.707 [ERROR] [org.gradle.BuildExceptionReporter] Build file '~/src/github.com/yukung/some-project/build.gradle' line: 167 | |
15:49:07.707 [ERROR] [org.gradle.BuildExceptionReporter] | |
15:49:07.708 [ERROR] [org.gradle.BuildExceptionReporter] * What went wrong: | |
15:49:07.708 [ERROR] [org.gradle.BuildExceptionReporter] A problem occurred evaluating root project 'some-project'. | |
15:49:07.708 [ERROR] [org.gradle.BuildExceptionReporter] > [Ljava/util/HashMap$Entry; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.atomic.LongAdder; | |
public class ConcurrentNew { | |
public static void main(String[] args) { | |
// Java8 から追加された、複数スレッドからアトミックに更新できる Long 型の LongAdder | |
// Java5 からある、AtomicInteger などと同じような考え方だが、Atomic系のクラスよりも高いパフォーマンスを出す。 | |
// 複数スレッドから頻繁に更新するようなケースで高いパフォーマンスを発揮する。 | |
// 他にも DoubleAdder などがある。 | |
LongAdder longAdder = new LongAdder(); | |
// 加算 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app xmlns="http://java.sun.com/xml/ns/javaee" | |
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" | |
id="serv" version="3.0"> | |
<jsp-config> | |
<jsp-property-group> | |
<url-pattern>*.jsp</url-pattern> | |
<el-ignored>false</el-ignored> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ls coloring and shortcut | |
alias ls='ls -G' | |
alias ll='ls -hl' | |
alias la='ls -a' | |
export CLICOLOR=1 | |
export LSCOLORS=gxfxcxdxbxegedabagacad | |
# less coloring settings | |
export LESS='-R' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def filter(list, p) { | |
if (list.size() == 0) return list | |
if (p(list.head())) | |
[] + list.head() + filter(list.tail(), p) | |
else | |
filter(list.tail(), p) | |
} | |
l = filter(1..20, {n-> n % 2 == 0}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def filter(list, p) { | |
def new_list = [] | |
list.each { i -> | |
if (p(i)) | |
new_list << i | |
} | |
new_list | |
} | |
modBy2 = { n -> n % 2 == 0} |
NewerOlder