├── z42 ├── __init__.py ├── js │ ├── _WEB │ │ └── __init__.py │ ├── hack │ │ ├── placeholder.js │ │ └── ie8.js │ ├── __init__.py │ ├── foot.js │ ├── _lib │ │ ├── uploadify.swf │ │ ├── webcam │ │ │ └── webcam.swf │ │ ├── imgareaselect │ │ │ ├── Moxie.swf │ │ │ └── Moxie.xap │ │ ├── upload.js │ │ ├── trim.js │ │ └── jquery.zh_cn.js │ ├── _env.py │ ├── readme.rst │ └── init.js ├── static │ ├── x.txt │ ├── js │ │ ├── _WEB │ │ │ └── __init__.py │ │ ├── hack │ │ │ ├── placeholder.js │ │ │ └── ie8.js │ │ ├── __init__.py │ │ ├── foot.js │ │ ├── _lib │ │ │ ├── uploadify.swf │ │ │ ├── webcam │ │ │ │ └── webcam.swf │ │ │ ├── imgareaselect │ │ │ │ ├── Moxie.swf │ │ │ │ └── Moxie.xap │ │ │ ├── upload.js │ │ │ ├── trim.js │ │ │ └── jquery.zh_cn.js │ │ ├── _env.py │ │ ├── readme.rst │ │ └── init.js │ ├── html │ │ └── sort │ │ │ ├── test │ │ │ └── 2.json │ │ │ ├── js │ │ │ ├── plus.coffee │ │ │ ├── slide.coffee │ │ │ └── z42.js │ │ │ └── css │ │ │ ├── _img │ │ │ ├── at.jpg │ │ │ ├── bg.png │ │ │ ├── logo.png │ │ │ ├── LoginBg.png │ │ │ ├── img-bg.jpg │ │ │ ├── snsIcon.png │ │ │ ├── LoginText.png │ │ │ ├── icon-menu.png │ │ │ └── LoginFormIcon.png │ │ │ ├── layout.css │ │ │ ├── plus.css │ │ │ ├── tip_com.css │ │ │ ├── slidejs.css │ │ │ ├── lside.css │ │ │ └── tip_user.css │ ├── robots.txt │ ├── sina_verified_check.txt │ ├── css │ │ ├── __init__.py │ │ ├── _img │ │ │ ├── icon.png │ │ │ ├── pointer.png │ │ │ ├── shihui.png │ │ │ ├── icon-date.png │ │ │ ├── touziren.gif │ │ │ ├── warmuptk.png │ │ │ ├── icon-express.png │ │ │ ├── m │ │ │ │ └── root │ │ │ │ │ ├── arrow.png │ │ │ │ │ ├── cloud.png │ │ │ │ │ ├── item1.png │ │ │ │ │ ├── item2.png │ │ │ │ │ ├── item3.png │ │ │ │ │ ├── logo.png │ │ │ │ │ ├── mark.png │ │ │ │ │ ├── mark1.png │ │ │ │ │ ├── mark2.png │ │ │ │ │ ├── mark3.png │ │ │ │ │ ├── point.png │ │ │ │ │ ├── mark21.png │ │ │ │ │ ├── mark31.png │ │ │ │ │ ├── mingpian.png │ │ │ │ │ ├── touxiang.png │ │ │ │ │ └── triangle.png │ │ │ └── root │ │ │ │ ├── slideup.png │ │ │ │ ├── txt-mark.png │ │ │ │ ├── platform-banner.png │ │ │ │ └── slideup-light.png │ │ ├── _lib │ │ │ ├── simditor │ │ │ │ ├── images │ │ │ │ │ ├── fork.png │ │ │ │ │ ├── logo.png │ │ │ │ │ ├── image.png │ │ │ │ │ ├── title.png │ │ │ │ │ ├── logo@2x.png │ │ │ │ │ ├── title@2x.png │ │ │ │ │ └── loading-upload.gif │ │ │ │ ├── merge.sh │ │ │ │ └── simditor-emoji.css │ │ │ ├── jquery-ui │ │ │ │ └── images │ │ │ │ │ ├── animated-overlay.gif │ │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ │ ├── ui-icons_228ef1_256x240.png │ │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ │ ├── ui-icons_469bdd_256x240.png │ │ │ │ │ ├── ui-icons_cd0a0a_256x240.png │ │ │ │ │ ├── ui-icons_d8e7f3_256x240.png │ │ │ │ │ ├── ui-icons_ef8c08_256x240.png │ │ │ │ │ ├── ui-icons_ffd27a_256x240.png │ │ │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ │ ├── ui-bg_flat_100_202079_40x100.png │ │ │ │ │ ├── ui-bg_flat_100_ffffff_40x100.png │ │ │ │ │ ├── ui-bg_flat_10_000000_40x100.png │ │ │ │ │ ├── ui-bg_flat_55_F26522_40x100.png │ │ │ │ │ ├── ui-bg_flat_55_fbec88_40x100.png │ │ │ │ │ ├── ui-bg_flat_75_2D54AA_40x100.png │ │ │ │ │ ├── ui-bg_flat_85_3B70E1_40x100.png │ │ │ │ │ ├── ui-bg_glass_100_f6f6f6_1x400.png │ │ │ │ │ ├── ui-bg_glass_100_fdf5ce_1x400.png │ │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ │ │ ├── ui-bg_gloss-wave_35_f6a828_500x100.png │ │ │ │ │ ├── ui-bg_diagonals-thick_18_b81900_40x40.png │ │ │ │ │ ├── ui-bg_diagonals-thick_20_666666_40x40.png │ │ │ │ │ ├── ui-bg_highlight-soft_100_eeeeee_1x100.png │ │ │ │ │ └── ui-bg_highlight-soft_75_ffe45c_1x100.png │ │ │ ├── aliceui │ │ │ │ ├── button │ │ │ │ │ └── src │ │ │ │ │ │ └── ui-button-disable.css │ │ │ │ └── form │ │ │ │ │ └── src │ │ │ │ │ └── label.css │ │ │ ├── imgareaselect │ │ │ │ └── imgareaselect-default.css │ │ │ ├── page.css │ │ │ ├── srobbin-jquery-pageslide │ │ │ │ ├── jquery.pageslide.css │ │ │ │ └── examples │ │ │ │ │ └── _secondary.html │ │ │ ├── jquery_pageslide.css │ │ │ └── uploader.css │ │ ├── _env.py │ │ └── readme.rst │ ├── doc │ │ └── source │ │ │ ├── example.py │ │ │ ├── _image │ │ │ ├── clone.png │ │ │ ├── login1.png │ │ │ ├── login2.png │ │ │ ├── login3.png │ │ │ ├── reset1.png │ │ │ ├── reset2.png │ │ │ ├── reset3.png │ │ │ ├── encoding.png │ │ │ ├── getkeys.png │ │ │ ├── makekeys.png │ │ │ ├── register.png │ │ │ ├── xshell_font.png │ │ │ ├── xshell_ft.png │ │ │ ├── filetransfer.png │ │ │ └── xshell_font_btn.png │ │ │ ├── _static │ │ │ ├── aaaaa.png │ │ │ ├── login.png │ │ │ ├── main.png │ │ │ ├── rst.png │ │ │ ├── sync.png │ │ │ ├── adduser.png │ │ │ ├── banshou.png │ │ │ ├── favicon.ico │ │ │ ├── notify.png │ │ │ ├── addgroup.png │ │ │ ├── addgroup2.png │ │ │ ├── addtogroup.png │ │ │ ├── figs │ │ │ │ └── magic-2.png │ │ │ ├── unreadnotify.png │ │ │ ├── addusertogroup.png │ │ │ └── translations.js │ │ │ ├── mvvm.rst │ │ │ ├── api │ │ │ └── index.rst │ │ │ ├── database │ │ │ └── index.rst │ │ │ ├── web │ │ │ └── index.rst │ │ │ ├── index.rst │ │ │ ├── 42qu.rst │ │ │ ├── plan.rst │ │ │ └── sso.rst │ ├── img │ │ ├── more.png │ │ └── background_1.gif │ ├── SITE │ │ ├── upload.swf │ │ └── favicon.ico │ ├── yuicompressor.jar │ └── _env.py ├── z42 │ ├── lib │ │ ├── __init__.py │ │ ├── mail_tmpl.py │ │ ├── reddit │ │ │ ├── _sorts.so │ │ │ ├── install.sh │ │ │ └── __init__.py │ │ ├── re_pattern.py │ │ ├── time_tool.py │ │ ├── txt2html.py │ │ ├── b64hash.py │ │ ├── b64uuid.py │ │ ├── jsonrpclib │ │ │ └── __init__.py │ │ ├── ip.py │ │ ├── luhn.py │ │ ├── unique.py │ │ ├── xor_encrypt.py │ │ └── num2code.py │ ├── web │ │ ├── __init__.py │ │ ├── lib │ │ │ ├── txt.py │ │ │ ├── __init__.py │ │ │ ├── qbox │ │ │ │ ├── __init__.py │ │ │ │ └── _env.py │ │ │ ├── _env.py │ │ │ └── txt_diff.py │ │ ├── boot │ │ │ ├── __init__.py │ │ │ ├── gae │ │ │ │ ├── __init__.py │ │ │ │ ├── prepare.sh │ │ │ │ ├── dev.sh │ │ │ │ ├── upload_index.sh │ │ │ │ ├── _env.py │ │ │ │ ├── _dev.sh │ │ │ │ ├── dev.py │ │ │ │ ├── app_yaml.py │ │ │ │ ├── upload.sh │ │ │ │ ├── upload_backend.sh │ │ │ │ └── init.sh │ │ │ ├── serve.sh │ │ │ ├── index.py │ │ │ ├── install.sh │ │ │ ├── prepare.sh │ │ │ ├── dev.sh │ │ │ ├── restart.py │ │ │ ├── restart.sh │ │ │ ├── serve.py │ │ │ └── coffee_const.py │ │ ├── sms │ │ │ ├── __init__.py │ │ │ ├── _env.py │ │ │ ├── sms_new.py │ │ │ ├── smsbao.py │ │ │ └── sms_twilio.py │ │ ├── mysql │ │ │ ├── __init__.py │ │ │ └── orm │ │ │ │ ├── __init__.py │ │ │ │ ├── _env.py │ │ │ │ └── _db.py │ │ ├── _patch │ │ │ ├── __init__.py │ │ │ ├── _env.py │ │ │ ├── test.py │ │ │ └── _morsel.py │ │ ├── config │ │ │ ├── __init__.py │ │ │ └── _env.py │ │ ├── memcache │ │ │ ├── __init__.py │ │ │ └── _env.py │ │ ├── view │ │ │ └── _env.py │ │ ├── _env.py │ │ ├── route.py │ │ ├── cgi.py │ │ ├── mail.py │ │ ├── render.py │ │ └── _import.py │ ├── __init__.py │ ├── captcha │ │ ├── r.ttf │ │ └── __init__.py │ ├── config │ │ ├── _signal.py │ │ ├── __init__.py │ │ └── _env.py │ └── _env.py ├── zapp │ ├── __init__.py │ └── _WEB │ │ ├── __init__.py │ │ ├── js │ │ └── __init__.py │ │ ├── misc │ │ ├── __init__.py │ │ ├── crontab │ │ │ └── __init__.py │ │ ├── config │ │ │ └── make │ │ │ │ ├── make.py │ │ │ │ └── _env.py │ │ ├── mysql.sql │ │ └── backup │ │ │ └── mysql │ │ │ └── _env.py │ │ ├── model │ │ ├── __init__.py │ │ ├── god │ │ │ ├── __init__.py │ │ │ ├── readme.txt │ │ │ └── _env.py │ │ ├── rpc │ │ │ ├── __init__.py │ │ │ ├── client │ │ │ │ ├── __init__.py │ │ │ │ ├── _gearman.py │ │ │ │ ├── index.py │ │ │ │ ├── _env.py │ │ │ │ └── mail.py │ │ │ └── server │ │ │ │ ├── _enabled.py │ │ │ │ ├── run.py │ │ │ │ ├── index.py │ │ │ │ ├── mail.py │ │ │ │ ├── _gearman.py │ │ │ │ ├── __init__.py │ │ │ │ ├── _env.py │ │ │ │ └── search.py │ │ ├── ob_cid.py │ │ ├── _env.py │ │ ├── gid.py │ │ ├── sso_sign.py │ │ ├── _db.py │ │ ├── sign.py │ │ ├── id_by_sso.py │ │ ├── mongo_raw_backup.py │ │ ├── admin_log.py │ │ ├── user_info.py │ │ └── verify_code.py │ │ └── view │ │ ├── __init__.py │ │ ├── _rpc │ │ ├── god.py │ │ ├── _env.py │ │ ├── upload.py │ │ ├── _route.py │ │ └── client.py │ │ ├── _env.py │ │ ├── _j.py │ │ ├── _route.py │ │ └── sso.py ├── .idea │ ├── .name │ ├── scopes │ │ └── scope_settings.xml │ ├── encodings.xml │ ├── vcs.xml │ ├── misc.xml │ ├── PegasusWang-z42-f7779b354fa9.iml │ └── modules.xml ├── css │ ├── __init__.py │ ├── _img │ │ ├── icon.png │ │ ├── pointer.png │ │ ├── shihui.png │ │ ├── icon-date.png │ │ ├── touziren.gif │ │ ├── warmuptk.png │ │ ├── icon-express.png │ │ ├── m │ │ │ └── root │ │ │ │ ├── arrow.png │ │ │ │ ├── cloud.png │ │ │ │ ├── item1.png │ │ │ │ ├── item2.png │ │ │ │ ├── item3.png │ │ │ │ ├── logo.png │ │ │ │ ├── mark.png │ │ │ │ ├── mark1.png │ │ │ │ ├── mark2.png │ │ │ │ ├── mark3.png │ │ │ │ ├── point.png │ │ │ │ ├── mark21.png │ │ │ │ ├── mark31.png │ │ │ │ ├── mingpian.png │ │ │ │ ├── touxiang.png │ │ │ │ └── triangle.png │ │ └── root │ │ │ ├── slideup.png │ │ │ ├── txt-mark.png │ │ │ ├── slideup-light.png │ │ │ └── platform-banner.png │ ├── _lib │ │ ├── simditor │ │ │ ├── images │ │ │ │ ├── fork.png │ │ │ │ ├── image.png │ │ │ │ ├── logo.png │ │ │ │ ├── title.png │ │ │ │ ├── logo@2x.png │ │ │ │ ├── title@2x.png │ │ │ │ └── loading-upload.gif │ │ │ ├── merge.sh │ │ │ └── simditor-emoji.css │ │ ├── jquery-ui │ │ │ └── images │ │ │ │ ├── animated-overlay.gif │ │ │ │ ├── ui-icons_222222_256x240.png │ │ │ │ ├── ui-icons_228ef1_256x240.png │ │ │ │ ├── ui-icons_2e83ff_256x240.png │ │ │ │ ├── ui-icons_469bdd_256x240.png │ │ │ │ ├── ui-icons_cd0a0a_256x240.png │ │ │ │ ├── ui-icons_d8e7f3_256x240.png │ │ │ │ ├── ui-icons_ef8c08_256x240.png │ │ │ │ ├── ui-icons_ffd27a_256x240.png │ │ │ │ ├── ui-icons_ffffff_256x240.png │ │ │ │ ├── ui-bg_flat_0_aaaaaa_40x100.png │ │ │ │ ├── ui-bg_flat_10_000000_40x100.png │ │ │ │ ├── ui-bg_flat_55_F26522_40x100.png │ │ │ │ ├── ui-bg_flat_55_fbec88_40x100.png │ │ │ │ ├── ui-bg_flat_75_2D54AA_40x100.png │ │ │ │ ├── ui-bg_flat_85_3B70E1_40x100.png │ │ │ │ ├── ui-bg_glass_65_ffffff_1x400.png │ │ │ │ ├── ui-bg_glass_95_fef1ec_1x400.png │ │ │ │ ├── ui-bg_flat_100_202079_40x100.png │ │ │ │ ├── ui-bg_flat_100_ffffff_40x100.png │ │ │ │ ├── ui-bg_glass_100_f6f6f6_1x400.png │ │ │ │ ├── ui-bg_glass_100_fdf5ce_1x400.png │ │ │ │ ├── ui-bg_gloss-wave_35_f6a828_500x100.png │ │ │ │ ├── ui-bg_diagonals-thick_18_b81900_40x40.png │ │ │ │ ├── ui-bg_diagonals-thick_20_666666_40x40.png │ │ │ │ ├── ui-bg_highlight-soft_100_eeeeee_1x100.png │ │ │ │ └── ui-bg_highlight-soft_75_ffe45c_1x100.png │ │ ├── aliceui │ │ │ ├── button │ │ │ │ └── src │ │ │ │ │ └── ui-button-disable.css │ │ │ ├── form │ │ │ │ └── src │ │ │ │ │ └── label.css │ │ │ └── table │ │ │ │ └── dist │ │ │ │ └── table.css │ │ ├── imgareaselect │ │ │ └── imgareaselect-default.css │ │ ├── page.css │ │ ├── srobbin-jquery-pageslide │ │ │ ├── jquery.pageslide.css │ │ │ └── examples │ │ │ │ └── _secondary.html │ │ ├── jquery_pageslide.css │ │ └── uploader.css │ ├── _env.py │ └── readme.rst ├── coffee │ ├── require.js │ │ └── dependence.coffee │ └── _lib │ │ ├── avalon_view.coffee │ │ ├── z42.coffee │ │ ├── rpc.coffee │ │ └── avalon_ext.coffee ├── .hg_archival.txt ├── hg_sync.sh ├── _env.py ├── requirements.txt ├── _lua_debug.py ├── html │ └── _base │ │ ├── default.html │ │ ├── rss.html │ │ └── mail.html ├── print_ac_route ├── print_route └── .hgignore ├── bigdata └── .gitignore ├── diagrams ├── .gitignore ├── README.md ├── demo.py └── demo2.py ├── design_pattern ├── .cache │ └── v │ │ └── cache │ │ └── lastfailed ├── python-patterns │ ├── __init__.py │ ├── .gitignore │ ├── append_output.sh │ ├── chaining_method.py │ ├── decorator.py │ └── test_strategy.py ├── t.py ├── enum_t.py └── lazy_property.py ├── chrome ├── .gitignore ├── README.md ├── control.js └── control.py ├── README.md ├── calibre ├── .gitignore ├── parse.py └── README.md ├── web ├── cookie_secret ├── iptools.py ├── escape_unescape_html.py ├── gen_secret.py ├── url_encode_unquote.py ├── myip.py ├── encrypt_password.py └── httpauth.py ├── crawler ├── proxy │ ├── run.bat │ ├── proxy.py │ ├── readme.txt │ └── pysqlite-2.3.3.win32-py2.4.exe ├── _env.py ├── src │ ├── grequests_crawler.py │ ├── server.py │ ├── search_engine_header.py │ ├── test.py │ └── sync_spider.py ├── proxy.log └── tofetch.txt ├── socket_programming ├── event_loop │ ├── coro.png │ ├── tcp_server_blocking.py │ ├── asyncio_tcp_echo_server.py │ ├── echo_server_select.py │ └── tcp_bench.go ├── event_loop_select.py ├── tcp_client.py ├── 0_blocking_socket_http.py ├── tornado_server.py └── doc_tcp_server.py ├── book_codes └── Python网络编程Linux │ ├── struct_demo.py │ ├── socket05c.py │ └── socket05s.py ├── github └── miio.py ├── .gitignore ├── mail ├── config.py ├── 搭建smtp服务器.md └── cloudsend.py ├── text_html ├── markdown_to_html.py ├── inflection_tools.py ├── t.py ├── html2text_tool.py └── encoding_decoding_tool.py ├── iterm2 └── iter2.py ├── img └── tinyfy_image.py ├── tools └── mac_wathch_and_refresh_chrome.sh ├── os ├── kill_process.py ├── multiple_cmd.py └── walk_all.py ├── algorithm_datastructure └── binary_search.py ├── debugtools └── terminal_color_print.py ├── raw └── parse.py ├── thread └── multi_process.py ├── coroutine └── subprocess_target.py ├── funny ├── draw_heart.py └── ascii_print.py ├── date_time ├── get_day_of_month.py └── to_timestamp.py ├── kafka_demo └── consumer.py └── stock └── sina.py /z42/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/js/_WEB/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/static/x.txt: -------------------------------------------------------------------------------- 1 | 3 2 | -------------------------------------------------------------------------------- /z42/z42/lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/z42/web/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/z42/web/lib/txt.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/zapp/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /bigdata/.gitignore: -------------------------------------------------------------------------------- 1 | *.txt 2 | -------------------------------------------------------------------------------- /z42/z42/web/boot/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/z42/web/lib/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/z42/web/sms/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/js/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/static/js/_WEB/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/z42/web/boot/gae/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/z42/web/lib/qbox/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/z42/web/mysql/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/misc/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/model/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/view/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /diagrams/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | *.png 3 | -------------------------------------------------------------------------------- /z42/z42/__init__.py: -------------------------------------------------------------------------------- 1 | import _env 2 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/misc/crontab/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/model/god/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/model/rpc/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /design_pattern/.cache/v/cache/lastfailed: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /design_pattern/python-patterns/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /z42/.idea/.name: -------------------------------------------------------------------------------- 1 | PegasusWang-z42-f7779b354fa9 -------------------------------------------------------------------------------- /z42/zapp/_WEB/model/god/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/model/rpc/client/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /chrome/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | *.png 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 大量干货,个人和工作常用的代码收集,包括一些好的开源项目和常用代码工具。 2 | -------------------------------------------------------------------------------- /calibre/.gitignore: -------------------------------------------------------------------------------- 1 | *.mobi 2 | *.pdf 3 | *.epub 4 | -------------------------------------------------------------------------------- /design_pattern/python-patterns/.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__ 2 | -------------------------------------------------------------------------------- /z42/static/html/sort/test/2.json: -------------------------------------------------------------------------------- 1 | {"title":"撒大声地","brief":"阿斯达"} -------------------------------------------------------------------------------- /z42/static/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | 4 | -------------------------------------------------------------------------------- /web/cookie_secret: -------------------------------------------------------------------------------- 1 | 4E2TrpteR/KDVQ0f4V70HY2S3bqeTk41gBfGYQ4KT8M= 2 | -------------------------------------------------------------------------------- /z42/js/hack/placeholder.js: -------------------------------------------------------------------------------- 1 | $('input, textarea').placeholder(); 2 | -------------------------------------------------------------------------------- /z42/static/sina_verified_check.txt: -------------------------------------------------------------------------------- 1 | 1032784ba7cbabc73df2d73f4eb50784 -------------------------------------------------------------------------------- /z42/z42/lib/mail_tmpl.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | -------------------------------------------------------------------------------- /z42/js/__init__.py: -------------------------------------------------------------------------------- 1 | import _hash_ 2 | 3 | vars().update(vars(_hash_)) 4 | -------------------------------------------------------------------------------- /z42/static/js/hack/placeholder.js: -------------------------------------------------------------------------------- 1 | $('input, textarea').placeholder(); 2 | -------------------------------------------------------------------------------- /z42/z42/web/_patch/__init__.py: -------------------------------------------------------------------------------- 1 | import _morsel 2 | import _tornado 3 | -------------------------------------------------------------------------------- /z42/z42/web/mysql/orm/__init__.py: -------------------------------------------------------------------------------- 1 | from model import Model, ModelMc 2 | -------------------------------------------------------------------------------- /z42/css/__init__.py: -------------------------------------------------------------------------------- 1 | import _hash_ 2 | 3 | vars().update(vars(_hash_)) 4 | -------------------------------------------------------------------------------- /z42/static/css/__init__.py: -------------------------------------------------------------------------------- 1 | import _hash_ 2 | 3 | vars().update(vars(_hash_)) 4 | -------------------------------------------------------------------------------- /z42/static/js/__init__.py: -------------------------------------------------------------------------------- 1 | import _hash_ 2 | 3 | vars().update(vars(_hash_)) 4 | -------------------------------------------------------------------------------- /z42/js/foot.js: -------------------------------------------------------------------------------- 1 | //require("//hm.baidu.com/hm.js?890835ff6f3f123078e3621b4272bd97") 2 | -------------------------------------------------------------------------------- /z42/static/js/foot.js: -------------------------------------------------------------------------------- 1 | //require("//hm.baidu.com/hm.js?890835ff6f3f123078e3621b4272bd97") 2 | -------------------------------------------------------------------------------- /crawler/proxy/run.bat: -------------------------------------------------------------------------------- 1 | :loop 2 | cls 3 | C:\Python24\python.exe proxy.py 4 | pause 5 | goto loop -------------------------------------------------------------------------------- /z42/static/doc/source/example.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | 4 | print "Hello" 5 | -------------------------------------------------------------------------------- /z42/coffee/require.js/dependence.coffee: -------------------------------------------------------------------------------- 1 | #init : 2 | # deps : [ 3 | # 'jquery' 4 | # ] 5 | 6 | -------------------------------------------------------------------------------- /z42/css/_img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/icon.png -------------------------------------------------------------------------------- /z42/z42/captcha/r.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/z42/captcha/r.ttf -------------------------------------------------------------------------------- /z42/zapp/_WEB/model/rpc/server/_enabled.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | 4 | import mail 5 | -------------------------------------------------------------------------------- /crawler/proxy/proxy.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/crawler/proxy/proxy.py -------------------------------------------------------------------------------- /crawler/proxy/readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/crawler/proxy/readme.txt -------------------------------------------------------------------------------- /z42/css/_img/pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/pointer.png -------------------------------------------------------------------------------- /z42/css/_img/shihui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/shihui.png -------------------------------------------------------------------------------- /z42/static/img/more.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/static/img/more.png -------------------------------------------------------------------------------- /diagrams/README.md: -------------------------------------------------------------------------------- 1 | # python 画架构图 2 | 3 | https://pythondict.com/python-paintings/python-draw-system-architecture/ 4 | -------------------------------------------------------------------------------- /z42/css/_img/icon-date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/icon-date.png -------------------------------------------------------------------------------- /z42/css/_img/touziren.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/touziren.gif -------------------------------------------------------------------------------- /z42/css/_img/warmuptk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/warmuptk.png -------------------------------------------------------------------------------- /z42/js/_lib/uploadify.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/js/_lib/uploadify.swf -------------------------------------------------------------------------------- /z42/static/SITE/upload.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/static/SITE/upload.swf -------------------------------------------------------------------------------- /z42/css/_img/icon-express.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/icon-express.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/arrow.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/cloud.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/item1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/item1.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/item2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/item2.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/item3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/item3.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/logo.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/mark.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/mark1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/mark1.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/mark2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/mark2.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/mark3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/mark3.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/point.png -------------------------------------------------------------------------------- /z42/css/_img/root/slideup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/root/slideup.png -------------------------------------------------------------------------------- /z42/js/_lib/webcam/webcam.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/js/_lib/webcam/webcam.swf -------------------------------------------------------------------------------- /z42/static/SITE/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/static/SITE/favicon.ico -------------------------------------------------------------------------------- /z42/static/css/_img/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/static/css/_img/icon.png -------------------------------------------------------------------------------- /z42/static/html/sort/js/plus.coffee: -------------------------------------------------------------------------------- 1 | $(".plus").click -> 2 | $(this).append """+1""" 3 | -------------------------------------------------------------------------------- /z42/static/yuicompressor.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/static/yuicompressor.jar -------------------------------------------------------------------------------- /z42/z42/lib/reddit/_sorts.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/z42/lib/reddit/_sorts.so -------------------------------------------------------------------------------- /z42/css/_img/m/root/mark21.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/mark21.png -------------------------------------------------------------------------------- /z42/css/_img/m/root/mark31.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/m/root/mark31.png -------------------------------------------------------------------------------- /z42/css/_img/root/txt-mark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PegasusWang/collection_python/HEAD/z42/css/_img/root/txt-mark.png -------------------------------------------------------------------------------- /z42/js/hack/ie8.js: -------------------------------------------------------------------------------- 1 | function LOAD(js){ document.write('\ 8 | <%block name="head">\ 9 | <%block name="title">${TITLE}</%block>\ 10 | ${next.body()}\ 11 | <%block name="foot">\ 12 | <%block name="script">\ 13 | \ 14 | 15 | -------------------------------------------------------------------------------- /z42/static/html/sort/css/plus.css: -------------------------------------------------------------------------------- 1 | .span-add { 2 | position: absolute; 3 | animation:myfirst 1.3s; 4 | -moz-animation:myfirst 1.3s; /* Firefox */ 5 | -webkit-animation:myfirst 1.3s; /* Safari and Chrome */ 6 | -o-animation:myfirst 1.3s; /* Opera */ 7 | } 8 | @-webkit-keyframes myfirst 9 | { 10 | 0% {margin-top: 0;color:red;display: inline;} 11 | 100% {margin-top: -40px;opacity:0;font-size:40px;margin-left:10px;} 12 | } -------------------------------------------------------------------------------- /chrome/control.py: -------------------------------------------------------------------------------- 1 | """ 2 | pip3 install pyppeteer 3 | """ 4 | 5 | import asyncio 6 | from pyppeteer import launch 7 | 8 | async def main(): 9 | browser = await launch() 10 | page = await browser.newPage() 11 | print(page) 12 | await page.goto('https://www.baidu.com') 13 | await page.screenshot({'path': 'example.png'}) 14 | await browser.close() 15 | 16 | asyncio.get_event_loop().run_until_complete(main()) 17 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/view/_rpc/upload.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | 4 | @route('/j/upload_token') 5 | class _(JsonErrView): 6 | def get(self): 7 | self.finish(QINIU_TOKEN.new( 8 | returnBody="""{ 9 | "key":$(key), 10 | "w": $(imageInfo.width), 11 | "h": $(imageInfo.height), 12 | "fn": $(fname) 13 | }""", 14 | saveKey=str(gid()))) 15 | 16 | 17 | if __name__ == "__main__": 18 | pass 19 | 20 | -------------------------------------------------------------------------------- /z42/css/_lib/aliceui/form/src/label.css: -------------------------------------------------------------------------------- 1 | .ui-label { 2 | float: left; 3 | width: 170px; 4 | margin-left: -180px; 5 | padding-top: 8px; 6 | line-height: 22px; 7 | text-align: right; 8 | font-size: 14px; 9 | } 10 | 11 | .ui-form-required { 12 | color: #FF0000; 13 | font-family: SimSun; 14 | font-size: 14px; 15 | margin-right: 6px; 16 | } 17 | 18 | input.ui-checkbox { 19 | vertical-align: baseline; 20 | } 21 | -------------------------------------------------------------------------------- /z42/z42/web/boot/install.sh: -------------------------------------------------------------------------------- 1 | easy_install -U bitcoin-python 2 | emerge mysql 3 | emerge nodejs 4 | npm install -g uglify-js 5 | npm install -g coffee-script 6 | emerge libmemcached 7 | emerge yaml 8 | 9 | easy_install envoy 10 | easy_install pylibmc 11 | easy_install pyinotify 12 | easy_install single_process 13 | easy_install requests 14 | easy_install pyyaml 15 | easy_install distribute 16 | easy_install ipython 17 | easy_install mysql-python 18 | -------------------------------------------------------------------------------- /z42/css/readme.rst: -------------------------------------------------------------------------------- 1 | :: 2 | 按住Ctrl, 然后点击 , 可以在浏览器中开新窗口浏览 3 | 4 | \_lib 目录下的库 5 | 6 | #. `css3-facebook-buttons `_ : 类似facebook按钮样式 7 | 8 | #. `normalize.css `_ : reset css (bootstarup使用的), 统一html组件的样式 9 | 10 | #. `tip tip jquery plugin `_ : 基于jquery的tips插件,该文件是tips所依赖的css样式文件 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /z42/static/css/_lib/aliceui/form/src/label.css: -------------------------------------------------------------------------------- 1 | .ui-label { 2 | float: left; 3 | width: 170px; 4 | margin-left: -180px; 5 | padding-top: 8px; 6 | line-height: 22px; 7 | text-align: right; 8 | font-size: 14px; 9 | } 10 | 11 | .ui-form-required { 12 | color: #FF0000; 13 | font-family: SimSun; 14 | font-size: 14px; 15 | margin-right: 6px; 16 | } 17 | 18 | input.ui-checkbox { 19 | vertical-align: baseline; 20 | } 21 | -------------------------------------------------------------------------------- /z42/static/doc/source/_static/translations.js: -------------------------------------------------------------------------------- 1 | Documentation.addTranslations({"locale": "zh_CN", "plural_expr": "0", "messages": {"Hide Search Matches": "\u9690\u85cf\u641c\u7d22\u7ed3\u679c", "Permalink to this definition": "\u6c38\u4e45\u94fe\u63a5\u81f3\u76ee\u6807", "Expand sidebar": "", "Permalink to this headline": "\u6c38\u4e45\u94fe\u63a5\u81f3\u6807\u9898", "Collapse sidebar": ""}}); 2 | 3 | $(function(){ 4 | $(".external").attr('target',"_blank") 5 | }) 6 | -------------------------------------------------------------------------------- /z42/static/html/sort/css/tip_com.css: -------------------------------------------------------------------------------- 1 | .tip-inner.tip-bg-image .tip-com { 2 | width: 308px; 3 | background: rgba(0,0,0,0.8); 4 | color: #fff; 5 | padding: 20px; 6 | margin-left: -40px; 7 | } 8 | .tip-inner.tip-bg-image .tip-com:before{ 9 | border: 10px solid transparent; 10 | border-right: 10px solid #333; 11 | width: 0; 12 | height: 0; 13 | position: absolute; 14 | content: ' '; 15 | top:50%; 16 | margin-top:-10px; 17 | margin-left: -40px; 18 | } -------------------------------------------------------------------------------- /z42/static/css/readme.rst: -------------------------------------------------------------------------------- 1 | :: 2 | 按住Ctrl, 然后点击 , 可以在浏览器中开新窗口浏览 3 | 4 | \_lib 目录下的库 5 | 6 | #. `css3-facebook-buttons `_ : 类似facebook按钮样式 7 | 8 | #. `normalize.css `_ : reset css (bootstarup使用的), 统一html组件的样式 9 | 10 | #. `tip tip jquery plugin `_ : 基于jquery的tips插件,该文件是tips所依赖的css样式文件 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /z42/z42/web/boot/prepare.sh: -------------------------------------------------------------------------------- 1 | PREFIX=$(cd "$(dirname "$0")"; pwd) 2 | PREFIX=$PREFIX/../../.. 3 | cd $PREFIX 4 | 5 | ZWEB=$PREFIX/z42/web 6 | 7 | 8 | 9 | python $ZWEB/boot/env_is_link.py 10 | python $ZWEB/boot/coffee_const.py 11 | python $ZWEB/boot/coffee_script.py -once 12 | 13 | python $ZWEB/boot/css_js.py 14 | python $ZWEB/boot/js_requirejs.py 15 | python $ZWEB/boot/signal.py 16 | 17 | 18 | 19 | ps x -u $USER|ack 'coffee_script.py'|xargs kill -9 > /dev/null 2>&1 20 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/view/_rpc/_route.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | import _env 4 | from z42.web.route import Route as _Route 5 | from z42.config import HOST 6 | from zapp.TECH2IPO.view._route import ROUTE_LIST 7 | 8 | 9 | class Route(_Route): 10 | 11 | def __call__(self, url, **kwds): 12 | 13 | return super(Route,self).__call__("/rpc/%s\\.(.*)"%url, **kwds) 14 | 15 | route = Route(host=HOST.replace(".","\\.")) 16 | 17 | ROUTE_LIST.append(route) 18 | -------------------------------------------------------------------------------- /design_pattern/t.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | 4 | 5 | class Singleton(object): 6 | def __new__(cls, *args, **kwargs): 7 | if not hasattr(cls, '_instance'): 8 | orig = super(Singleton, cls) 9 | cls._instance = orig.__new__(cls, *args, **kwargs) 10 | return cls._instance 11 | 12 | 13 | class T(Singleton): 14 | pass 15 | 16 | 17 | def test(): 18 | s1 = T() 19 | s2 = T() 20 | assert s1 is s2 21 | -------------------------------------------------------------------------------- /os/kill_process.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | import subprocess, signal 5 | 6 | def kill_process_name(process_name): 7 | p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE) 8 | out, err = p.communicate() 9 | 10 | for line in out.splitlines(): 11 | if name in line: 12 | pid = int(line.split(None, 1)[0]) 13 | os.kill(pid, signal.SIGKILL) 14 | 15 | 16 | if __name__ == '__main__': 17 | pass 18 | -------------------------------------------------------------------------------- /z42/z42/web/lib/txt_diff.py: -------------------------------------------------------------------------------- 1 | #coding:utf-8 2 | #coding:utf-8 3 | from diff_match_patch import diff_match_patch 4 | def diff_get(txt1, txt2): 5 | diff = diff_match_patch() 6 | _diff = diff.diff_compute(txt1, txt2, True, 3) 7 | result = '' 8 | for i in _diff: 9 | num, content = i 10 | if num < 0: 11 | result += ('- ' + content + '\n') 12 | if num > 0: 13 | result += ('+ ' + content + '\n') 14 | return result 15 | -------------------------------------------------------------------------------- /z42/z42/web/mysql/orm/_db.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | import _env 4 | from z42 import config 5 | from z42.web.mysql.sqlstore import Db 6 | 7 | 8 | MYSQL_CONFIG = { 9 | config.MYSQL_DATABASE: { 10 | 'master': '%s:%s:%s:%s:%s' % (config.MYSQL_HOST, config.MYSQL_PORT, 11 | config.MYSQL_DATABASE, config.MYSQL_USER, config.MYSQL_PASSWORD), 12 | 'tables': '*', 13 | } 14 | } 15 | 16 | DB = Db(MYSQL_CONFIG) 17 | -------------------------------------------------------------------------------- /z42/z42/web/sms/sms_new.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | from smsbao import sms_new as smsbao_new 4 | 5 | def sms_new(code, phone, txt): 6 | if isinstance(code,basestring) and not code.isdigit(): 7 | return 8 | code = int(code) 9 | if code == 86: 10 | _new = smsbao_new 11 | else: 12 | from sms_twilio import sms_new as sms_twilio_new 13 | _new = sms_twilio_new 14 | #print code, phone 15 | _new(code, phone, txt) 16 | -------------------------------------------------------------------------------- /z42/z42/web/boot/gae/dev.py: -------------------------------------------------------------------------------- 1 | # coding:utf-8 2 | from _env import PREFIX 3 | from z42.config import HOST, PORT, ADMIN_PORT 4 | import envoy 5 | import sys 6 | 7 | CMD = 'dev_appserver.py --host 0.0.0.0 --show_mail_body yes --enable_sendmail --skip_sdk_update_check --admin_host 0.0.0.0 --admin_port=%s --port %s ' % (PORT+42, PORT) 8 | if len(sys.argv) > 1 and sys.argv[1] == '-c': 9 | CMD += ' --clear_datastore=yes ' 10 | CMD += PREFIX 11 | print CMD 12 | print '# http://%s:%s'%(HOST, PORT) 13 | -------------------------------------------------------------------------------- /os/multiple_cmd.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | 4 | # 并行执行命令 5 | from subprocess import Popen 6 | 7 | commands = [ 8 | 'date; ls -l; sleep 1; date', 9 | 'date; sleep 5; date', 10 | 'date; df -h; sleep 3; date', 11 | 'date; hostname; sleep 2; date', 12 | 'date; uname -a; date', 13 | ] 14 | # run in parallel 15 | processes = [Popen(cmd, shell=True) for cmd in commands] 16 | # do other things here.. 17 | # wait for completion 18 | for p in processes: p.wait() 19 | -------------------------------------------------------------------------------- /z42/js/_lib/trim.js: -------------------------------------------------------------------------------- 1 | if(!String.prototype.trimRight){ 2 | String.prototype.trimRight = function() { 3 | var str = this, 4 | whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000'; 5 | for (i = str.length - 1; i >= 0; i--) { 6 | if (whitespace.indexOf(str.charAt(i)) === -1) { 7 | str = str.substring(0, i + 1); 8 | break; 9 | } 10 | } 11 | return str; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /z42/static/doc/source/index.rst: -------------------------------------------------------------------------------- 1 | 42WEB漫游指南 2 | =================================== 3 | 4 | Don't panic ( 不要恐慌 ) 5 | ----------------------------------- 6 | 7 | 8 | .. toctree:: 9 | :glob: 10 | :maxdepth: 2 11 | 12 | team/newbie 13 | kp 14 | xshell 15 | seafile 16 | web/index 17 | vps 18 | rst 19 | vim 20 | hg 21 | shell 22 | 42qu 23 | dev/dev 24 | dev/42web 25 | dev/views 26 | ipython 27 | hyperestraier 28 | database/mongo 29 | -------------------------------------------------------------------------------- /z42/static/js/_lib/trim.js: -------------------------------------------------------------------------------- 1 | if(!String.prototype.trimRight){ 2 | String.prototype.trimRight = function() { 3 | var str = this, 4 | whitespace = ' \n\r\t\f\x0b\xa0\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u200b\u2028\u2029\u3000'; 5 | for (i = str.length - 1; i >= 0; i--) { 6 | if (whitespace.indexOf(str.charAt(i)) === -1) { 7 | str = str.substring(0, i + 1); 8 | break; 9 | } 10 | } 11 | return str; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/model/sso_sign.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | import _env 4 | from zapp._WEB.model.client_sign import ClientSign 5 | from zapp._WEB.model.session import Session 6 | from z42.config import SSO 7 | 8 | def sso_sign(sso_id, session, path, o): 9 | o['sso_id']=sso_id 10 | o['app_id']=SSO.ID 11 | session = str(session) 12 | 13 | return "//%s/rpc/%s?%s"%( 14 | SSO.HOST, 15 | path, 16 | ClientSign.url(session+SSO.SECRET,o) 17 | ) 18 | 19 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/model/_db.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding:utf-8 3 | import _env 4 | 5 | import redis as _redis 6 | #print _redis.__file__ 7 | from z42.config import REDIS_CONFIG 8 | from redis_key import RedisKey 9 | 10 | redis = _redis.StrictRedis(**REDIS_CONFIG) 11 | 12 | R = RedisKey(redis) 13 | 14 | from z42.web.mongo import Doc 15 | 16 | if __name__ == '__main__': 17 | print REDIS_CONFIG 18 | print redis.get(R.ICO_URL("%s")%100000011) 19 | from pprint import pprint 20 | print pprint(redis.info()) 21 | -------------------------------------------------------------------------------- /design_pattern/enum_t.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | 4 | # http://stackoverflow.com/questions/36932/how-can-i-represent-an-enum-in-python 5 | # python <3.4 pip install enum34 6 | 7 | from enum import Enum, IntEnum 8 | 9 | ''' 10 | def enum(**kwargs): 11 | return type('Enum', (), kwargs) 12 | 13 | 14 | Type = enum( 15 | a=1, 16 | b=2 17 | ) 18 | 19 | #class MyEnum(object): 20 | # def __new__(cls): 21 | # members = [attr for attr in dir(Example()) if not callable(attr) and not attr.startswith("__")] 22 | ''' 23 | -------------------------------------------------------------------------------- /z42/z42/web/boot/dev.sh: -------------------------------------------------------------------------------- 1 | PREFIX=$(cd "$(dirname "$0")"; pwd) 2 | BASE=$PREFIX/../.. 3 | 4 | while [ 1 ] 5 | do 6 | $BASE/z42/web/boot/prepare.sh $1 7 | ps x -u $USER|ack $BASE|ack 'z42/web/boot/serve'|awk '{print $1}'|xargs kill -9 > /dev/null 2>&1 8 | cd $PREFIX 9 | #rm $PREFIX/_html -rf 10 | echo "import _env;import zapp.$(basename $PREFIX).misc.config" > $BASE/z42/_app_config_.py 11 | python $BASE/z42/web/boot/coffee_script.py & 12 | python $BASE/z42/web/boot/serve.py $1 13 | 14 | echo "" 15 | for((i=1;i<=4;i++));do echo -n "$i ";sleep 1;done 16 | done 17 | -------------------------------------------------------------------------------- /z42/z42/web/boot/restart.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | import _env 4 | import envoy 5 | import sys 6 | from os.path import abspath, dirname, join 7 | from z42.config import HOST 8 | from z42.config import APP 9 | 10 | 11 | std_out = envoy.run("supervisorctl status").std_out 12 | print APP 13 | print std_out 14 | for i in std_out.split("\n"): 15 | 16 | i = i.split(" ",1)[0].strip() 17 | if i: 18 | if HOST in i: 19 | cmd = "sudo supervisorctl restart %s"%i 20 | print cmd 21 | envoy.run(cmd) 22 | 23 | -------------------------------------------------------------------------------- /z42/z42/web/cgi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | import _env 4 | import _patch 5 | import logging 6 | import sys 7 | import tornado.wsgi 8 | import wsgiref.handlers 9 | from z42.config import DEBUG 10 | 11 | 12 | def application( 13 | route_list, 14 | Application, 15 | xsrf_cookies=False, 16 | ): 17 | app = Application( 18 | xsrf_cookies=xsrf_cookies, 19 | debug=DEBUG, 20 | gzip=True 21 | ) 22 | 23 | for route in route_list: 24 | app.add_handlers(route.host , route.handlers) 25 | 26 | return app 27 | -------------------------------------------------------------------------------- /diagrams/demo.py: -------------------------------------------------------------------------------- 1 | # pip install diagrams 2 | # https://diagrams.mingrammer.com/ 3 | from diagrams import Cluster, Diagram 4 | from diagrams.aws.compute import ECS 5 | from diagrams.aws.database import RDS 6 | from diagrams.aws.network import Route53 7 | 8 | with Diagram("Simple Web Service with DB Cluster", show=False): 9 | dns = Route53("dns") 10 | web = ECS("service") 11 | 12 | with Cluster("DB Cluster"): 13 | db_master = RDS("master") 14 | db_master - [RDS("slave1"), 15 | RDS("slave2")] 16 | 17 | dns >> web >> db_master 18 | -------------------------------------------------------------------------------- /web/escape_unescape_html.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | 4 | ''' 5 | import cgi 6 | s = cgi.escape( """& < >""" ) # s = "& < >" 7 | 8 | import HTMLParser 9 | h = HTMLParser.HTMLParser() 10 | print h.unescape('£682m') 11 | ''' 12 | 13 | 14 | def escape_html(html): 15 | import cgi 16 | return cgi.escape(html) 17 | 18 | 19 | def unescape_html(html): 20 | import HTMLParser 21 | return HTMLParser.HTMLParser().unescape(html) 22 | 23 | # from xml.sax.saxutils import escape, unescape 24 | print(escape_html('

