Skip to content

Instantly share code, notes, and snippets.

#! /bin/sh
### BEGIN INIT INFO
# Provides: php-fpm
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts php-fpm
# Description: starts the PHP FastCGI Process Manager daemon

Install libbrotli

sudo apt-get install autoconf libtool libpcre3-dev zlib1g-dev

git clone https://github.com/bagder/libbrotli
cd libbrotli

./autogen.sh
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
@kuoruan
kuoruan / eclipse.sublime-keymap
Created October 12, 2016 08:01
Sublime-Eclipse shortcuts
[
/**
* 常用快捷键(Sublime默认)
* --------------
*
* 光标一个单词一个单词的移动
* { "keys": ["ctrl+left"], "command": "move", "args": {"by": "words", "forward": false} },
* 按住shift来选文字时, 一个个单词的选而不是一个个字母
* { "keys": ["ctrl+shift+left"], "command": "move", "args": {"by": "words", "forward": false, "extend": true} },
*
@kuoruan
kuoruan / PoSort.java
Created December 5, 2016 05:53
A util to sort Po File
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
#!/bin/sh
### BEGIN INIT INFO
# Provides: circusd
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: circus master control daemon
# Description: This is a daemon that controls the circus minions
### END INIT INFO
@kuoruan
kuoruan / MediaController.java
Last active June 13, 2022 21:24
Custom Android VideoView
/*
* Copyright (C) 2006 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@kuoruan
kuoruan / ppa.md
Last active June 4, 2018 07:43
Ubuntu PPAs

Preinstall

sudo apt install software-properties-common

Git

sudo add-apt-repository ppa:git-core/ppa
@kuoruan
kuoruan / bbr.patch
Created July 17, 2017 08:14
BBR Patch
--- a/net/ipv4/tcp_bbr.c
+++ b/net/ipv4/tcp_bbr.c
@@ -120,9 +120,9 @@ struct bbr {
#define CYCLE_LEN 8 /* number of phases in a pacing gain cycle */
/* Window length of bw filter (in rounds): */
-static const int bbr_bw_rtts = CYCLE_LEN + 2;
+static const int bbr_bw_rtts = CYCLE_LEN + 7;
/* Window length of min_rtt filter (in sec): */
-static const u32 bbr_min_rtt_win_sec = 10;
class BeanUtils {
public static <E, T> E covert(T src, Class<E> target) {
if (src == null) {
return null;
}
Method[] srcMethods = src.getClass().getMethods();
Method[] targetMethods = target.getMethods();
E targetObject = null;
try {