Skip to content

Instantly share code, notes, and snippets.

Thread Pools

Thread pools on the JVM should usually be divided into the following three categories:

  1. CPU-bound
  2. Blocking IO
  3. Non-blocking IO polling

Each of these categories has a different optimal configuration and usage pattern.

# Taken from https://forums.aws.amazon.com/thread.jspa?messageID=332091
sudo su -
cd /usr/local/bin
mkdir ffmpeg
cd ffmpeg
wget http://ffmpeg.gusari.org/static/64bit/ffmpeg.static.64bit.latest.tar.gz
tar -xzf ffmpeg.static.64bit.latest.tar.gz
@fooling
fooling / deps.sh
Created November 12, 2017 13:18 — forked from dustMason/deps.sh
How to compile ffmpeg on Amazon Linux (EC2) for use on AWS Lambda
#!/bin/bash
# Author : Hemanth.HM
# Email : hemanth[dot]hm[at]gmail[dot]com
# License : GNU GPLv3
#
function useage()
{
cat << EOU
Useage: bash $0 <path to the binary> <path to copy the dependencies>
%s/\(addTenant(.*,\d*,\d*,\)\(\d*,\)\(\d*,\d*\)/\1\3/g
@fooling
fooling / code line
Last active October 24, 2018 10:13
统计两次commit之间的代码量
git log --numstat --pretty="%H" 881579dd2569369f92104737d913629d4d6a6db5..branch_3.0.1 | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d,-%d\n",plus,minus)}'
git log --numstat --pretty="%H" 434868bb^..HEAD | grep bks | awk 'NF==3 {plus+=$1; minus+=$2} END {printf("+%d, -%d\n", plus, minus)}'
@fooling
fooling / get_cert.txt
Created August 1, 2016 09:24
Get cert
获取任意https的证书并加入java keystore
openssl s_client -connect 192.168.1.1:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > xxx.cert
keytool -import -v -trustcacerts -file /home/xxx/xxx.cert -keystore "$JAVA_HOME/jre/lib/security/cacerts" -keypass ""
@fooling
fooling / Sublime Text 3 Build 3103 License Key - CRACK
Last active May 15, 2018 03:50
Sublime Text 3 Build 3103 License Key - CRACK
—– BEGIN LICENSE —–
TwitterInc
200 User License
EA7E-890007
1D77F72E 390CDD93 4DCBA022 FAF60790
61AA12C0 A37081C5 D0316412 4584D136
94D7F7D4 95BC8C1C 527DA828 560BB037
D1EDDD8C AE7B379F 50C9D69D B35179EF
2FE898C4 8E4277A8 555CE714 E1FB0E43
@fooling
fooling / PureJavaCrc32.java
Created April 29, 2016 02:44
CRC32 in java
import java.util.zip.Checksum;
/**
* A pure-java implementation of the CRC32 checksum that uses
* the same polynomial as the built-in native CRC32.
* <p>
* This is to avoid the JNI overhead for certain uses of Checksumming
* where many small pieces of data are checksummed in succession.
* <p>
@fooling
fooling / 0_reuse_code.js
Last active September 21, 2015 08:28
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@fooling
fooling / log4j.xml
Created June 24, 2015 02:35
Java xmls
<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="PHYSICAL_SLOW"
class="org.apache.log4j.FileAppender">
<param name="File" value="/home/fooling/slow_slow.log"/>
<param name="Threshold" value="info"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"/>
</layout>