Skip to content

Instantly share code, notes, and snippets.

@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 / setiptables.py
Created December 23, 2011 09:46
a little python script using to set iptables
#! /usr/bin/env python
#coding=utf-8
#----config part----
INIT_CMDS = ["iptables -F",#clean all
"iptables -X",
"iptables -t nat -F",
"iptables -t nat -X",
"iptables -P INPUT DROP",#forbid all
"iptables -A INPUT -i lo -j ACCEPT"#accept all localhost
@zhangchunlin
zhangchunlin / README.md
Created August 25, 2016 00:59 — forked from ficapy/README.md
代理设置

现在比较主流的方案可能就是SSR+kcptun了,基本上都能流畅看1080P的youtube了。下面讲述如何快速搭建服务端和客户端(主要针对osx和unix,win上有成熟的GUI方案)

服务端

SSR一键安装包(引用自https://www.91yun.org/archives/2079)

wget -N --no-check-certificate https://raw.githubusercontent.com/91yun/shadowsocks_install/master/shadowsocksR.sh && bash shadowsocksR.sh

https://github.com/xtaci/kcptun/releases下载适合自己系统的最新版本tar -xf解压得到server_linux_amd64.执行服务端.摘录文档如下

@zhangchunlin
zhangchunlin / logger_example.py
Last active February 18, 2020 00:49
python snippet
import logging
logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(levelname)s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
log = logging.getLogger(__name__)
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 / 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 / master.py
Created April 1, 2014 03:26
gevent master slave example
#! /usr/bin/env python
#coding=utf-8
import gevent
from gevent.server import StreamServer
from gevent.queue import Queue
import json
def sendmsg2fobj(fobj,msg):
@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()