Skip to content

Instantly share code, notes, and snippets.

Avatar
:shipit:
Focusing

上山打老虎 zqqf16

:shipit:
Focusing
View GitHub Profile
@zqqf16
zqqf16 / gen_manifest.py
Created Mar 16, 2014
根据ipa包来生成Manifest的工具
View gen_manifest.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
import sys
import shutil
import zipfile
import biplist
PLIST_STR = '''<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
@zqqf16
zqqf16 / jijin.py
Last active Aug 29, 2015
抓取基金收益信息
View jijin.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import requests
import unicodedata
import re
from datetime import datetime
View update_xcode_plugins
#!/bin/sh
PLIST_BUDDY=/usr/libexec/PlistBuddy
function add_compatibility() {
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \
"$1/Contents/Info.plist"
}
function has_compatibility() {
View json_orm.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
from datetime import datetime
FILE_NAME = 'messages.json'
class DataBase(object):
@zqqf16
zqqf16 / simple_regexp.c
Created Jun 6, 2013
一个简单的正则表达式匹配器,摘自《代码之美》第一章
View simple_regexp.c
int match(char *regexp, char *text)
{
if (regexp[0] == '^')
return matchhere(regexp+1, text);
do {
if (matchhere(regexp, text))
return 1;
} while (*text++ != '\0');
@zqqf16
zqqf16 / http.py
Last active Dec 20, 2015
A simple http server based on "SimpleHttpServer". Supports uploading files.
View http.py
"""Simple HTTP Server.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
Support upload files
"""
@zqqf16
zqqf16 / levenshtein.py
Last active Dec 20, 2015
Implement the Levenshtein-distance algorithm.
View levenshtein.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''Implement the Levenshtein-distance Algorithm'''
def levenshtein(source, dest):
'''Return the levenshteiin distance between source and dest'''
row_len = len(source) + 1
col_len = len(dest) + 1
@zqqf16
zqqf16 / getfile.py
Created Oct 22, 2013
Get changed files from diff
View getfile.py
#!/usr/bin/env python
import re
import sys
import argparse
FILE_RE = re.compile(r'^Index: (.*)$')
def get_files_from_diff(diff):
res = []
@zqqf16
zqqf16 / colorit.py
Created Oct 25, 2013
Print color in terminal
View colorit.py
#!/usr/bin/env python
#-*- coding: utf-8 -*-
__all__ = ['paint']
COLOR_FORMAT = '\033[%dm\033[%d;%dm%s\033[0m'
COLOR_NAME = ['black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white']
ATTRIBUTE_NAME = ['blod', 'underscore', 'blink', 'reverse', 'concealed']
@zqqf16
zqqf16 / crawl.py
Last active Dec 28, 2015
获取天弘基金以及华夏基金最近5天收益信息
View crawl.py
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import re
import requests
class Spider(object):
def __init__(self, url, pattern, encoding):
self.url = url
self.pattern = pattern