Skip to content

Instantly share code, notes, and snippets.

@workingenius
workingenius / reflect.py
Created January 13, 2016 12:59 — forked from huyng/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):
@workingenius
workingenius / curry.py
Created September 29, 2017 07:27
curry in python
# -*- coding:utf8 -*-
u"""
函数apply的时候,传入的数据叫做arguments
arguments分为两种传入方式,按位置positional,按关键字keywords
函数define的时候,指定的参数列表叫做params,对这个列表的描述,叫做params spec,简称spec
"""
import inspect
@workingenius
workingenius / retry.py
Created September 29, 2017 12:33
retry in python
# -*- coding:utf8 -*-
from functools import wraps
from time import sleep
from random import random
import logging
from curry import curry
logger = logging.getLogger('retry')
error_logger = logging.getLogger('retry.error')
@workingenius
workingenius / mclip.py
Last active November 28, 2023 15:46
clip vedio clip file in terms of time points
#!/usr/bin/env python
# -*- coding:utf8 -*-
import re
import click
@click.command()
@click.argument('movie')
@click.option('-S', '--split-file', 'split_file')
import thread
def thread_func(cls):
a = cls()
# do something with a ....
def work():
class DefineClass:
pass
print id(DefineClass)