Skip to content

Instantly share code, notes, and snippets.

View xingkaixin's full-sized avatar
😅

Kevin xingkaixin

😅
View GitHub Profile
@xingkaixin
xingkaixin / doss.sh
Created January 30, 2022 06:43 — forked from lexrus/doss.sh
A tiny script to initialize a new Shadowsocks server in DigitalOcean.
#!/bin/bash
#
# This macOS bash script helps you initialize a new Shadowsocks server with doctl in seconds.
# Original author: lexrus https://github.com/lexrus
#
# You can get $100 free credit for create VPS in DigitalOcean with my referral link:
# https://m.do.co/c/3eb5cf371fc9
#
# Please intall and authorize doctl before running this script.
# https://github.com/digitalocean/doctl
@xingkaixin
xingkaixin / browser-detection.js
Last active September 14, 2015 05:43 — forked from tjefferson/browser-detection.js
get more precise Chinese browser information in google analytics
<script>
var browserName = "Other";
var ua = window.navigator.userAgent;
browserRegExp = {
Sogou : /SE\s2\.X|SogouMobileBrowser/,
Explorer2345 : /2345Explorer|2345chrome|Mb2345Browser/,
Liebao : /LBBROWSER/,
QQBrowser : /QQBrowser/,
Baidu : /BIDUBrowser|baidubrowser|BaiduHD/,
UC : /UBrowser|UCBrowser|UCWEB/,
@xingkaixin
xingkaixin / tdqmdemo.py
Created September 15, 2014 14:46
tdqmdemo.py
import time
from tqdm import *
aa = []
for x in range(1000):
aa.append("a" + str(x))
@xingkaixin
xingkaixin / result
Last active August 29, 2015 14:06
RPC Simple Python
Server:
127.0.0.1 - - [14/Sep/2014 00:30:57] "POST /RPC2 HTTP/1.1" 200 -
Client:
result: -60
result type: <type 'int'>
@xingkaixin
xingkaixin / getBlogUrlList
Last active August 29, 2015 14:06
how to scrapy xingkaixin.me
明晚我们盼点什么 http://XingKaiXin.me/2014/09/08/apple-event-2014-sep/
蹦极超级爽,下次我要跳伞啦! http://XingKaiXin.me/2014/09/07/bungy-is-cool/
Python小工具之CSV转为Excel http://XingKaiXin.me/2014/09/06/python-csv-conversion-excel/
LNMP install on Ubuntu http://XingKaiXin.me/2014/09/04/lnmp-install-on-ubuntu/
本站迁入DigitalOcean,顺便做个小结 http://XingKaiXin.me/2014/09/01/moveto-digitalocean/
APP推荐:WATCH OUT! http://XingKaiXin.me/2014/08/31/app-watch-out/
罗质翔,赢家是苹果 http://XingKaiXin.me/2014/08/27/laoluovsziru/
日剧推荐:圣女还是恶女 http://XingKaiXin.me/2014/08/24/recommend-seijo/
APP推荐:优秀的稍后读Pocket http://XingKaiXin.me/2014/08/20/recommend-an-app-pocket/
APP推荐:Smash the Code http://XingKaiXin.me/2014/08/19/recommend-an-app-smash-the-code/
@xingkaixin
xingkaixin / pylogging.py
Created September 13, 2014 06:45
Python logging sample
import logging
import sys
logger = logging.getLogger("endlesscode")
formatter = logging.Formatter('%(name)-12s %(asctime)s %(levelname)-8s %(message)s', '%Y %m %d %H:%M:%S',)
file_handler = logging.FileHandler("test.log")
file_handler.setFormatter(formatter)
stream_handler = logging.StreamHandler(sys.stderr)
logger.addHandler(file_handler)
logger.addHandler(stream_handler)
#logger.setLevel(logging.ERROR)
@xingkaixin
xingkaixin / excel.py
Created September 12, 2014 15:15
fill excel with format sample
#!/usr/bin/python
# -*- coding: utf-8 -*-
import xlwt;
import xlrd;
#import xlutils;
from xlutils.copy import copy;
# styleBoldRed = xlwt.easyxf('font: color-index red, bold on');
# headerStyle = styleBoldRed;
# wb = xlwt.Workbook();
@xingkaixin
xingkaixin / pysftp.py
Last active December 17, 2020 12:22
Python pexpect sftp sample
#!/usr/bin/python
# -*- coding: utf-8 -*-
from pexpect import *
#import pexpect
import sys
import os
def initFile(*filenames):
@xingkaixin
xingkaixin / parse.py
Created September 6, 2014 06:30
Chinese words segementation uitlities
# -*- coding:utf-8 -*-
import jieba
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
def trim(mystr):
x=''
@xingkaixin
xingkaixin / csv2xls.py
Last active August 29, 2015 14:06
csv2xls sample
#!/usr/bin/python
# -*- coding: utf-8 -*-
import csv
import xlwt
import os
import sys
def cvstran2xls(filename):
with open(filename,'rb') as f: