Skip to content

Instantly share code, notes, and snippets.

View ulinkwo's full-sized avatar
🤒
Out sick

Kyle Liu ulinkwo

🤒
Out sick
View GitHub Profile
public class PipeTest {
public static void main(String[] args) throws java.io.IOException, java.lang.InterruptedException {
java.lang.Runtime rt = java.lang.Runtime.getRuntime();
// Start three processes: ps ax | grep rbe | grep JavaVM
java.lang.Process p1 = rt.exec("ps ax");
java.lang.Process p2 = rt.exec("grep rbe");
java.lang.Process p3 = rt.exec("grep JavaVM");
// Start piping
java.io.InputStream in = Piper.pipe(p1, p2, p3);
@ulinkwo
ulinkwo / pom.xml
Last active December 15, 2015 04:38 — forked from Riduidel/pom.xml
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@ulinkwo
ulinkwo / tomcat.pp
Created December 2, 2013 14:20 — forked from ehazlett/tomcat.pp
class tomcat {
$tomcat_url = "http://mirrors.axint.net/apache/tomcat/tomcat-7/v7.0.25/bin/apache-tomcat-7.0.25.tar.gz"
$jdk_url = "http://download.oracle.com/otn-pub/java/jdk/6u25-b06/jdk-6u25-linux-x64.bin"
Exec {
path => "${::path}",
}
group { "puppet":
ensure => present,
}
import java.util.Collection;
import java.util.List;
import java.util.ListIterator;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
/**
* Extension class between spring data commons and java.util.List that is
* required to get MyBatis to use it as a return value.
@ulinkwo
ulinkwo / build_nginx.sh
Created August 13, 2016 12:26 — forked from Belphemur/build_nginx.sh
Compiling Nginx with LibreSSL (and http2)
#!/usr/bin/env bash
# names of latest versions of each package
export NGINX_VERSION=1.11.3
export VERSION_PCRE=pcre-8.38
export VERSION_LIBRESSL=libressl-2.4.2
export VERSION_NGINX=nginx-$NGINX_VERSION
#export NPS_VERSION=1.9.32.10
#export VERSION_PAGESPEED=v${NPS_VERSION}-beta
@ulinkwo
ulinkwo / ssh.md
Last active September 10, 2021 09:15 — forked from suziewong/ssh.md
SSH端口转发实验

通过本机的81号端口访问测试服务器89的我的私人apache目录(端口为11063)

使用本地转发,在本机上输入

ssh -L 81:210.32.200.89:11063 suzie@210.32.200.89

这时候打开浏览器,输入地址127.0.0.1:81 我同时也试验了

ssh -L 81:127.0.0.1:11063 suzie@210.32.200.89

ssh -L 81:localhost:11063 suzie@210.32.200.89

@ulinkwo
ulinkwo / iterm.md
Created August 30, 2016 10:17 — forked from suziewong/iterm.md
iterm2 tmux

多窗口管理 我们可以使用多窗口,也可以使用多标签来操作。

分割当前的窗口可以使用:

cmd + d 水平分割窗口

cmd + shift + d 垂直分割窗口

cmd + [ 和 cmd + ]在分割窗口之间切换

@ulinkwo
ulinkwo / GPG Capabilities.md
Last active August 21, 2018 02:23 — forked from mkroman/GPG Capabilities.md
GPG key capabilities and usage meanings

Signing is signing data (i.e. gpg --sign the_file)

Certification is signing a key (i.e. gpg --sign-key the_key)

Authentication is signing a challenge (like ssh does). The Authentication stuff can be used to log in to a machine using your GPG key.

The signature math is the same however you do it. The key usage flags are just to classify things.

@ulinkwo
ulinkwo / GPG and git on macOS.md
Created July 13, 2018 07:35 — forked from danieleggert/GPG and git on macOS.md
How to set up git to use the GPG Suite

GPG and git on macOS

Setup

No need for homebrew or anything like that. Works with https://www.git-tower.com and the command line.

  1. Install https://gpgtools.org -- I'd suggest to do a customized install and deselect GPGMail.
  2. Create or import a key -- see below for https://keybase.io
  3. Run gpg --list-secret-keys and look for sec, use the key ID for the next step
  4. Configure git to use GPG -- replace the key with the one from gpg --list-secret-keys