Skip to content

Instantly share code, notes, and snippets.

View hongqn's full-sized avatar
🏠
Working from home

Qiangning Hong hongqn

🏠
Working from home
View GitHub Profile
@hongqn
hongqn / gist:1758954
Created February 7, 2012 10:17
A benchmark tool in eventlet
#!/usr/bin/env python
# encoding: UTF-8
"""DoubanServiceBench"""
__author__ = "Qiangning Hong <hongqn@gmail.com>"
__version__ = "$Revision: 51434 $"
__date__ = "$Date: 2010-11-17 17:44:38 +0800 (Wed, 17 Nov 2010) $"
import sys
$ curl -v https://www.douban.com/service/auth2/token
* About to connect() to www.douban.com port 443 (#0)
* Trying 211.147.4.31... connected
* successfully set certificate verify locations:
* CAfile: none
CApath: /gentoo/etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
* SSLv3, TLS handshake, Server hello (2):
* SSLv3, TLS handshake, CERT (11):
* SSLv3, TLS handshake, Server key exchange (12):
@hongqn
hongqn / main.py
Created December 17, 2012 06:01
Template for main.py If you use vim, you can use https://github.com/aperezdc/vim-template or https://github.com/mattn/zencoding-vim to create it whenever you need a main script in python.
import sys
import logging
import argparse
def main(args):
pass
if __name__ == '__main__':
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
$ ACCEPT_KEYWORDS="**" emerge "=app-admin/eselect-9999" -vat
These are the packages that would be merged, in reverse order:
Calculating dependencies... done!
[ebuild U ] app-admin/eselect-9999::gentoo [1.3.3::gentoo_prefix] USE="-doc" 0 kB
Total: 1 package (1 upgrade), Size of downloads: 0 kB
Would you like to merge these packages? [Yes/No]
$ PORTAGE_CONFIGROOT=$EPREFIX crossdev --target armv6j-hardfloat-linux-gnueabi -v --b 2.23
-----------------------------------------------------------------------------------------------
* crossdev version: b3c18b8f7ee1c0d7cfeac08f4a8c22cf667116b1
* Host Portage ARCH: x64-macos
* Target Portage ARCH: arm
* Target System: armv6j-hardfloat-linux-gnueabi
* Stage: 4 (C/C++ compiler)
* ABIs: default
* binutils: binutils-2.23
@hongqn
hongqn / odd.go
Last active January 2, 2016 11:19
genOdd := func() chan int {
ch := make(chan int)
go func() {
i := 1
for {
ch <- i
i += 2
}
}()
return ch
memblaze800G-16k-128.fio: read : io=1431.2MB, bw=1369.6MB/s, iops=87650, runt= 1045msec
memblaze800G-16k-128.fio: write: io=154096KB, bw=147460KB/s, iops=9216, runt= 1045msec
memblaze800G-16k-144.fio: read : io=212464KB, bw=1242.5MB/s, iops=79514, runt= 167msec
memblaze800G-16k-144.fio: write: io=25136KB, bw=150515KB/s, iops=9407, runt= 167msec
memblaze800G-16k-16.fio: read : io=430726MB, bw=735103KB/s, iops=45943, runt=600002msec
memblaze800G-16k-16.fio: write: io=48089MB, bw=82072KB/s, iops=5129, runt=600002msec
memblaze800G-16k-32.fio: read : io=619934MB, bw=1033.3MB/s, iops=66126, runt=600002msec
memblaze800G-16k-32.fio: write: io=69334MB, bw=118330KB/s, iops=7395, runt=600002msec
memblaze800G-16k-64.fio: read : io=791242MB, bw=1318.8MB/s, iops=84398, runt=600002msec
memblaze800G-16k-64.fio: write: io=88578MB, bw=151173KB/s, iops=9448, runt=600002msec
wd400G-16k-128.fio: read : io=421681MB, bw=719661KB/s, iops=44978, runt=600006msec
wd400G-16k-128.fio: write: io=47604MB, bw=81243KB/s, iops=5077, runt=600006msec
wd400G-16k-144.fio: read : io=422265MB, bw=720659KB/s, iops=45041, runt=600005msec
wd400G-16k-144.fio: write: io=47876MB, bw=81708KB/s, iops=5106, runt=600005msec
wd400G-16k-16.fio: read : io=309162MB, bw=527635KB/s, iops=32977, runt=600002msec
wd400G-16k-16.fio: write: io=34574MB, bw=59007KB/s, iops=3687, runt=600002msec
wd400G-16k-32.fio: read : io=390990MB, bw=667286KB/s, iops=41705, runt=600004msec
wd400G-16k-32.fio: write: io=43801MB, bw=74753KB/s, iops=4672, runt=600004msec
wd400G-16k-64.fio: read : io=409735MB, bw=699277KB/s, iops=43704, runt=600004msec
wd400G-16k-64.fio: write: io=45938MB, bw=78400KB/s, iops=4900, runt=600004msec
proxyon() {
export http_proxy="http://127.0.0.1:8123"
export https_proxy="http://127.0.0.1:8123"
}
proxyoff() {
unset http_proxy
unset https_proxy
}
@hongqn
hongqn / lain.toml
Created March 4, 2015 06:07
comparison of YAML and TOML
appname = "hello"
[build]
base = "go"
script = [ "go build" ]
[test]
script = [ "go test" ]
[web]