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 | |
tmp=$(mktemp -d) | |
pushd "$tmp" | |
iso=/Users/lloeki/Downloads/archlinux-2015.08.01-dual.iso | |
echo "fixing disk" | |
dd if=/dev/zero bs=2k count=1 of=tmp.iso | |
dd if=$iso bs=2k skip=1 >> tmp.iso | |
echo "mounting disk" |
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
B1: Build charDev bang cach su dung lenh make. | |
B2: Xem major trong log bang lenh dmesg | |
B3: Chinh sua file loadcript.sh de phu hop voi major trong he thong | |
B4: Build va chay chuong trinh test kiem tra ket qua |
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 design; | |
import java.lang.invoke.CallSite; | |
import java.lang.invoke.LambdaMetafactory; | |
import java.lang.invoke.MethodHandle; | |
import java.lang.invoke.MethodHandles; | |
import java.lang.invoke.MethodHandles.Lookup; | |
import java.lang.invoke.MethodType; | |
import java.lang.reflect.Field; | |
import java.lang.reflect.Method; |
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.List; | |
import java.util.concurrent.TimeUnit; | |
import rx.Observable; | |
import rx.Subscriber; | |
import rx.schedulers.Schedulers; | |
public class DebounceBuffer { | |
public static void main(String args[]) { |
This is an example of using Linux Kernel's
Transparent Proxy
to route all TCP traffic to docker containers without having to resort to
PROXY protocol
which is not supported by some applications
(e.g. sshd
). To get the demo to work you only need vagrant installed:
git clone [this-gist] tproxy-demo
cd tproxy-demo
vagrant up
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
Mac OS X has only 16K ports available that won't be released until socket | |
TIME_WAIT is passed. The default timeout for TIME_WAIT is 15 seconds. | |
Consider reducing in case of available port bottleneck. | |
You can check whether this is a problem with netstat: | |
# sysctl net.inet.tcp.msl | |
net.inet.tcp.msl: 15000 | |
# sudo sysctl -w net.inet.tcp.msl=100 |
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
Latency Comparison Numbers (~2012) | |
---------------------------------- | |
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns 14x L1 cache | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
Compress 1K bytes with Zippy 3,000 ns 3 us | |
Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
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
#include <stdio.h> | |
#include <stdint.h> | |
/* | |
This file tests a direct-threaded interpreter with the ability to | |
switch the mode (by modifying the dispatch table). | |
It uses one non-standard feature supported by GCC and Clang on Darwin, | |
namely "Labels as Values" (the syntax "&&label_name"). |
NewerOlder