Skip to content

Instantly share code, notes, and snippets.

View vls's full-sized avatar

Liang Zhaohao vls

View GitHub Profile
@vls
vls / build.sh
Created April 21, 2014 05:19
polarssl build script for iOS SDK 7.1 & polarssl 1.3.5
#!/bin/bash
# Automatic build script for polarssl
# for iPhoneOS and iPhoneSimulator
#
# Created by Felix Schulze on 08.04.11.
# Copyright 2010 Felix Schulze. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@vls
vls / slow.html
Created August 14, 2014 02:55
Javascript in Qt 5.3 Webkit QWebView too slow, and hang the MainWindows on Windows
<DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function do_load() {
var script = document.createElement('script');
script.src = "slow.js";
document.getElementsByTagName('head')[0].appendChild(script);
}
</script>
@vls
vls / gist:850505
Created March 2, 2011 04:56
simulate DOM building
javascript: (function n(e){e.eq(0).fadeIn(99,function(){n(e.slice(1))})})($(":visible").hide())
@vls
vls / timeit.py
Created July 15, 2011 01:13
python time test decorator function
import time, functools
def timeit(func):
@functools.wraps(func)
def __do__(*args,**kwargs):
start = time.time()
result= func(*args,**kwargs)
print '%s used time %ss'%(func.__name__,time.time()-start)
return result
return __do__
@vls
vls / comm.sh
Created July 16, 2011 02:32
some common utility functions
function log()
{
local msg=$1
now=`date "+%Y-%m-%d %H:%M:%S"`
i=${#FUNCNAME[@]}
lineno=${BASH_LINENO[$i-2]}
file=${BASH_SOURCE[$i-1]}
echo "${now} ${file}:${lineno} ${msg}"
@vls
vls / gist:1236794
Created September 23, 2011 05:20
get the comment of the last commit in svn
#get the comment of the last commit in svn
svn log -q -v --xml --with-all-revprops -r head | grep "^<msg" | sed -e "s/<msg>\(.*\)/\1/g"
@vls
vls / gist:1271927
Created October 8, 2011 06:06
checkout from git. The destination directory will NOT be under source control
git archive --format=tar HEAD | (cd ~/beta/web && tar xf -)
git archive --format=tar HEAD | ssh app08.gz "(cd ~/beta/qn_fd_system && tar xf -)"
@vls
vls / make_data.py
Created December 20, 2011 08:11
make test dataset
#!/usr/bin/env python
import os
begin = 1
end = 3000000
inc = 3000000
for j in xrange(3):
with open('%s.txt' % (j + 1), 'w') as wf:
for i in xrange(begin, end + 1):
@vls
vls / export_plain.py
Created February 21, 2012 03:23
test script for re2 and re2
#!/usr/bin/env python
#encoding=utf-8
import time
import os, sys
import re
import pickle
import re2
re2.set_fallback_notification(re2.FALLBACK_WARNING)
@vls
vls / c_re2_plain.c
Created February 21, 2012 03:26
test program for re2
#include <re2/re2.h>
#include <iostream>
#include <string>
#include <cassert>
#include <stdio.h>
#include <vector>
#include <cstdlib>
#include <time.h>
#include <unistd.h>