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 / 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
@rogerz
rogerz / .gitconfig
Last active July 3, 2018 10:25
git
[alias]
la = log --graph --oneline --decorate --all
lg = log --graph --oneline --decorate --all
@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;
}
C-x h (M-x mark-whole-buffer)
C-M-\ (M-x indent-region)
@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 / 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 / gist:2988838
Created June 25, 2012 14:04
IE file upload HTTP request
POST / HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Referer: http://ec2-23-20-227-204.compute-1.amazonaws.com:3000/
Accept-Language: zh-CN
User-Agent: Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)
Content-Type: multipart/form-data; boundary=---------------------------7dcf3a405aa
Accept-Encoding: gzip, deflate
Host: ec2-23-20-227-204.compute-1.amazonaws.com:3000
Content-Length: 18271
Connection: Keep-Alive
@rogerz
rogerz / jquery.validator.demo.js
Created June 17, 2012 09:22
jquery validator example
$(function() {
$.validator.addMethod("list", function(value, element, param) {
var isValid = false;
var list = $.parseJSON(param);
$.each(list, function() {
if (value == this) {
isValid = true;
return false;
};
})
@rogerz
rogerz / run_scanner.c
Created March 8, 2012 11:56
yaml scanner
#include <yaml.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef NDEBUG
#undef NDEBUG
#endif
#include <assert.h>