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
package net.moznion.jesque.worker; | |
import lombok.extern.slf4j.Slf4j; | |
import net.greghaines.jesque.Config; | |
import net.greghaines.jesque.ConfigBuilder; | |
import net.greghaines.jesque.Job; | |
import net.greghaines.jesque.client.Client; | |
import net.greghaines.jesque.client.ClientImpl; | |
import net.greghaines.jesque.worker.JobFactory; | |
import net.greghaines.jesque.worker.MapBasedJobFactory; |
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
package net.moznion; | |
import me.geso.nanobench.Benchmark; | |
import me.geso.nanobench.Benchmark.Bench; | |
import java.util.Random; | |
import java.util.concurrent.ThreadLocalRandom; | |
public class BenchmarkRandom { | |
public static class RandomNumberGenerator extends Thread { |
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
enum LowerCaseLetter { | |
a, b, c; | |
private static final List<LowerCaseLetter> VALUES = Arrays.asList(values()); | |
private static final int SIZE = VALUES.size(); | |
private static final Random RANDOM = new Random(); | |
public static String getRandomLetter() { | |
return VALUES.get(RANDOM.nextInt(SIZE)).toString(); | |
} | |
} |
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
package me.geso.routes; | |
import java.util.LinkedHashMap; | |
public class PathRouteBench { | |
public void benchPathRoute() { | |
for (int i = 0; i < 1_000_000; ++i) { | |
PathRoute<String> route = new PathRoute<String>("/foo/*", "Detail"); | |
LinkedHashMap<String, String> captured = new LinkedHashMap<>(); | |
boolean matched = route.match("/foo/bar/baz", captured); |
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 java.util.Formatter; | |
public class Bench { | |
private String fileName = "foo.java"; | |
private String className = "class.dayo"; | |
private String methodName = "methodDayo"; | |
private int lineNumber = 42; | |
public void benchStringBuilder() { | |
for (int i=0; i<1_000_000; ++i) { |
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
.DEFAULT_GOAL := watch | |
thesis.dvi: thesis.tex | |
platex thesis.tex | |
thesis.pdf: thesis.dvi | |
dvipdfmx -f texfonts.map thesis.dvi | |
watch: | |
./script/watcher --dir ./thesis.tex -- make thesis.pdf |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
my ($old_file, $new_file) = @ARGV; | |
if (!defined $old_file || !defined $new_file) { | |
die "You must give two file names via command line argument"; |
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
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use utf8; | |
use File::chdir; | |
use File::Temp qw/tempdir/; | |
use File::Copy qw/move/; | |
use Text::Iconv; | |
use Excel::Writer::XLSX; |
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
orig_program_name = $0 | |
(1..100).each do |i| | |
# do something | |
sleep 0.1 | |
# ここでプログラム名上書きして進捗を追加 | |
$0 = "#{orig_program_name}(#{i}%)" | |
end |
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
my $lpnum = 1; | |
for ($i++; $token = $tokens->[$i]; $i++) { | |
$token_type = $token->{type}; | |
if ($token_type == LEFT_PAREN) { | |
$lpnum++; | |
} | |
elsif ($token_type == RIGHT_PAREN) { | |
last if --$lpnum <= 0 ; | |
} | |
# ここでてきとうに処理する |