Skip to content

Instantly share code, notes, and snippets.

@hnuzhoulin
hnuzhoulin / nested_reqparse_2.py
Created November 18, 2018 05:01
flask-restful reqparse check nested args,can archive required and allowed
#!/usr/bin/python
#! -*- encoding:utf-8 -*-
# Author: Zhoulin
# FIle: nested_RequestParser
# Description: This method,the nested parser do not support required.
# Created: 2018/11/17 23:54
# Modified:
# 2018/11/17 23:54 :
# ---------------------------------
@hnuzhoulin
hnuzhoulin / nested_reqparse_1.py
Created November 18, 2018 05:01
flask-restful reqparse check nested args
#!/usr/bin/python
#! -*- encoding:utf-8 -*-
# Author: Zhoulin
# FIle: nested_RequestParser
# Description: This method,the nested parser do not support required.
# Created: 2018/11/17 23:54
# Modified:
# 2018/11/17 23:54 :
# ---------------------------------
@hnuzhoulin
hnuzhoulin / gRPC_Response_stream_server.py
Last active November 17, 2018 04:47
gRPC中response是stream类型
from concurrent import futures
import time
import grpc
import apiserver.api.apiserver_pb2 as apiserver_pb2
import apiserver.api.apiserver_pb2_grpc as apiserver_pb2_grpc
_ONE_DAY_IN_SECONDS = 60 * 60 * 24
@hnuzhoulin
hnuzhoulin / polipo_set_up.md
Created November 8, 2018 03:08 — forked from yangwe1/polipo_set_up.md
my polipo conf file

openwrt,用于缓存服务器 其web控制界面位于http://192.168.1.1:8123/polipo/

# polipo daemon configuration
config 'polipo' 'daemon'
	# daemonise polipo (fork in background)
	option 'daemonise' '1'
	# where polipo will store its process pid
	option 'pidFile' '/var/run/polipo.pid'

To install tcptraceroute on Debian/Ubuntu:

$ sudo apt-get install tcptraceroute

To install tcptraceroute on CentOS/REHL, first set up RepoForge on your system, and then:

$ sudo yum install tcptraceroute
@hnuzhoulin
hnuzhoulin / pg_subfolder_splitting.sh
Last active May 29, 2018 12:09 — forked from drakonstein/pg_subfolder_splitting.sh
Split Ceph Filestore OSDs offline
#!/bin/bash
merge_num=-2
split_num=16
while [[ "$(ceph health)" != "HEALTH_OK" ]]; do
sleep 10
done
# Some method to set your ceph.conf file to the subfolder splitting settings you want.
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
__author__ = 'Nisests'
import requests
from bs4 import BeautifulSoup
login_url = 'https://www.packtpub.com/'
accout_url = 'https://www.packtpub.com/account'
@hnuzhoulin
hnuzhoulin / ChineseDate2Datetime.py
Created October 12, 2017 02:42
change chinese date string to datetime object
import re
import datetime
UTIL_CN_NUM = {
u'零': 0,
u'一': 1,
u'二': 2,
u'两': 2,
u'三': 3,
u'四': 4,
@hnuzhoulin
hnuzhoulin / seafile-backup.sh
Created June 6, 2017 07:39 — forked from 3c7/seafile-backup.sh
Seafile backup script
#!/bin/bash
###############################
# Seafile server backup script (cold sqlite backup)
# Author: Nils Kuhnert
# Last change: 2014-07-27
# Website: 3c7.me
###############################
# Variables
DATE=`date +%F`
@hnuzhoulin
hnuzhoulin / seamake.sh
Created June 6, 2017 06:50 — forked from theclanks/seamake.sh
seafile client build
#!/usr/bin/env bash
yum install vala vala-compat wget gcc libevent-devel openssl-devel gtk2-devel libuuid-devel sqlite-devel jansson-devel intltool cmake qt-devel fuse-devel
echo "Building and installing seafile client"
export version=4.2.8 # change this to your preferred version
alias wget='wget --content-disposition -nc'
wget https://github.com/haiwen/libsearpc/archive/v3.0.2.tar.gz
wget https://github.com/haiwen/ccnet/archive/v${version}.tar.gz