hehe

')) 25 | -------------------------------------------------------------------------------- /z42/z42/lib/luhn.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | 4 | 5 | def luhn_verify(code): 6 | code = code.replace(' ', '').strip() 7 | if not code.isdigit(): 8 | return False 9 | sum = 0 10 | for i in xrange(len(code)): 11 | c = int(code[-i-1]) 12 | if i % 2: 13 | v = c * 2; 14 | sum += (v - 9) if (v > 9) else v 15 | else: 16 | sum += c 17 | return sum % 10 == 0 18 | 19 | if __name__ == '__main__': 20 | print luhn_verify('5324505101636252') 21 | print luhn_verify('532450510163625') 22 | 23 | -------------------------------------------------------------------------------- /algorithm_datastructure/binary_search.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | 4 | 5 | def bsearch(l, to_search): 6 | beg = 0 7 | end = len(l) - 1 8 | while beg < end: 9 | mid = beg + int((end - beg) / 2) 10 | if l[mid] < to_search: 11 | beg = mid + 1 12 | elif l[mid] > to_search: 13 | end = mid 14 | else: 15 | return mid 16 | return -1 17 | 18 | 19 | def test(): 20 | l = list(range(10)) 21 | assert bsearch(l, 1) == 1 22 | assert bsearch(l, 0) == 0 23 | assert bsearch(l, 10) == -1 24 | -------------------------------------------------------------------------------- /z42/coffee/_lib/z42.coffee: -------------------------------------------------------------------------------- 1 | 2 | window.def_view = _def_view = (id, ctrl)-> 3 | avalon.define( 4 | id, 5 | ctrl 6 | ) 7 | 8 | $ -> 9 | window.def_view = (id, ctrl)-> 10 | v = _def_view(id,ctrl) 11 | avalon.scan() 12 | return v 13 | 14 | window.def_edit_view = (name, callback) -> 15 | def_view( 16 | name 17 | (v) -> 18 | v.is_edit = 0 19 | v.edit = -> 20 | V[name].is_edit = 1 21 | v.cancel = -> 22 | V[name].is_edit = 0 23 | callback(v) 24 | ) 25 | -------------------------------------------------------------------------------- /mail/cloudsend.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | #coding:utf-8 3 | import requests, json 4 | 5 | url="http://sendcloud.sohu.com/webapi/mail.send.json" 6 | 7 | # 不同于登录SendCloud站点的帐号,您需要登录后台创建发信子帐号,使用子帐号和密码才可以进行邮件的发送。 8 | params = { 9 | "api_user": "pegasus_test_kTfGDH", 10 | "api_key" : "aQbHk7BlDJizBwyF", 11 | "from" : "service@sendcloud.im", 12 | "fromname" : "网站测试", 13 | "to" : "291374108@qq.com", 14 | "subject" : "来自SendCloud的第一封邮件!", 15 | "html": "欢迎提出改进建议""", 16 | "resp_email_id": "true", 17 | } 18 | 19 | r = requests.post(url, files={}, data=params) 20 | print r.text 21 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/view/_j.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | 4 | import _env 5 | import json 6 | import tornado 7 | from yajl import loads, dumps 8 | from zapp._WEB.view._user import View 9 | 10 | 11 | class JsonLoginView(View): 12 | 13 | def prepare(self): 14 | super(JsonLoginView, self).prepare() 15 | if not self.current_user_id: 16 | callback = self.get_argument('callback', None) 17 | result = '{"err":{"code": 403}}' 18 | if callback: 19 | result = "%s(%s)"%(callback,result) 20 | self.finish(result) 21 | 22 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/view/_route.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | 4 | import _env 5 | from zapp._WEB.model.host import cid_by_host 6 | from z42.web.route import Route 7 | 8 | class _CidMatch(object): 9 | pattern = None 10 | def __init__(self, cid): 11 | self.cid = cid 12 | 13 | def match(self, host): 14 | if cid_by_host(host) == self.cid: 15 | return True 16 | 17 | class RouteByCid(Route): 18 | def __init__(self, cid, prefix=''): 19 | self.handlers = [] 20 | self._prefix = prefix 21 | self.host = _CidMatch(cid) 22 | 23 | 24 | -------------------------------------------------------------------------------- /z42/css/_lib/imgareaselect/imgareaselect-default.css: -------------------------------------------------------------------------------- 1 | /* 2 | * imgAreaSelect default style 3 | */ 4 | 5 | 6 | .imgareaselect-border1, .imgareaselect-border2, 7 | .imgareaselect-border3, .imgareaselect-border4 { 8 | filter: alpha(opacity=50); 9 | opacity: 0.5; 10 | } 11 | 12 | .imgareaselect-handle { 13 | background-color: #fff; 14 | border: solid 1px #000; 15 | filter: alpha(opacity=50); 16 | opacity: 0.5; 17 | } 18 | 19 | .imgareaselect-outer { 20 | background-color: #000; 21 | filter: alpha(opacity=50); 22 | opacity: 0.5; 23 | } 24 | 25 | .imgareaselect-selection { 26 | } 27 | -------------------------------------------------------------------------------- /z42/zapp/_WEB/model/sign.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # coding:utf-8 3 | 4 | 5 | import _env 6 | from z42.web.mongo import Doc 7 | from zapp._WEB.model._db import redis, R 8 | 9 | 10 | class Sign(Doc): 11 | structure = dict( 12 | id=int, 13 | txt=str, 14 | ) 15 | 16 | @staticmethod 17 | def new(user_id, txt): 18 | if txt: 19 | Sign(dict(txt=str(txt))).upsert(dict(id=int(user_id))) 20 | 21 | 22 | @staticmethod 23 | def by_user_id(user_id): 24 | s = Sign.find_one(dict(id=int(user_id))) 25 | return s.txt if s else "" 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /z42/css/_lib/page.css: -------------------------------------------------------------------------------- 1 | 2 | .page{ 3 | font-size:15px; 4 | color: #444; 5 | line-height:150%; 6 | text-align:left; 7 | } 8 | .page a,.page span{ 9 | padding:0 8px 2px; 10 | line-height:27px; 11 | /*margin:3px 10px;*/ 12 | margin:1px 3px; 13 | text-decoration:none; 14 | display:inline-block; 15 | color:#444; 16 | } 17 | .page a:hover{ 18 | padding-bottom:2px; 19 | border-bottom:2px solid #d20; 20 | color:#d20; 21 | } 22 | .page span{ 23 | color:#ccc; 24 | } 25 | .page .now{ 26 | color:#000; 27 | border-bottom:2px solid #01A; 28 | } 29 | .page .pgt{ 30 | padding-right:0; 31 | } 32 | .page .plt{ 33 | padding-left:0; 34 | } 35 | -------------------------------------------------------------------------------- /z42/static/css/_lib/imgareaselect/imgareaselect-default.css: -------------------------------------------------------------------------------- 1 | /* 2 | * imgAreaSelect default style 3 | */ 4 | 5 | 6 | .imgareaselect-border1, .imgareaselect-border2, 7 | .imgareaselect-border3, .imgareaselect-border4 { 8 | filter: alpha(opacity=50); 9 | opacity: 0.5; 10 | } 11 | 12 | .imgareaselect-handle { 13 | background-color: #fff; 14 | border: solid 1px #000; 15 | filter: alpha(opacity=50); 16 | opacity: 0.5; 17 | } 18 | 19 | .imgareaselect-outer { 20 | background-color: #000; 21 | filter: alpha(opacity=50); 22 | opacity: 0.5; 23 | } 24 | 25 | .imgareaselect-selection { 26 | } 27 | -------------------------------------------------------------------------------- /socket_programming/0_blocking_socket_http.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import time 3 | 4 | 5 | def get(path): 6 | s = socket.socket() 7 | s.connect(('localhost', 5000)) 8 | 9 | request = 'GET {} HTTP/1.0\r\n\r\n'.format(path) 10 | s.send(request.encode()) 11 | 12 | chunks = [] 13 | while True: 14 | chunk = s.recv(1000) 15 | if chunk: 16 | chunks.append(chunk) 17 | else: 18 | body = (b''.join(chunks)).decode() 19 | print(body) 20 | return 21 | 22 | 23 | start = time.time() 24 | get('/1') 25 | get('/2') 26 | print(time.time() - start) 27 | -------------------------------------------------------------------------------- /z42/static/css/_lib/page.css: -------------------------------------------------------------------------------- 1 | 2 | .page{ 3 | font-size:15px; 4 | color: #444; 5 | line-height:150%; 6 | text-align:left; 7 | } 8 | .page a,.page span{ 9 | padding:0 8px 2px; 10 | line-height:27px; 11 | /*margin:3px 10px;*/ 12 | margin:1px 3px; 13 | text-decoration:none; 14 | display:inline-block; 15 | color:#444; 16 | } 17 | .page a:hover{ 18 | padding-bottom:2px; 19 | border-bottom:2px solid #d20; 20 | color:#d20; 21 | } 22 | .page span{ 23 | color:#ccc; 24 | } 25 | .page .now{ 26 | color:#000; 27 | border-bottom:2px solid #01A; 28 | } 29 | .page .pgt{ 30 | padding-right:0; 31 | } 32 | .page .plt{ 33 | padding-left:0; 34 | } 35 | -------------------------------------------------------------------------------- /socket_programming/tornado_server.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding:utf-8 -*- 3 | 4 | import random 5 | 6 | import tornado 7 | from tornado.web import RequestHandler 8 | 9 | 10 | class SleepHandler(RequestHandler): 11 | 12 | @tornado.gen.coroutine 13 | def get(self, name): 14 | yield tornado.gen.sleep(1) 15 | return name 16 | 17 | 18 | app = tornado.web.Application( 19 | [ 20 | (r'/(.*)', SleepHandler) 21 | ], debug=True 22 | ) 23 | 24 | 25 | app.listen(5000) 26 | try: 27 | tornado.ioloop.IOLoop.current().start() 28 | except: 29 | tornado.ioloop.IOLoop.current().stop() 30 | -------------------------------------------------------------------------------- /z42/z42/web/sms/smsbao.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | #coding:utf-8 3 | import _env 4 | from urllib import urlencode 5 | import urllib2 6 | import logging 7 | from z42.config import SMSBAO 8 | 9 | def sms_new(code, phone, txt): 10 | code = int(code) 11 | data = { 12 | 'u': SMSBAO.USER, 13 | 'p': SMSBAO.PASSWORD, 14 | 'm': phone, 15 | 'c': txt, 16 | } 17 | url = 'http://www.smsbao.com/sms?%s' % urlencode(data) 18 | urllib2.urlopen(url, timeout=60) 19 | 20 | if __name__ == "__main__": 21 | pass 22 | sms_new("86", 13693622296 , "长生") 23 | sms_new("86", 18610542503 , "长生") 24 | -------------------------------------------------------------------------------- /z42/js/init.js: -------------------------------------------------------------------------------- 1 | function LOAD(js){ document.write('