Skip to content

Instantly share code, notes, and snippets.

View upbit's full-sized avatar

Zhou Hao upbit

  • China
View GitHub Profile
@upbit
upbit / interval_test.py
Created July 21, 2015 14:23
merge/sub intervals list
# -*- coding:utf-8 -*- #
def merge(lists):
sorted_list = sorted(lists)
result = []
(tmp_start, tmp_end) = sorted_list[0]
for (start, end) in sorted_list:
if tmp_end >= start:
tmp_end = max(tmp_end, end)
else:
@upbit
upbit / cassandra_dump.py
Created July 15, 2015 09:07
dump big cassandra table
# -*- coding:utf-8 -*- #
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
import codecs
try:
import cassandra
@upbit
upbit / cmd.erl
Created June 18, 2015 10:59
erlang cmd.erl
-module(cmd).
%% https://kisao.wordpress.com/2013/12/16/how-to-run-a-system-command-in-erlang/
-export([run/1, run/2, test/0]).
run(Cmd) ->
run(Cmd, 5000).
run(Cmd, Timeout) ->
Port = erlang:open_port({spawn, Cmd},[exit_status]),
@upbit
upbit / SLNovel2Txt.md
Created March 30, 2015 15:56
转换空之文库(轻国阅读Android)sln文档格式为txt

SLNovel2Txt

转换空之文库(轻国阅读Android)sln文档格式为txt Script to convert Sora.SLNovel to txt

  • 使用方法
  1. 安装Python并下载 slnovel_to_txt.py 到任意文件夹中
@upbit
upbit / lldb_debug.sh
Created March 30, 2015 15:24
lldb远程调试
on iOS:
/Developer/usr/bin/debugserver *:1234 -a "RankingLog"
on Mac:
lldb
(lldb) platform select remote-ios
(lldb) process connect connect://192.168.1.100:1234
【lldb命令】
@upbit
upbit / HowTo.md
Last active October 8, 2018 10:49
XCode codesign on jailbreak devices

修改XCode配置文件

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/

SDKSettings.plist

> CODE_SIGNING_REQUIRED: NO
> ENTITLEMENTS_REQUIRED: NO
@upbit
upbit / .gitconfig
Created March 18, 2015 15:26
GitHub config for China
[url "git@github.com:"]
# Always use GitHub SSH protocol to push.
# Allows use of git:// for public repositories with push access
#pushInsteadOf = git://github.com/
pushInsteadOf = https://github.com/
[url "https://github.com/"]
# Use HTTP for GitHub instead of git:// or git@
# Enable this in networks where git:// or git@ are blocked.
#insteadOf = git://github.com/
#insteadOf = git@github.com:
@upbit
upbit / itnl_idev.sh
Last active August 29, 2015 14:16
expect and connect with itnl 2022 port
#/bin/bash
killall itnl 2>&1 > /dev/null
itnl --tunnel &
expect -c "
set timeout 30
spawn ssh -p2022 root@127.0.0.1
expect {
\"*yes/no*\" {send \"yes\r\"; exp_continue}
GET /?qt=cen&b=12376380.95%2C3574010.31%3B12376380.95%2C3574010.31&l=12&ie=utf-8&oue=1&res=api&callback=BMap._rd._cbk50813 HTTP/1.1
Host: api.map.baidu.com
Connection: keep-alive
Accept: */*
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.111 Safari/537.36
Referer: http://api.map.baidu.com/lbsapi/getpoint/index.html
Accept-Encoding: gzip, deflate, sdch
Accept-Language: zh-CN,zh;q=0.8,en;q=0.6
Cookie: BAIDUPSID=B43CC9CA4D0E53EA8F712095BDAE5BB3; BDUSS=zl6MHBXYlZEZFRwSGlkallzeExVbENGQi1PcXFxbXdhNW05Yng2a01IcTlFLU5VQVFBQUFBJCQAAAAAAAAAAAEAAACK0zQHdXBiaXQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAL2Gu1S9hrtUV; BAIDUID=DE16C72A2F375E80190C332AC83BF0E0:SL=0:NR=10:FG=1; cflag=65279%3A2
@upbit
upbit / Makefile
Created November 21, 2014 03:03
Makefile for libCocoaHTTPServer.a
######################################
# Common Static library Makefile
######################################
TARGET := libCocoaHTTPServer.a
SRC_DIR := Core Core/Categories Core/Mime Core/Responses Extensions/WebDAV \
Vendor/CocoaAsyncSocket Vendor/CocoaLumberjack Vendor/CocoaLumberjack/Extensions
HEADER_DIR := include/
# > make clean && make && make headers