git diff HEAD other_branch -- file_name | git apply
git show commit
git add -u
git config --global diff.tool vimdiff | |
git config --global difftool.prompt false | |
git config --global alias.d difftool |
yum install gcc gcc-c++ kernel-devel make | |
yum groupinstall "Development Tools" | |
# centos 6 | |
# yum install epel-release | |
yum install bash-completion | |
yum whatprovides libstdc++.so.6 | |
yum install libstdc++-4.4.7-3.el6.i686 |
# search | |
rpm -qa | grep xxx | |
# install | |
rpm -i xxx | |
# remove | |
rpm -e xxx | |
# remove and ignore dependences |
import threading | |
from functools import wraps | |
global_singleton_lock = threading.Lock() | |
def singleton(cls): | |
instances = {} | |
@wraps(cls) | |
def getinstance(*args, **kw): | |
global global_singleton_lock |
import threading | |
import time | |
class ThreadLock(object): | |
def __init__(self): | |
self.namedlock = {} | |
self.lock = threading.Lock() | |
def __call__(self, name): | |
print 'name', name |
//lockfile.c | |
#include <stdio.h> | |
#include <unistd.h> | |
#include <sys/types.h> | |
#include <sys/stat.h> | |
#include <fcntl.h> | |
#include <errno.h> | |
int main() |
import binascii | |
import M2Crypto | |
import base64 | |
''' | |
<RSAKeyValue> | |
<Modulus>xF9y25EXh8n99sXtU/JAsYTwML6PB7gSCE8tWw8Www2KBfDqohQBL8FMs8jzsDQa7WwoEmiVJ1resEC9YXJGbwQyWgb9qgooC9oSnCB/TkRdBybwby0DKuZOzq+609OBGkwWpgnS4QVCBc6eW+10l3qE3/2hKdcSV+08iRYp7zs=</Modulus> | |
<Exponent>AQAB</Exponent> | |
</RSAKeyValue> | |
''' |
for i in range(100001): | |
s = ((i/5000)*'#')+str(i)+(' %') | |
print ('\r'+s), |