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
public class StampedLockExample { | |
static StampedLock lock = new StampedLock(); | |
static void println(String message, Object... args) { | |
System.out.printf(message, args); | |
System.out.println(); | |
} | |
static void printReadLockCount() { | |
println("Lock count=%d", lock.getReadLockCount()); |
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
//Sets -Xss128k | |
public class StackMemoryExhaustation { | |
public static void stackConsumer(long stackSize) { | |
long a000 = 1; | |
long a001 = a000 + 1; | |
long a002 = a001 + 1; | |
long a003 = a002 + 1; | |
long a004 = a003 + 1; | |
long a005 = a004 + 1; |
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
public class BasicMonitor implements Monitor { | |
private Map<String, Stat> stats; | |
private Function<String, Stat> statBuilder; | |
public BasicMonitor(Collection<String> keys) { | |
Thread currentThread = Thread.currentThread(); | |
long threadId = currentThread.getId(); | |
String threadName = currentThread.getName(); | |
statBuilder = name -> new Stat(threadId, threadName, name); |
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
/** | |
* <p>Multi-threaded run helper.</p> | |
* <p>Based on few parameters, launch a fixed number of task and wait a given amount of time before | |
* interrupting them and give back execution results</p> | |
*/ | |
public class Executor { | |
/** Makes tasks starting at the same time **/ | |
public boolean syncStartup = true; | |
/** Number of task to run in parallel **/ |
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
#!/bin/sh | |
#To drop in /var/lib/boot2docker/bootsync.sh | |
echo "Appending custom ca-certificates" | |
for file in /var/lib/boot2docker/certs/*.pem; do | |
echo " - Append $file" | |
cat "$file" >> /etc/ssl/certs/ca-certificates.crt | |
done | |
echo "Appending custom ca-certificates (complete)" |
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 com.github.loganmzz.labo.reactor.samples; | |
import reactor.core.publisher.Flux; | |
import reactor.core.publisher.ParallelFlux; | |
import reactor.core.scheduler.Scheduler; | |
import reactor.core.scheduler.Schedulers; | |
import java.util.Date; | |
import java.util.concurrent.ThreadLocalRandom; |
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
let myName = "Capucin" | |
var isOver = false | |
public init() { | |
// Nothing | |
} | |
public func play(_ game:Game, _ teamId:Int) -> Direction { | |
print("Team ID: \(teamId)") |
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
#!/bin/sh | |
echo "Merging src-* directories into source" | |
rm -rf "source" | |
mkdir -p "source" | |
for source in src-*; do | |
echo " -- Merging ${source}" | |
cp -r "${source}"/* "source" | |
done |
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 org.apache.jmeter.services; | |
import java.io.ByteArrayOutputStream; | |
import java.io.Closeable; | |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.RandomAccessFile; | |
import java.nio.charset.Charset; | |
import java.util.concurrent.ThreadLocalRandom; |
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 chars = [ | |
'a'..'z', '0'..'9', | |
// 'àâäéèêëìîïòôöùûüÿçñ', | |
'@#&!=+$£€*?,;.:-_(){}[]' | |
] | |
def printChars(list) { | |
println(list.join().replaceAll(/[\[\]-]/, /\\$0/)) | |
} |
OlderNewer