Skip to content

Instantly share code, notes, and snippets.

View simonkuang's full-sized avatar

Simon Kuang simonkuang

  • Chengtu, P.R.China
View GitHub Profile
@simonkuang
simonkuang / package.json
Last active April 11, 2019 10:39
a whole new webpack env
{
"name": "qiuzhi-chrome-extension",
"version": "1.0.0",
"main": "webpack.config.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"watch": "webpack --watch",
"start": "webpack-dev-server --open",
"build": "webpack"
var require = function (file, cwd) {
var resolved = require.resolve(file, cwd || '/');
var mod = require.modules[resolved];
if (!mod) throw new Error(
'Failed to resolve module ' + file + ', tried ' + resolved
);
var res = mod._cached ? mod._cached : mod();
return res;
}
@simonkuang
simonkuang / openresty_conf.lua
Last active October 10, 2018 09:45
sort files by date in nginx autoindex page
local c = '\
<html>\
<head><title>Index of /software/</title></head>\
<body bgcolor="white">\
<h1>Index of /software/</h1><hr><pre><a href="../">../</a>\
<a href="GeoIP-1.4.8/">GeoIP-1.4.8/</a> 10-Nov-2017 07:01 -\
<a href="GraphicsMagick-1.3.27/">GraphicsMagick-1.3.27/</a> 21-Dec-2017 03:50 -\
<a href="abseil-cpp/">abseil-cpp/</a> 28-Aug-2018 02:58 -\
<a href="curl-7.54.0/">curl-7.54.0/</a> 13-Nov-2017 03:37 -\
<a href="ffmpeg-4.0.2/">ffmpeg-4.0.2/</a> 30-Aug-2018 05:40 -\
@simonkuang
simonkuang / gist:a07cefd12c43a921db03eb9ce3bc2f66
Created September 30, 2018 15:59
update-android-sdk-which-need
#!/bin/bash
yum install -y unzip curl java-1.8.0-openjdk
if [[ -d /dev/shm ]]; then
TMP_DIR=/dev/shm
else
TMP_DIR=/tmp
fi
@simonkuang
simonkuang / index.ios.js
Last active September 8, 2017 03:21 — forked from Jpoliachik/index.ios.js
ReactNative LayoutAnimation Example
'use strict';
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
Text,
View,
TouchableOpacity,
LayoutAnimation,
watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
@simonkuang
simonkuang / howto-standalone-toolchain.md
Created January 12, 2017 07:28 — forked from Tydus/howto-standalone-toolchain.md
How to install Standalone toolchain for Android

HOWTO Cross compiling on Android

5W1H

What is NDK

NDK (Native Develop Toolkit) is a toolchain from Android official, originally for users who writes native C/C++ code as JNI library. It's not designed for compiling standalone programs (./a.out) and not compatible with automake/cmake etc.

What is Standalone Toolchain

"Standalone" refers to two meanings:

  1. The program is standalone (has nothing connect to NDK, and don't need helper scripts to run it)
  2. The toolchain is made for building standalone programs and libs, and which can used by automake etc.

(Optional) Why NDK is hard to use

By default, NDK uses android flavor directory structure when it's finding headers and libs, which is different from GNU flavor, so the compiler cannot find them. For Example:

@simonkuang
simonkuang / l2tp.sh
Created November 23, 2016 16:15
阿里云 ECS 创建 IPSec VPN 脚本
#!/bin/bash
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#===================================================================
# SYSTEM REQUIRED: CentOS 6 (32bit/64bit)
# DESCRIPTION: Auto install L2TP for CentOS 6
# Author: Teddysun <i@teddysun.com>
#===================================================================
if [[ $EUID -ne 0 ]]; then
@simonkuang
simonkuang / tmux-cheatsheet.markdown
Created November 22, 2016 15:18 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
[
"62.12.115.154",
"197.248.8.2",
"52.57.140.69"
]