Skip to content

Instantly share code, notes, and snippets.

@chenbo515
chenbo515 / source.c
Created May 25, 2022 15:00
comment counter
/*
*********** DO NOT CHANGE OR COMMIT THIS FILE ***********
Special cases that you'll need to handle.
There are:
- 5 single-line comments
- 23 multiple-line comments
*/
@chenbo515
chenbo515 / trackback.py
Created January 11, 2021 14:07
回溯算法计算学生购买的书籍
import random
import copy
# student_fees 每个学生交的钱
# 每本书的价格
def solve(student_fees, book_nums, book_price):
track = [[] for x in range(len(student_fees))]
result = []
def backtrack(i):
@chenbo515
chenbo515 / SimpleHTTPServerWithUpload.py
Created November 29, 2017 14:24 — forked from UniIsland/SimpleHTTPServerWithUpload.py
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@chenbo515
chenbo515 / fncache.py
Created March 20, 2016 10:21 — forked from kwarrick/fncache.py
Redis-backed LRU cache decorator in Python.
#!/usr/bin/env python
__author__ = 'Kevin Warrick'
__email__ = 'kwarrick@uga.edu'
import cPickle
from functools import wraps
def redis_lru(capacity=5000, slice=slice(None)):
"""
Simple Redis-based LRU cache decorator *.
@chenbo515
chenbo515 / pass_socket.py
Created December 3, 2015 13:39 — forked from josiahcarlson/pass_socket.py
An example of passing a socket between processes using Python's multiprocessing library
'''pass_socket.py
Written September 14, 2012
Released into the public domain.
Works on Python 2.6, 2.7, and may need minor changes for 3+.
'''
import multiprocessing