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 org.ehcache.CacheManager | |
import org.ehcache.clustered.client.config.builders.ClusteredResourcePoolBuilder | |
import org.ehcache.clustered.client.config.builders.ClusteringServiceConfigurationBuilder | |
import org.ehcache.config.CacheConfiguration | |
import org.ehcache.config.builders.CacheConfigurationBuilder | |
import org.ehcache.config.builders.CacheManagerBuilder | |
import org.ehcache.config.units.MemoryUnit | |
import org.ehcache.management.config.EhcacheStatisticsProviderConfiguration | |
import org.ehcache.management.config.StatisticsProviderConfiguration | |
import org.ehcache.management.registry.DefaultManagementRegistryConfiguration |
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
#!/bin/bash | |
[ ! -f build.gradle.orig ] && patch -b << 'EOF' | |
Index: build.gradle | |
IDEA additional info: | |
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP | |
<+>UTF-8 | |
=================================================================== | |
--- build.gradle (revision 369b3cc846c4e3bc5566a2150e9990693d2276a8) | |
+++ build.gradle (revision ) |
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
8:02 $ cat a.sh | |
#!/bin/bash | |
exit 11 | |
✔ ~/workspace/mathieu/management-apps [TAB-6693|✚ 2…2] | |
18:02 $ cat b.sh | |
#!/bin/bash | |
trap 'kill -TERM $PID' TERM INT | |
bash -c ./a.sh & | |
PID=$! |
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.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.ExecutionException; | |
import java.util.concurrent.Future; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.TimeoutException; | |
import java.util.function.Function; | |
/** | |
* @author Mathieu Carbou |
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
private static <T> T callInOtherThread(Callable<T> task) throws Throwable { | |
ExecutorService service = Executors.newSingleThreadExecutor(); | |
try { | |
Future<T> future = service.submit(task); | |
boolean interrupted = false; | |
try { | |
while (true) { | |
try { | |
return future.get(); | |
} catch (InterruptedException 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
var array = ['A', 'B', 'C'], | |
results = [], | |
errors = [], | |
worker = function(e, done) { | |
console.log('process', e); | |
if(Math.round(Math.random() * 31) % 2) { | |
done(null, 'result-' + e); | |
} else { | |
done(new Error(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
class PortTest { | |
public static void main(String[] args) { | |
Thread.startDaemon { | |
println "bind on 8888 but does not accept" | |
new Socket().bind(new InetSocketAddress(8888)) | |
Thread.currentThread().join() | |
} | |
Thread.startDaemon { |
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
module.exports = spawn | |
var _spawn = require("child_process").spawn | |
var EventEmitter = require("events").EventEmitter | |
var cygwin = process.platform === "win32" && (process.env.ORIGINAL_PATH || '').indexOf('/cygdrive/') != -1; | |
function spawn (cmd, args, options) { | |
if(cygwin && cmd.indexOf('cmd.exe') != -1) { | |
cmd = 'c:\\cygwin\\bin\\bash.exe'; |
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
--- git.js 2015-05-11 16:19:29.114852900 -0400 | |
+++ git-patched.js 2015-05-11 16:19:35.788234600 -0400 | |
@@ -12,14 +12,23 @@ | |
, git = npm.config.get("git") | |
, assert = require("assert") | |
, log = require("npmlog") | |
+ , win32 = process.platform === "win32" | |
+ , cygwin = win32 && (process.env.ORIGINAL_PATH || '').indexOf('/cygdrive/') != -1 | |
function prefixGitArgs () { |
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
// handle some git configuration for windows | |
exports.spawn = spawnGit | |
exports.chainableExec = chainableExec | |
exports.whichAndExec = whichAndExec | |
var exec = require("child_process").execFile | |
, spawn = require("./spawn") | |
, npm = require("../npm.js") | |
, which = require("which") |