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
create table t1 (id integer primary key, name text, x text); | |
insert into t1 (name, x) values('n1', 'xxx'); | |
insert into t1 (name, x) values('n2', 'xxx'); | |
insert into t1 (name, x) values('n3', 'xxx'); | |
insert into t1 (name, x) values('n4', 'xxx'); | |
create table t2 (id integer primary key, name text); | |
insert into t2 (name) values('_1'); | |
insert into t2 (name) values('_2'); | |
insert into t2 (id, name) values(-1, 'q'); |
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 gunicorn.http.body import Body | |
Body.readable = lambda _: True | |
Body.writable = lambda _: False | |
Body.seekable = lambda _: False | |
Body.closed = False |
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
http://* { | |
webdav | |
gzip | |
log / stderr "{when_iso} {remote} {method} {uri} {proto} {status} {size} {latency} {>Content-Length} {>User-Agent}" | |
#log / stderr "{when_iso} {remote} {method} {uri} {status} {request_body}" | |
} |
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 io | |
import tempfile | |
import urllib.request | |
def open_rb(filename): | |
if filename.startswith("http://") or filename.startswith("https://"): | |
return urllib.request.urlopen(filename) |
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 importlib | |
import sys | |
name = sys.argv[1] | |
if name.endswith(".py"): | |
name = name[:-3].replace("/", ".") | |
if __name__ == '__main__': | |
m = importlib.import_module(name) | |
print(m.main()) |
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 shutil | |
from flask import Flask, Response, request | |
app = Flask(__name__) | |
@app.route('/<path:path>', methods=['GET', 'POST']) | |
def hello(path): |
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
cmd="$1" | |
dir=$(dirname $(realpath $cmd)) | |
$cmd & | |
pyinstaller_ppid="$!" | |
#echo $pyinstaller_ppid | |
#ps -o pid,ppid |
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 sys | |
from string import Template | |
tpl = Template(""" | |
upstream ${name} { | |
server ${name}${port}; | |
keepalive 64; | |
} |
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 sys | |
for line in sys.stdin: | |
print(repr(line)) |
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 gzip | |
with gzip.open(fn, 'rt') as f: | |
for i in f: | |
print(i) |