Skip to content

Instantly share code, notes, and snippets.

worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
import os
from uliweb import manage, models
from uliweb.manage import make_simple_application
os.chdir('demo')
manage.call('uliweb syncdb -v')
manage.call('uliweb dbinit -v')
def test_apijson_get():
@zhangchunlin
zhangchunlin / updatentp.py
Created September 8, 2018 06:56
ntp windows
import os
import time
import ntplib
c = ntplib.NTPClient()
response = c.request('pool.ntp.org')
ts = response.tx_time
_date = time.strftime('%Y-%m-%d',time.localtime(ts))
_time = time.strftime('%X',time.localtime(ts))
os.system('date {} && time {}'.format(_date,_time))
@zhangchunlin
zhangchunlin / batch_qpdf.py
Last active September 16, 2022 15:15
batch_qpdf.py 批量移除 pdf 密码脚本,batch remove pdf password
#!/usr/bin/env python
#coding=utf-8
from __future__ import print_function
import os
import sys
def main():
dpath_in = os.path.expanduser(r"~/1del/")
dpath_out = os.path.expanduser(r"~/1delt/")
@zhangchunlin
zhangchunlin / vuejs_in_uliweb.html
Last active January 5, 2018 14:16
vuejs in uliweb
{{use "ui.vue"}}
<div id="app">
</div>
<script>
var app = new Vue({
el: '#app',
data: {
@zhangchunlin
zhangchunlin / command.py
Created January 3, 2018 10:09
python command line file template
#!/usr/bin/env python
from __future__ import print_function
def main():
pass
if __name__=='__main__':
main()
@zhangchunlin
zhangchunlin / emojis.json
Created December 18, 2017 02:42 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family_mothers_two_girls", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family_mothers_children", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family_mothers_two_boys", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family_two_girls", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👦", "name": "family_children", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👦‍👦", "name": "family_two_biys", "shortname": "", "unicode": "", "html": "&#128104;&zw
from subprocess import Popen, PIPE, STDOUT
import os
def runcmd(cwd,cmd):
oldcwd = os.getcwd()
os.chdir(cwd)
runcmd_timeout = 3600
p = Popen(cmd,stdout=PIPE,stderr=STDOUT,shell=True,preexec_fn=os.setpgrp)
p.wait(runcmd_timeout)
if p.returncode==None:
@zhangchunlin
zhangchunlin / nginx.conf
Created May 9, 2017 23:42
nginx.conf , openresty, redirect, ip
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 6699;
location / {
@zhangchunlin
zhangchunlin / time_strftime.py
Last active February 16, 2017 07:31
time and strftime
import time
tstr = time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(time.time()))
print tstr