完整基因定义文件(拟放置于 skills/gene/RCH11-featured-page-deepen.md):
---
id: RCH11-featured-page-deepen
group: RCH
wu: 90
diff_limit: 全页重写(历史阶段重组例外)| if | |
| timeout 5s sleep 2; | |
| then | |
| echo 'OK'; | |
| else | |
| echo 'Not OK'; | |
| fi | |
| if | |
| timeout 5s sleep 10; |
| from functools import wraps | |
| import errno | |
| import os | |
| import signal | |
| import time | |
| # timeout any function in given seconds | |
| # solution from http://stackoverflow.com/questions/2281850/timeout-function-if-it-takes-too-long-to-finish | |
| class TimeoutError(Exception): |
| # Disable crontab -r | |
| function crontab () | |
| { | |
| # Replace -r with -e | |
| /usr/bin/crontab "${@/-r/-e}" | |
| } |
| (lambda _, __, ___, ____, _____, ______, _______, ________: | |
| getattr( | |
| __import__(True.__class__.__name__[_] + [].__class__.__name__[__]), | |
| ().__class__.__eq__.__class__.__name__[:__] + | |
| ().__iter__().__class__.__name__[_____:________] | |
| )( | |
| _, (lambda _, __, ___: _(_, __, ___))( | |
| lambda _, __, ___: | |
| chr(___ % __) + _(_, __, ___ // __) if ___ else | |
| (lambda: _).func_code.co_lnotab, |
| print "run a from", __file__ |
| from apiclient.discovery import build | |
| from apiclient.errors import HttpError | |
| from oauth2client.tools import argparser | |
| # Get API key https://cloud.google.com/console | |
| DEVELOPER_KEY = "REPLACE ME" | |
| YOUTUBE_API_SERVICE_NAME = "youtube" | |
| YOUTUBE_API_VERSION = "v3" |
| # Cloudflare | |
| set_real_ip_from 199.27.128.0/21; | |
| set_real_ip_from 173.245.48.0/20; | |
| set_real_ip_from 103.21.244.0/22; | |
| set_real_ip_from 103.22.200.0/22; | |
| set_real_ip_from 103.31.4.0/22; | |
| set_real_ip_from 141.101.64.0/18; | |
| set_real_ip_from 108.162.192.0/18; | |
| set_real_ip_from 190.93.240.0/20; | |
| set_real_ip_from 188.114.96.0/20; |
| import begin | |
| @begin.subcommand | |
| def add(): | |
| print "add" | |
| @begin.subcommand | |
| def dele(): | |
| print "dele" | |
| import timeit | |
| import random | |
| import string | |
| data = ''.join([random.choice(string.ascii_letters) for x in range(1024*1024)]) | |
| print "md5", | |
| print timeit.timeit('hashlib.md5().update(data)', number=10000, setup='import hashlib; data="%s"' % data) | |
| print "sha1", | |
| print timeit.timeit('hashlib.sha1().update(data)', number=10000, setup='import hashlib; data="%s"' % data) |