View SimpleAuthServer.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import BaseHTTPServer | |
from SimpleHTTPServer import SimpleHTTPRequestHandler | |
import sys | |
import base64 | |
key = "" | |
class AuthHandler(SimpleHTTPRequestHandler): | |
''' Main class to present webpages and authentication. ''' | |
def do_HEAD(self): |
View libevent_multi_worker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <errno.h> | |
#include <assert.h> | |
#include <signal.h> | |
#include <event2/event.h> | |
#include <event2/bufferevent.h> | |
#include <event2/buffer.h> | |
#include <event2/thread.h> |
View README.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
REMIX EXAMPLE PROJECT | |
Remix example project is present when Remix loads very first time or there are no files existing in the File Explorer. | |
It contains 3 directories: | |
1. 'contracts': Holds three contracts with different complexity level, denoted with number prefix in file name. | |
2. 'scripts': Holds two scripts to deploy a contract. It is explained below. | |
3. 'tests': Contains one test file for 'Ballot' contract with unit tests in Solidity. | |
SCRIPTS |
View contracts...Heros.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.2; | |
import "./Erc721.sol"; | |
import "./Utils.sol"; | |
contract WaterMargin is ERC721Enumerable, ReentrancyGuard, Ownable { | |
mapping(uint256 => string) heroNames; | |
uint256 lastTokenId; | |
uint256 seed; |
View gist:5574345
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
import random | |
from numpy import arange | |
#from classification import * | |
from sklearn import metrics | |
from sklearn.datasets import fetch_mldata | |
from sklearn.ensemble import RandomForestClassifier | |
from sklearn.utils import shuffle | |
import time |
View gist:3291755
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//author: Sun, Junyi (weibo.com/treapdb) | |
//usage: node --nouse-idle-notification --expose-gc --max-old-space-size=8192 memcached.js | |
var config ={ | |
port: 11211, | |
max_memory: 300 // default 100M bytes | |
} | |
var net = require('net'); | |
var LRU = function (max) { // this LRU implementaion is based on https://github.com/chriso/lru |
View gist:0a6eb19f15e014b3f287c3e20ab70154
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
from turtle import * | |
N = 5 #how may seats each side | |
Positions = list(range(N*2+1)) | |
Positions[N] = None #empty place | |
AllXY = {N:(100,280)} |
View gist:3244607
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Simple Memcached in Javascript | |
* @Author: Sun, Junyi | |
* @Email: ccnusjy@gmail.com | |
* @Date: 2012-8-3 | |
*/ | |
var net = require('net'); | |
var store = {} | |
function handle_header(header,crlf_len){ | |
var tup = header.split(" ") |
View gist:5598196
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Topic #0: | |
一页 目录 呼延 高太尉 知府 连环 将军 关胜 慕容 徐宁 三路 韩滔 秦明 灼道 汤隆 彭 | |
圯 青州 一匹 摆布 马军 第五十四回 大兴 军马 酒保 出马 | |
Topic #1: | |
华堂 第五 水浒传 才子 书法 一部 史记 子弟 一样 所藏 有序 一篇 依此 丛林 古本 至 | |
于 一百八 文法 只是 饶恕 段落 呜呼 真正 施耐庵 得见 | |
Topic #2: | |
武松 施恩 妇人 叔叔 蒋门神 武二 张青 张都监 武大 嫂嫂 大虫 两个 哨棒 管营 一个 |
View gist:5368803
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi all, | |
I am studying Go, and find that it is very interesting and "battery" included. | |
In this mail, I want to ask something about the garbage collection rules of Go. | |
For example, in the following program. | |
package main |
NewerOlder