Skip to content

Instantly share code, notes, and snippets.

View chenzhangyu's full-sized avatar
🎯
Focusing

Zhangyu Chen chenzhangyu

🎯
Focusing
View GitHub Profile
@chenzhangyu
chenzhangyu / C++随手记.md
Last active August 29, 2015 14:09
记录平时的一些C++的坑...

对 typedef 可能产生的错误理解:

typedef char *pstring;
const pstring cstr = 0; // cstr is a constant pointer to char
const pstring *ps; // ps is a pointer to a constant pointer to char

其中第二句是否等同于:

@lbolla
lbolla / futures_test.py
Last active September 5, 2025 08:01
Tornado and concurrent.futures
from concurrent.futures import ThreadPoolExecutor
from functools import partial, wraps
import time
import tornado.ioloop
import tornado.web
EXECUTOR = ThreadPoolExecutor(max_workers=4)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active October 18, 2025 07:55
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@methane
methane / gist:2185380
Created March 24, 2012 17:28
Tornado Example: Delegating an blocking task to a worker thread pool from an asynchronous request handler
from time import sleep
from tornado.httpserver import HTTPServer
from tornado.ioloop import IOLoop
from tornado.web import Application, asynchronous, RequestHandler
from multiprocessing.pool import ThreadPool
_workers = ThreadPool(10)
def run_background(func, callback, args=(), kwds={}):
def _callback(result):
anonymous
anonymous / log_test11.py
Created November 19, 2011 22:15
Test script showing usage of a buffering SMTP handler.
#!/usr/bin/env python
#
# Copyright 2001-2002 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of Vinay Sajip
# not be used in advertising or publicity pertaining to distribution