This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import uuid | |
import time | |
import hashlib | |
import requests | |
YOUDAO_URL = 'https://openapi.youdao.com/api' | |
APP_KEY = '4eb54b2bc1173f2b' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int match(char *regexp, char *text) | |
{ | |
if (regexp[0] == '^') | |
return matchhere(regexp+1, text); | |
do { | |
if (matchhere(regexp, text)) | |
return 1; | |
} while (*text++ != '\0'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Simple HTTP Server. | |
This module builds on BaseHTTPServer by implementing the standard GET | |
and HEAD requests in a fairly straightforward manner. | |
Support upload files | |
""" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import re | |
import sys | |
import argparse | |
FILE_RE = re.compile(r'^Index: (.*)$') | |
def get_files_from_diff(diff): | |
res = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
class Meta(type): | |
def __new__(self, name, bases, attrs): | |
print('Meta: __new__: {} | {} | {} | {}'.format(self, name, bases, attrs)) | |
return super(Meta, self).__new__(self, name, bases, attrs) | |
def __init__(cls, name, bases, attrs): | |
print('Meta: __init__: {} | {} | {} | {}'.format(cls, name, bases, attrs)) | |
super(Meta, cls).__init__(name, bases, attrs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
ipa_name=$1 | |
plist_path=$(unzip -l "$ipa_name" | grep "Payload/[^/]*\/Info.plist" | sed 's/.*\(Payload.*Info.plist\)/\1/g') | |
#unzip | |
unzip -jo "$ipa_name" "$plist_path" >/dev/null | |
#convert to xml1 format | |
plutil -convert xml1 Info.plist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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"> |
OlderNewer