Skip to content

Instantly share code, notes, and snippets.

View feuvan's full-sized avatar

Chen, Xiaoqiang feuvan

  • Hangzhou, Zhejiang
View GitHub Profile
@feuvan
feuvan / gist:5589882
Created May 16, 2013 06:55
Compile VIM 7.3 for CentOS5.x or other legacy Linux distro for Python2.7 w/o root access
# for all patches up to date, or download tgz from vim.org
hg clone https://vim.googlecode.com/hg/ vim
cd vim
# override vi_cv_path_python with your preferred python 2.x location
./configure --disable-selinux --enable-gui=no --enable-pythoninterp --enable-perlinterp --enable-rubyinterp --enable-multibyte --prefix=$HOME vi_cv_path_python=/usr/local/bin/python2.7
make -j 20
make install
@feuvan
feuvan / patch for output_ismv.c
Created February 4, 2013 05:10
mp4split-2.2.0 OSX build support
#if defined(WIN32)
#elif defined(__MACH__)
static inline unsigned short bswap_16(unsigned short x) {
return (x>>8) | (x<<8);
}
static inline unsigned int bswap_32(unsigned int x) {
return (bswap_16(x&0xffff)<<16) | (bswap_16(x>>16));
}
@feuvan
feuvan / gist:1410113
Created November 30, 2011 18:17
Parse bilibili.tv video page and return acg.tv short url, vid.
<?php
$url = $_GET["url"];
$vid = 0;
$acgtv = "";
if (preg_match("/http:\/\/www.bilibili.tv\/video\/(av\\d+)/", $url, $matches)) {
$acgtv = $matches[1];
$response = file_get_contents($url);
preg_match("/vid=(\\d+)/", $response, $matches);
$vid = $matches[1];
}
@feuvan
feuvan / transcode.php
Created November 30, 2011 16:43
Grab (implicitly assume recent as x264/aac) iask share video and convert it to mp4.
<?php
define('FFMPEG', '/usr/bin/ffmpeg');
define('WGET', '/usr/bin/wget');
set_time_limit(3600); /* we are working with small chunks of files */
ignore_user_abort(true); /* do not terminate script execution if disconnect */
@ini_set("output_buffering", 0);
@ini_set('implicit_flush', 1);
header("Connection: close");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
@feuvan
feuvan / LocalRun.cpp
Created February 16, 2011 01:54
LocalRun: Run application in specified locale (chs as hard-coded).
/**
* Local(e)Run: Run application in specified locale (chs as hard-coded).
*
* Originial purpose: run fterm.exe in non-Chinese(PRC) locale.
*
* Author: feuvan@feuvan.net
*/
#include <stdio.h>
#include <tchar.h>
@feuvan
feuvan / datapipe6.c
Created January 16, 2011 12:03
Datapipe6 - ipv6-aware fork of datapipe.c
/*
* Datapipe6 - ipv6-aware fork of datapipe.c
* Sample usage:
* datapipe6 localipv4addr 23 remoteipv6addr 23
*
*
* Written by feuvan <feuvan@feuvan.net>
* Original ipv4 version by Jeff Lawson <jlawson@bovine.net>
* See statement below
*