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
upstream f { | |
server 127.0.0.4:3000; | |
keepalive 16; | |
} | |
server { | |
server_name f.*; | |
root /home/xxxx; | |
location / { | |
proxy_buffering off; |
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 python3 | |
bind = '0.0.0.0:8000' | |
workers = 4 | |
keepalive = 60 | |
timeout = 600 | |
#max_requests = 1000 | |
worker_class = 'tornado' | |
worker_class = 'meinheld.gmeinheld.MeinheldWorker' | |
worker_class = 'gevent' |
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
-- _ 是老数据,想把 t 作为补丁更新至 _ , 参考下面 | |
-- 执行速度只和 t 的数据量有关,和目标 _ 数据量关系不大(索引),t 数据量有 100W 时,2秒搞定 | |
select 'edit'; | |
replace into _ (k, v) | |
select t.k, t.v from t inner JOIN _ on t.k=_.k where t.v!=_.v; -- update exists | |
select changes(); | |
select 'new'; | |
insert into _ (k, v) |
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 python3 | |
import re | |
from entities import App, db_session, select | |
pattern = r'Downloaded (\d+) times' | |
def get_downloaded(id): | |
with db_session: |
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 python3 | |
import gzip | |
import io | |
import shutil | |
import falcon | |
''' |
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 urllib.request import urlopen | |
url = "http://mg.bxs.tyio.net/static/logo.png" | |
url = "http://ng.tyio.net" | |
url = "http://google.com" | |
with urlopen(url, timeout=1) as f: | |
print(f.read()) # bytes |
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
.* |
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 collections | |
import math | |
class Grids9: | |
unit_width = 10 | |
unit_height = 10 | |
def __init__(self, w, h): |
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 python3 | |
import asyncio | |
import collections | |
import time | |
import json | |
import pendulum | |
import redis | |
import tornado.web |
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
function clean_junk() { | |
JUNK=$(ps axo pid,ppid,comm | awk '$2==1' | grep $1 | awk '{print $1}') | |
if [ -n "${JUNK}" ]; then | |
echo kill $JUNK | |
kill $JUNK | |
fi | |
} | |
while true; do | |
clean_junk geckodriver |