This file contains hidden or 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
from importlib import import_module | |
module = import_module(module_name) |
This file contains hidden or 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
cat test.tsv | awk -F$'\t' '{print $1}' |
This file contains hidden or 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
# JOBのステータス確認 | |
mapred job status job_1465270010777_0007 | |
# JOBのログ確認 | |
mapred job -logs job_1465270010777_0007 | |
# JOBのタスクID一覧 | |
mapred job -list-attempt-ids job_1465270010777_0007 MAP completed | |
# タスクのログ確認 | |
mapred job -logs job_1465270010777_0007 attempt_1465270010777_0007_m_000001_0 |
This file contains hidden or 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 sys | |
sys.path.append("./") # -filesで指定したファイルはカレントディレクトリにコピーされるのでパスを通す | |
import test2 |
This file contains hidden or 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
var params = new Map( | |
location.search | |
.replace(/^\?/, "") | |
.split('&') | |
.filter(d => d) | |
.map(d => d.split('=')) | |
); | |
params.get("param1") |
This file contains hidden or 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 decorate(view_func, decorators): | |
""" | |
Viewをデコレータでラップする。 | |
@param view_func: | |
@param decorators: | |
@return: | |
""" | |
if decorators: | |
for decorator in reversed(decorators): | |
view_func = decorator(view_func) |
This file contains hidden or 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
public static void main(String[] args) { | |
f(values(1, 9)) | |
.filter(exp -> sum(exp) == 100) | |
.forEach(System.out::println); | |
} | |
/** | |
* sからeまでの連続した数値のリストを返す。 | |
*/ | |
static List<Integer> values(int s, int e) { |
This file contains hidden or 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
Clock clock = Clock.fixed( | |
ZonedDateTime.of(2015, 12, 15, 23, 30, 59, 999999999, ZoneId.systemDefault()).toInstant(), | |
ZoneId.systemDefault()); | |
System.out.println(LocalDateTime.now(clock)); //2015-12-15T23:30:59.999999999 |
This file contains hidden or 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
LocalDateTime d = LocalDateTime.now(); |
This file contains hidden or 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 static java.util.Spliterator.*; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.nio.charset.StandardCharsets; | |
import java.util.Iterator; | |
import java.util.Spliterator; | |
import java.util.Spliterators; | |
import java.util.function.Consumer; | |
import java.util.stream.Stream; |