Skip to content

Instantly share code, notes, and snippets.

View PyYoshi's full-sized avatar
🌍
Working from The World

MISAWA Yoshihiro PyYoshi

🌍
Working from The World
View GitHub Profile

Patch to cross compile to android with net/http support

Installation instructions

We need to patch Go's source code to allow cgo when cross-compiling and make Android-specific changes since it sometimes differs from linux (e.g.: it doesn't use /etc/resolv.conf for DNS config)

  1. Clone the go source: hg clone -u release https://code.google.com/p/go
  2. Enter the go source directory: cd go
  3. Apply the patch in this gist: patch -p1 < /path/to/patch/go_android.patch
  4. Enter the go/src directory: cd src
@hgfischer
hgfischer / benchmark+go+nginx.md
Last active April 11, 2024 22:09
Benchmarking Nginx with Go

Benchmarking Nginx with Go

There are a lot of ways to serve a Go HTTP application. The best choices depend on each use case. Currently nginx looks to be the standard web server for every new project even though there are other great web servers as well. However, how much is the overhead of serving a Go application behind an nginx server? Do we need some nginx features (vhosts, load balancing, cache, etc) or can you serve directly from Go? If you need nginx, what is the fastest connection mechanism? This are the kind of questions I'm intended to answer here. The purpose of this benchmark is not to tell that Go is faster or slower than nginx. That would be stupid.

So, these are the different settings we are going to compare:

  • Go HTTP standalone (as the control group)
  • Nginx proxy to Go HTTP
  • Nginx fastcgi to Go TCP FastCGI
  • Nginx fastcgi to Go Unix Socket FastCGI
#!/bin/bash
echo '#!/bin/bash'
echo ''
echo 'failed_items=""'
echo 'function install_package() {'
echo 'echo EXECUTING: brew install $1 $2'
echo 'brew install $1 $2'
echo '[ $? -ne 0 ] && $failed_items="$failed_items $1" # package failed to install.'
echo '}'
私が使っているCWMと通常起動を分岐させるスクリプトです。
起動時に音量キーを連打するとCWM起動になります。
bootイメージを展開して/initを/init.origにリネームし、代わりにこのスクリプトを/initに配置します。
busybox環境を/binに配置します。
CWM起動用のramdiskをtarで固めて/bin/recovery.tar.gzに配置します。
また、/bin/_suを配置しておくと良いと思います。
SH-04EとSH-06Eはexecでinit.origを実行すると何故か電波を掴まないので、CWMを起動しない場合はreboot recoveryします。
この機種は通常起動のブートイメージをrecoveryに焼いて下さい。
過去にCWM対応させた物はビルド用のデバイス定義を android_device_sharp_xxx というリポジトリで置いてあります。
多分参考になると思います。
recovery/root/init.recovery.qcom.rcが肝で、ここに機種依存の設定を書きます。
これを仕上げるのが結構大変です。
adbやCWMの動作に必要な、/systemにあるサービスのバイナリと使用するライブラリはproprietary-files.txtに書いてextract-files.shを実行してツリーに取り込みます。
これらのファイルはramdiskの/vendor配下に展開されます。
そのままでは/vendorに置いても動作しないので、extract-files.shは取り込みを行う際に/vendorで動く様にパッチします。
また、/vendor/binに実行権限が付与されないのでadd_permission_for_vendor.patchを適用する必要があります。
@wsargent
wsargent / docker_cheat.md
Last active August 31, 2023 12:10
Docker cheat sheet
@shime
shime / .gitignore
Last active December 24, 2015 17:39 — forked from uu59/.gitignore
socket.io and sinatra in action
vendor/
.bundle/
node_modules/
Gemfile.lock
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@shinyaohira
shinyaohira / App States and Multitasking.md
Last active October 5, 2023 07:57
アプリケーションの状態とマルチタスキング

全体的に簡略化し、必要と思われる部分を抜粋しました。

  • Not running

    アプリは起動されていないか、実行されていたけれどもシステムによって終了されています。

  • Inactive

@uupaa
uupaa / msgpack.2.0alpha.js
Created November 18, 2012 17:34
msgpack.2.0alpha.js
/*!{id:"msgpack.js",ver:"2.0alpha",license:"MIT",author:"uupaa.js@gmail.com"}*/
(function(global) { // @arg Global: window or global
// --- header ----------------------------------------------
global.msgpack = {
pack: msgpack_pack, // msgpack.pack(mix:Mix,
// size:Integer = 16Kb):Uint8Array
unpack: msgpack_unpack // msgpack.unpack(view:Uint8Array):Mix
};