Skip to content

Instantly share code, notes, and snippets.

@zfz
zfz / aria2.conf
Last active March 5, 2021 23:55
aria2c scripts
#用户名
#rpc-user=user
#密码
#rpc-passwd=passwd
#上面的认证方式不建议使用,建议使用下面的token方式
#设置加密的密钥
#rpc-secret=token
#允许rpc
enable-rpc=true
#允许所有来源, web界面跨域权限需要
@zfz
zfz / env.sh
Last active January 20, 2016 09:43
MONGO_PATH='/home/dm/mongo_dev/mongodb-linux-x86_64-rhel62-3.2.1'
echo "Add mongo to env..."
export PATH=$MONGO_PATH/bin/:$PATH
@zfz
zfz / requirements.txt
Last active October 29, 2015 06:16 — forked from mrluanma/requirements.txt
Python登录新浪微博,修改后15年10月暂时可用
requests==2.4.3
rsa==3.1.4
@zfz
zfz / trad_to_simple.py
Created October 14, 2015 10:42
繁體字轉簡體字
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#下載以下兩個文件
#zh_wiki.py:https://github.com/skydark/nstools/blob/master/zhtools/zh_wiki.py
#langconv.py:https://github.com/skydark/nstools/blob/master/zhtools/langconv.py
from langconv import Converter
line = u"籃球"
@zfz
zfz / re_zh.py
Last active June 2, 2018 10:55
过滤非中(简繁)日英字符
#!/usr/bin/env python
#-*- coding:utf-8 -*-
import re
regexp = ur"[\u2E80-\u9FFFa-zA-Z0-9]+"
assert re.match(regexp, u"愛美國愛臺灣") != None
assert re.match(regexp, u"打倒土共") != None
assert re.match(regexp, u"fuck GFW 打倒方校长!") != None
#!/usr/bin/env python
#-*-coding: utf-8 -*-
import urllib2
import sys
def load_url(f):
return [line.strip() for line in open(f)]
#http://rubular.com/r/F2OqmFF150
import re
r = """\/\*.*[^*]{0,}\*\/|\/\/.*"""
test_string = """
// my program in C++
#include <iostream>
/** playing around in
#!/bin/bash
unset LANG # deal with "illegal byte sequence" error
for filename in *txt; do
echo $filename
ex $filename "+set ff=unix fileencoding=utf-8" "+x"
done
@zfz
zfz / scheduled.py
Last active August 29, 2015 14:24
schedule decorator
import schedule
import time
def scheduled(t):
def wrapper(func):
schedule.every(7).days.at(t).do(func)
while True:
schedule.run_pending()
time.sleep(1)
@zfz
zfz / reverse_geocoder_example.py
Created April 3, 2015 04:18
A Python library for offline reverse geocoding, https://github.com/thampiman/reverse-geocoder
In [1]: import reverse_geocoder as rg
In [2]: coordinates = (39.99, 116.48),
In [3]: results = rg.search(coordinates)
Loading formatted geocoded file...
In [4]: print results
[{'name': 'Wangjing', 'cc': 'CN', 'lon': '116.47284', 'admin1': 'Beijing', 'admin2': '', 'lat': '39.9933'}]