Skip to content

Instantly share code, notes, and snippets.

View wynemo's full-sized avatar
🤣
快落的时光总那么少

Nemo.Zhang wynemo

🤣
快落的时光总那么少
View GitHub Profile
twitter.com
facebook.com
youtube.com
youtu.be
ggpht.com
gstatic.com
googlesyndication.com
googlevideo.com
ytimg.com
google.com
#coding:utf-8
import json
import sys
json_file_name = sys.argv[1]#'C:/Users/zdb/Downloads/shared-items-jas.json',
f1 = open(json_file_name,'r')
o1 = json.load(f1,'utf-8')
i = 1
dir1 = u'd:/'
for item in o1['items']:
name = u''
@wynemo
wynemo / setup_mosh_centos.sh
Last active September 28, 2015 03:16 — forked from tancnle/setup_mosh_centos.sh
Setup mosh on Centos 6.x
#!/bin/sh
# Update latest epel
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
sudo rpm -Uvh epel-release-6-8.noarch.rpm
yum --enablerepo=epel install mosh
@wynemo
wynemo / gist:4e26f5e151d068aa76f1
Created September 28, 2015 08:19
push creates new remote head on branch
push creates new remote head on branch
from time to time, `hg push` throws this message
I'm pretty sure that no code needs to be merged.
`hg push -b yourbranch` solve this
and I don't care why.
@wynemo
wynemo / .vimrc
Created January 20, 2012 09:07
my vim rc
set sw=4 ts=4 sta et sts=4 ai
set nu
set guifont=Inconsolata\ Medium\ 12
syntax on
colorscheme slate
nmap <F8> :TagbarToggle<CR>
@wynemo
wynemo / ping_ip_rang.sh
Created January 20, 2012 09:26
ping ip range
#!/bin/bash
checkalive (){
NODE=$1
ping -c 3 $NODE>/dev/null 2>&1
if [ $? -eq 0 ]
then
echo "$NODE is alive"
else
echo "$NODE is not alive"
fi
@wynemo
wynemo / mk_dict.py
Created January 21, 2012 05:39
grasp word definition from google
#!/usr/bin/env python
#coding:utf-8
import re
import sys
import urllib2
std_headers = {
'User-Agent': 'Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.12) Gecko/20101028 Firefox/3.6.12',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Language': 'en-us,en;q=0.5',
@wynemo
wynemo / myfind.py
Created February 20, 2012 14:42
find text in file
#!/usr/bin/env python
#coding:utf-8
#use example:
# find|python /tmp/myfind.py sth
# on cygwin
# find|python "C:\Users\user1\findtext\myfind.py" sth
import re
@wynemo
wynemo / urllib2_auth.py
Created March 21, 2012 17:03
urllib2 basic auth
# quoted from http://www.wkoorts.com/wkblog/2008/10/27/python-proxy-client-connections-requiring-authentication-using-urllib2-proxyhandler/
# urllib2_proxy_handler.py
#
# Author: Wayne Koorts
# Date: 27/10/2008
#
# Example for using urllib2.urlopen() with a proxy server requiring authentication
import urllib2
@wynemo
wynemo / check_utf8.py
Created March 23, 2012 04:32
check file containing chinese,but not in utf-8 format
#coding:utf-8
suffix_list = ['.cpp','.c','.h','.hpp','.txt','.html','.htm','.xml','.py']
def FoundInvalidFile(input_folder):#str,list
def calc_bom(str1):
rt = ''
for i in range(0,3):
rt += '%02X'%(ord(str1[i]))
return rt