Skip to content

Instantly share code, notes, and snippets.

View rogerz's full-sized avatar

Rogerz Zhang rogerz

View GitHub Profile
@rogerz
rogerz / gist:2988861
Created June 25, 2012 14:08
Chrome file upload HTTP request
POST / HTTP/1.1
Host: ec2-23-20-227-204.compute-1.amazonaws.com:3000
Connection: keep-alive
Content-Length: 871
Cache-Control: max-age=0
Origin: http://ec2-23-20-227-204.compute-1.amazonaws.com:3000
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/536.5 (KHTML, like Gecko) Chrome/19.0.1084.56 Safari/536.5
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryUzEOlJ3ebRFRAGwv
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Referer: http://ec2-23-20-227-204.compute-1.amazonaws.com:3000/
@rogerz
rogerz / TIM_Config.c
Created July 9, 2012 13:36
TIM_Config
void TIM_Config()
{
TIM_TimeBaseInitTypeDef TIM_TimeBaseStructure;
TIM_OCInitTypeDef TIM_OCInitStructure;
uint16_t PrescalerValue;
GPIO_InitTypeDef GPIO_InitStructure;
/* TIM3 clock enable */
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM3, ENABLE);
@rogerz
rogerz / .gdbinit
Created July 13, 2012 12:09
ART development scripts
#
# J-LINK GDB SERVER initialization
#
# This connects to a GDB Server listening
# for commands on localhost at tcp port 2331
target remote localhost:2331
# Set JTAG speed to 30 kHz
# monitor speed 30
# Set GDBServer to big endian
# monitor endian big
@rogerz
rogerz / cmake jansson
Created March 7, 2013 14:13
make check error on jansson with cmake
rogerz@blue:~/Workspace/jansson/build$ make check
[ 41%] Built target jansson
[ 45%] Built target json_process
[ 50%] Built target test_array
[ 54%] Built target test_copy
[ 58%] Built target test_dump
[ 62%] Built target test_dump_callback
[ 66%] Built target test_equal
[ 70%] Built target test_load
[ 75%] Built target test_loadb
C-x h (M-x mark-whole-buffer)
C-M-\ (M-x indent-region)
@rogerz
rogerz / module-wrapper.js
Last active December 30, 2015 07:49
wrap a script for CommonJS and AMD
/* https://github.com/yields/case/blob/master/dist/Case.js */
(function () {
var Case = {};
if (typeof define === 'function' && define.amd) {
define(function(){ return Case; });
} else if (typeof module !== 'undefined' && module.exports) {
module.exports = Case;
} else {
this.Case = Case;
}

syntax

command { [-setting]... "image"|-operation }... "output_image"

setting options

+ option is generally used to turn off the setting, or reset it to its normal default state

@rogerz
rogerz / gist:9577726
Last active August 29, 2015 13:57
run node app under 80 without root
sudo apt-get install libcap2-bin
sudo setcap cap_net_bind_service=+ep /usr/local/bin/node
# https://www.digitalocean.com/community/articles/how-to-use-pm2-to-setup-a-node-js-production-environment-on-an-ubuntu-vps
@rogerz
rogerz / deploy.sh
Created March 16, 2014 03:36
rsync command for deploying
rsync ./ ec2:~/wechat-demo --exclude '.git*' --compress --links --copy-unsafe-links --perms --recursive --times --delete --delete-excluded --progress
@rogerz
rogerz / nginx.conf
Created May 23, 2014 03:28
nginx config for websocket
# include a variable for the upgrade header
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
listen 80;
server_name example.com;