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
sysctl kern.maxfiles | |
#kern.maxfiles: 12288 | |
sysctl kern.maxfilesperproc | |
#kern.maxfilesperproc: 10240 | |
sudo sysctl -w kern.maxfiles=1048600 | |
#kern.maxfiles: 12288 -> 1048600 | |
sudo sysctl -w kern.maxfilesperproc=1048576 | |
#kern.maxfilesperproc: 10240 -> 1048576 | |
sudo sysctl -w net.inet.tcp.rfc1323=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
//http://codebetter.com/gregyoung/2007/06/18/async-sockets-and-buffer-management/ | |
namespace TickerPlant | |
{ | |
/// <summary> | |
/// A manager to handle buffers for the socket connections | |
/// </summary> | |
/// <remarks> | |
/// When used in an async call a buffer is pinned. Large numbers of pinned buffers | |
/// cause problem with the GC (in particular it causes heap fragmentation). |
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
//https://github.com/wsky/cross-fire/blob/master/java/src/main/java/com/taobao/top/integration/Util.java | |
private static String doSign(String secret, Map<String, String> data) { | |
String[] keys = new String[data.size()]; | |
data.keySet().toArray(keys); | |
Arrays.sort(keys); | |
StringBuilder strb = new StringBuilder(); | |
strb.append(secret); | |
for (String k : keys) { | |
// data.get(k) != "" sometimes unnecessary |
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
// context interface to resolve env dependency | |
public interface ContextService { | |
public Object get(String key); | |
} | |
// context base | |
// alose can impl via aop inspector | |
public class BizServiceAdapter implements BizInterface { | |
private ContextService context; | |
private BizService bizService; |
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
//view all certificates | |
certmgr.msc | |
//http://msdn.microsoft.com/en-us/library/bfsktky3(VS.80).aspx | |
//make certificates | |
makecert -sk testcer -n "CN=testcer" -ir localmachine -ss my -sky exchange testcer.cer | |
makecert -r -pe -n "CN=workflowcer" -b 01/01/2005 -e 01/01/2050 -sky exchange -ss my | |
makecert -r -pe -n "CN=testcer" -b 01/01/2005 -e 01/01/2050 -sky exchange -ss my |
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 NamedThreadFactory implements ThreadFactory { | |
static final AtomicInteger poolNumber = new AtomicInteger(1); | |
final AtomicInteger threadNumber = new AtomicInteger(1); | |
final ThreadGroup group; | |
final String prefix; | |
final boolean isDaemon; | |
final int priority; | |
public NamedThreadFactory() { |
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.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
// easy timer task, support delay and reset | |
public class ResetableTimer { | |
private boolean running; | |
private Thread boss; | |
private ExecutorService threadPool; | |
private Runnable task; |
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
//c# byte 0-255 |
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/bash | |
#how to: . call.sh | |
call_api() { | |
local APPKEY=$1 | |
local SECRET=$2 | |
local SESSION=$3 | |
local METHOD=$4 | |
local URL=$5 | |
local IP=$6 | |
local SSL=$7 |
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
tcpdump -i eth0 src 10.13.3.3 and port 7001 | |
tcpdump -i eth0 dst 10.13.3.3 and port 7001 | |
tcpdump -i eth0 -A -nn dst 10.13.3.3 and port 7001 | |
tcpdump -i eth0 -w dump.pcap dst 10.13.3.3 and port 7001 |
NewerOlder