Skip to content

Instantly share code, notes, and snippets.

View sqbing's full-sized avatar

Rider Woo sqbing

  • Microsoft
  • Suzhou, Jiangsu, China
View GitHub Profile
@sqbing
sqbing / error_case.log
Created July 15, 2016 01:39
gevent_install_error_with_2.7.11_in_virtualenv
(gevent_test) /tmp ᐅ pip install -v gevent
Collecting gevent
1 location(s) to search for versions of gevent:
* http://pypi.douban.com/simple/gevent/
Getting page http://pypi.douban.com/simple/gevent/
Starting new HTTP connection (1): pypi.douban.com
"GET /simple/gevent/ HTTP/1.1" 301 178
Starting new HTTP connection (1): pypi.doubanio.com
"GET /simple/gevent/ HTTP/1.1" 200 20658
Analyzing links from page http://pypi.doubanio.com/simple/gevent/
@sqbing
sqbing / lldb.log
Created March 20, 2015 04:02
aquila_mfcc_crash_report
➜ aquila lldb a.out /tmp/20.wav
(lldb) target create "a.out"
Current executable set to 'a.out' (x86_64).
(lldb) settings set -- target.run-args "/tmp/20.wav"
(lldb) r
Process 24809 launched: '/Users/sqbing/Dev/Test/aquila/a.out' (x86_64)
Loaded file /tmp/20.wav (16b)
samples: 960000
sample frequency: 48000
Samples per frame: 1200
@sqbing
sqbing / ffprobe -show_packets
Created December 24, 2014 03:15
nginx rtmp module ts file info
[PACKET]
codec_type=audio
stream_index=1
pts=7751268264
pts_time=86125.202933
dts=7751268264
dts_time=86125.202933
duration=4179
duration_time=0.046433
convergence_duration=N/A
#!/bin/bash
###########################################################################
# Choose your ffmpeg version and your currently-installed iOS SDK version:
#
VERSION="2.0.2"
SDKVERSION="7.0"
ARCHS="armv7 armv7s i386"
#
#
@sqbing
sqbing / zmq_instance.cc
Created September 24, 2014 06:03
zmq example
#include <iostream>
#include <boost/program_options.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
#include <boost/any.hpp>
#include <inttypes.h>
#include <signal.h>
#ifdef __cplusplus
extern "C"{
#endif
@sqbing
sqbing / md5.c
Created September 24, 2014 05:59
md5 encoding example
#include <stdio.h>
#include <string.h>
#include <openssl/md5.h>
#define u_char unsigned char
int main(int argc, const char *argv[])
{
u_char hashb[64], hasht[128], *text = hasht;
MD5_CTX md5;
@sqbing
sqbing / crc32.c
Created September 24, 2014 05:56
crc32 example
#include <stdio.h>
#include <stdint.h>
static uint32_t crc32table[256] = {
0x00000000, 0x04c11db7, 0x09823b6e, 0x0d4326d9, 0x130476dc, 0x17c56b6b,
0x1a864db2, 0x1e475005, 0x2608edb8, 0x22c9f00f, 0x2f8ad6d6, 0x2b4bcb61,
0x350c9b64, 0x31cd86d3, 0x3c8ea00a, 0x384fbdbd, 0x4c11db70, 0x48d0c6c7,
0x4593e01e, 0x4152fda9, 0x5f15adac, 0x5bd4b01b, 0x569796c2, 0x52568b75,
0x6a1936c8, 0x6ed82b7f, 0x639b0da6, 0x675a1011, 0x791d4014, 0x7ddc5da3,
0x709f7b7a, 0x745e66cd, 0x9823b6e0, 0x9ce2ab57, 0x91a18d8e, 0x95609039,
@sqbing
sqbing / mediainfo.cc
Last active August 29, 2015 14:06
libmedia example
#define UNICODE
#include <iostream>
#include <string>
#include <MediaInfo/MediaInfo.h>
#include <MediaInfo/MediaInfo_Const.h>
// Taking effect only for ascii charactors
void string_to_wstring(std::string &str, std::wstring &wstr){
wstr = std::wstring(str.begin(), str.end());
}
@sqbing
sqbing / demuxing.c
Created September 24, 2014 05:42
demuxing media file
#include <libavutil/imgutils.h>
#include <libavutil/samplefmt.h>
#include <libavutil/timestamp.h>
#include <libavformat/avformat.h>
static AVFormatContext *fmt_ctx = NULL;
static AVCodecContext *video_dec_ctx = NULL, *audio_dec_ctx;
static AVStream *video_stream = NULL, *audio_stream = NULL;
static const char *src_filename = NULL;
- (void)doLogin{
// 发送登陆表单
NSURL *url = [NSURL URLWithString:@"http://www.v2ex.com/signin"];
loginRequest = [ASIFormDataRequest requestWithURL:url];
[loginRequest addPostValue:username forKey:@"u"];
[loginRequest addPostValue:password forKey:@"p"];
[loginRequest addPostValue:once forKey:@"once"];
[loginRequest addPostValue:@"/" forKey:@"next"];
[loginRequest setUserAgentString:@"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.116 Safari/537.36"];
[loginRequest setShouldRedirect:NO];