Skip to content

Instantly share code, notes, and snippets.

View dequn's full-sized avatar

dequn dequn

  • PayPal
  • Shanghai, China
View GitHub Profile
dequn / huginn_wechat_public_subscribers_v2.json
Created August 3, 2019 10:16
View huginn_wechat_public_subscribers_v2.json
"schema_version": 1,
"name": "微信公众号订阅【第二版只有最新的一篇文章】",
"description": "2019.08.03 更新,最新可用",
"source_url": false,
"guid": "a0be876a712baf52fa4270d6b174443a",
"tag_fg_color": "#ffffff",
"tag_bg_color": "#00b050",
"icon": "eye",
"exported_at": "2019-08-03T10:05:30Z",
dequn / huginn_wechat_public_subscribers.json
Created August 1, 2019 08:48
Huginn 微信公众号订阅 scenario
View huginn_wechat_public_subscribers.json
"schema_version": 1,
"name": "微信公众号订阅",
"description": "2019.08.01 更新,最新可用",
"source_url": "",
"guid": "c0be876a712baf52fa4270d6b1744432",
"tag_fg_color": "#ffffff",
"tag_bg_color": "#00b050",
"icon": "eye",
"exported_at": "2019-08-01T08:46:10Z",
dequn /
Last active August 24, 2018 06:09
阿里云短信api url构造
import base64
import datetime
import hashlib
import hmac
import json
import urllib.parse
import uuid
access_key_id = ''
access_secret = ''
dequn / nginx.conf
Created August 17, 2018 08:19 — forked from lciolecki/nginx.conf
Nginx config for django rest framework + angular application
View nginx.conf
server {
listen 80;
listen 443 ssl;
charset utf-8;
client_max_body_size 32M;
root /project/static;
index index.html;
dequn /
Created June 30, 2018 06:36
channel layers subscribe redis and using outside of consumer
def handle(self, *args, **options):
redis = get_redis_connection()
ps = redis.pubsub()
for item in ps.listen():
if item['type'] == 'message':
data = item['data']
equipment_id, return_state = data.decode('ascii').split(':')
# equipment_id is group name
dequn / lsyncd.service
Created May 8, 2018 01:51 — forked from Finkregh/lsyncd.service
systemd-service file for lsyncd
View lsyncd.service
Description=Live Syncing (Mirror) Daemon
#ExecStart=/usr/bin/sh -c 'eval `/usr/bin/lsyncd -nodaemon $LSYNCD_OPTIONS /etc/lsyncd/lsyncd.conf.lua`'
import os
import logging
import logging.handlers
def init_log(log_path, level=logging.INFO, when="D", backup=7,
format="%(levelname)s: %(asctime)s: %(filename)s:%(lineno)d * %(thread)d %(message)s",
datefmt="%m-%d %H:%M:%S"):
init_log - initialize log module
dequn /
Created December 17, 2017 02:03
A custom-file-lock wrapper for fcntl in python
#coding: utf-8
import os
import time
import fcntl
import contextlib
import logging
def open_file(filename, pattern = 'r', timeout = 5):
""" 以加锁的方式读取文件,尝试timeout * 10 次,每次sleep 1秒钟.