Skip to content

Instantly share code, notes, and snippets.

@liuwanwei
liuwanwei / alias.rc
Created June 22, 2017 01:57
bash or zsh alias definition
# for ssh
alias sshj='ssh root@120.25.104.45'
alias sshw='ssh root@121.41.26.86'
alias sshr='ssh msbox@tv.haly12333.org.cn'
# for git
alias pull='git pull origin master'
alias push='git push origin master'
alias gst='git status'
@liuwanwei
liuwanwei / test_memcached.php
Created October 24, 2015 07:44
PHP memcached 环境配置好之后的测试代码
<?php
$mem = new Memcached();
$mem->addServer('127.0.0.1', 11211);
$key = 'time';
$date=date('Y-m-d H-i-s');
var_dump($mem->get($key));
@liuwanwei
liuwanwei / gist:caaf95fd7acf6172b49f
Last active August 29, 2015 14:19
[ Python ] Modify class attribute from class instance will create new instance variable, not affect class attribute
#!/bin/bash/env python
class MyObj:
class_var = 1
if __name__ == '__main__':
a = MyObj()
print(a.class_var) # 1
#import <Foundation/Foundation.h>
@interface NSDictionary (QueryStringBuilder)
- (NSString *)queryString;
@end
@liuwanwei
liuwanwei / a.h
Created June 5, 2013 07:40
在做elance的C语言测试题过程中,写了一些测试代码,对不懂的语言特性进行验证,收获良多。
int b[] = {1,2,3,4,5};
@liuwanwei
liuwanwei / lrt.py
Created December 4, 2012 13:10
download video snippets from cntv.cn, expecially for <Xiao Xiao Zhi Hui Shu>.
#encoding=utf8
import json
import os
import re
import sys
from urllib import request
from datetime import datetime
debug=1