Skip to content

Instantly share code, notes, and snippets.

View hiccupzhu's full-sized avatar

HiccupZhu hiccupzhu

View GitHub Profile
#!/usr/bin/env python
#coding=utf-8
import os
import sys
import getopt
import re
import subprocess
import time
import socket
@hiccupzhu
hiccupzhu / matplot.py
Created June 6, 2013 08:40
load config-file draw graphs.
import matplotlib
import matplotlib.pyplot as plt
Y = []
matplotlib.rcParams["savefig.dpi"]=80;
print matplotlib.rcParams["savefig.dpi"]
file = open("./statistic.txt", "r");
lines = file.readlines();
@hiccupzhu
hiccupzhu / cvtest.c
Last active December 18, 2015 00:19
opencv call sample
/*
* cvtest.c
*
* Created on: Mar 26, 2013
* Author: szhu
Makefile:
CFLAGS=-g
CFLAGS+=$(shell pkg-config --cflags opencv)
LDFLAGS= $(shell pkg-config --libs opencv)
CC=gcc
@hiccupzhu
hiccupzhu / WebSpider
Created June 2, 2013 15:11
Web Spider
#!/usr/bin/python
import re
import urllib2
nb_addr = 0;
addrs = set();
def get_tag_a(data):
# pattern = re.compile('''http://[\w:/\.&%=?-]+''')
@hiccupzhu
hiccupzhu / shtool
Created May 31, 2013 09:28
parse some confs with shell script.
#!/bin/bash
usage()
{
echo "Release time:xxxx-xx-xx"
echo " -v|--version : version"
echo " -h|--help : help"
echo " --add : add a channel"
echo " --list : list all channels"
echo " --name : channel name"
@hiccupzhu
hiccupzhu / pytool
Created May 31, 2013 09:26
parse some confs with python script.
#!/usr/bin/python
import os
import sys
import getopt
import re
channels = dict();
workmode=""
chname=""
@hiccupzhu
hiccupzhu / m3u8maker.py
Last active December 16, 2015 18:09
简单的m3u8切片程序,python实现
input_name = "jiangsugaoqing";
m3u8str = '''#EXTM3U
#EXT-X-VERSION:3
#EXT-X-TARGETDURATION:128
#EXT-X-MEDIA-SEQUENCE:10000
''';
if __name__ == "__main__":
if(len(sys.argv) == 1):
@hiccupzhu
hiccupzhu / GStreamer sample
Created November 15, 2012 09:20
Using GStreamer gst_parse_bin_from_description
#include <gst/gst.h>
static const char* demux_cmd = "filesrc location=/mnt/hgfs/E/media/source/IceAgeTrailer.mpg ! mpegpsdemux";
#define DISABLE_MUX 1
#if DISABLE_MUX
static const char* enc_video_cmd = "queue ! ffdec_mpeg2video ! ffmpegcolorspace ! queue ! xvimagesink";
static const char* enc_audio_cmd = "queue ! mad ! queue ! audioconvert ! alsasink";
#else