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 / 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:

watchman watch-del-all && rm -rf node_modules/ && yarn cache clean && yarn install && yarn start -- --reset-cache
@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,
@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 / 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 -\
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 / 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"
windows CMD命令大全及详细解释和语法
引用:
http://letle.iteye.com/blog/169045
http://www.cppblog.com/kyelin/archive/2007/04/21/22540.aspx
windows批处理程序中的特殊字符
批处理介绍
纯以dos系统而言,可执行程序大约可以细分为五类,依照执行优先级由高到低排列分别是:
DOSKEY宏命令(预先驻留内存)
@simonkuang
simonkuang / find-windows-names.sh
Last active July 29, 2019 05:35
to resolve the windows names of PCs in local network
#!/bin/bash
# Only for MacOS
brew install nmap
for i in $(nmap -p3389 192.168.1.0/24 | grep -B5 "3389/tcp open" | grep "report for" | awk "{print \$5}"); do
echo $i: $(smbutil status $i | awk '!(NR%3){print $2}')
done
@simonkuang
simonkuang / retrieve_rpm.sh
Created August 12, 2019 11:38
Retrieve rpm packages for offline yum repo using docker.
#!/bin/bash
_DIR=$(cd "$(dirname "$0")";pwd)
cd $_DIR
## ============== retrieve rpms and prepare repo meta data
yum install -y createrepo
_ID=$(docker run --rm centos:7.2.1511 /bin/bash -c "sleep 10800")
export _ID