Skip to content

Instantly share code, notes, and snippets.

View zhuangzhuang's full-sized avatar

zhuangzhuang zhuangzhuang

  • N/A
  • China
View GitHub Profile
@zhuangzhuang
zhuangzhuang / country_colour.fsx
Created December 16, 2022 09:23
简单图作色
// 简单图作色
type Country = string
type Map = (Country * Country) list
type Colour = Country list
type Colouring = Colour list
let rec isMember x =
function
@zhuangzhuang
zhuangzhuang / web-servers.md
Created October 8, 2020 10:38 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
class Rational {
readonly number: number
readonly denom: number
// -------------- public ----------
constructor(n: number, d: number){
this.number = n
this.denom = d
}
add(that): Rational{
@zhuangzhuang
zhuangzhuang / pass vs return.py
Created February 3, 2017 05:32
python中函数返回
Python 2.7.9 Stackless 3.1b3 060516 (default, Feb 21 2015, 11:54:09) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.
IPython 5.1.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: def foo(): return
do
{
Wait4GetToken(appRequest->localQueue);
if((pack.headPackage.curNum%100==1)||(pack.headPackage.curNum%100==50))
printf("appNum:%d\tfileNum:%d\tcurNum:%d\n", pack.headPackage.appid, pack.headPackage.fileNum, pack.headPackage.curNum);
send(sendSocket, (char*)&pack, (sizeof(pack.headPackage) + pack.headPackage.curLen), 0);
memset(&pack, 0, sizeof(PACKAGE));
_FILL_PACKAGE_HEAD(pack, appRequest, appRequest->fileNum+sendRound, type_NORMALPACKAGE, curPackSerial);
unsigned long byteRead = fread(pack.u1.contPackage.buffer, sizeof(char), BLOCK_SIZE, filp);
pack.headPackage.curLen = byteRead;