This file contains hidden or 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
__all__ = ['EntityModel'] | |
class EntityModel(object): | |
"""The base class of entity models. | |
All entity models are comparable and hashable. There are some meta | |
attributes: | |
- ``id_attr_name`` |
This file contains hidden or 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 sh | |
if [ -z $1 ]; then | |
echo "usage: $0 FILENAME.png" > /dev/stderr | |
exit 1 | |
fi | |
adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > $1 |
This file contains hidden or 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 | |
""" | |
The MIT License (MIT) | |
Copyright (c) 2019 Jiangge Zhang | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights | |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
This file contains hidden or 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 sh | |
exec env $(cat .env 2>/dev/null | xargs) $@ |
This file contains hidden or 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
gulp = require 'gulp' | |
uglify = require 'gulp-uglify' | |
sourcemaps = require 'gulp-sourcemaps' | |
stylus = require 'gulp-stylus' | |
rename = require 'gulp-rename' | |
source = require 'vinyl-source-stream' | |
buffer = require 'vinyl-buffer' | |
browserify = require 'browserify' | |
del = require 'del' | |
pkginfo = require './package.json' |
This file contains hidden or 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
try: | |
from StringIO import StringIO as BytesIO | |
except ImportError: | |
from io import BytesIO | |
import matplotlib.pyplot as plt | |
def render_latex(formula, fontsize=12, dpi=300, format_='svg'): | |
"""Renders LaTeX formula into image.""" |
This file contains hidden or 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
server { | |
listen 80; | |
server_name blog.tonyseek.com; | |
root /srv/blog.tonyseek.com/; | |
# digg has a broken https support while sni extension has been enabled. | |
if ($http_user_agent !~ Digg ) { | |
rewrite ^ https://$server_name$request_uri? permanent; # enforce to use https | |
} |
This file contains hidden or 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
import random | |
from wheezy.captcha.image import captcha | |
from wheezy.captcha.image import background | |
from wheezy.captcha.image import curve | |
from wheezy.captcha.image import noise | |
from wheezy.captcha.image import smooth | |
from wheezy.captcha.image import text | |
from wheezy.captcha.image import offset | |
from wheezy.captcha.image import rotate |
This file contains hidden or 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
from operator import itemgetter | |
class Step(tuple): | |
location = property(itemgetter(0)) | |
milestone = property(itemgetter(1)) | |
step = Step(['nowhere', 'nothing']) | |
assert step.location == 'nowhere' |
This file contains hidden or 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
from .weixin_compat import fixup_weixin_oauth | |
oauth = OAuth() | |
weixin = oauth.remote_app( | |
'weixin', | |
app_key='WEIXIN', | |
request_token_params={'scope': 'snsapi_base'}, | |
base_url='https://api.weixin.qq.com', | |
authorize_url='https://open.weixin.qq.com/connect/oauth2/authorize', | |
access_token_url='https://api.weixin.qq.com/sns/oauth2/access_token', |