Skip to content

Instantly share code, notes, and snippets.

Sun Junyi fxsjy

Block or report user

Report or block fxsjy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fxsjy
fxsjy / libevent_multi_worker
Created Jan 20, 2015
libevent multithread worker example
View libevent_multi_worker
#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 gist:5598196
Topic #0:
一页 目录 呼延 高太尉 知府 连环 将军 关胜 慕容 徐宁 三路 韩滔 秦明 灼道 汤隆 彭
圯 青州 一匹 摆布 马军 第五十四回 大兴 军马 酒保 出马
Topic #1:
华堂 第五 水浒传 才子 书法 一部 史记 子弟 一样 所藏 有序 一篇 依此 丛林 古本 至
于 一百八 文法 只是 饶恕 段落 呜呼 真正 施耐庵 得见
Topic #2:
武松 施恩 妇人 叔叔 蒋门神 武二 张青 张都监 武大 嫂嫂 大虫 两个 哨棒 管营 一个
@fxsjy
fxsjy / gist:5574345
Last active Jul 18, 2019
mnist with sklearn
View gist:5574345
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
@fxsjy
fxsjy / SimpleAuthServer.py
Created Apr 26, 2013
SimpleAuthServer: A SimpleHTTPServer with authentication
View SimpleAuthServer.py
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):
@fxsjy
fxsjy / gist:5368803
Created Apr 12, 2013
Memory Leak of Golang
View gist:5368803
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
@fxsjy
fxsjy / find_nth_int.py
Created Sep 12, 2012 — forked from yongsun/find_nth_int.py
find nth integer in distributed env
View find_nth_int.py
#!/usr/bin/python
import numpy.random as random
from bisect import bisect_left, bisect_right
class SlaveNode:
def __init__ (self, data):
self.data = sorted(data)
def get_range (self):
@fxsjy
fxsjy / gist:3550053
Created Aug 31, 2012
Bakup Weibo to Disk
View gist:3550053
package main
import (
"net/http"
"net/url"
"log"
"io/ioutil"
"regexp"
"fmt"
//"net/http/httputil"
@fxsjy
fxsjy / gist:3550052
Created Aug 31, 2012
Bakup Weibo to Disk
View gist:3550052
package main
import (
"net/http"
"net/url"
"log"
"io/ioutil"
"regexp"
"fmt"
//"net/http/httputil"
@fxsjy
fxsjy / gist:3377100
Created Aug 17, 2012
Memcached Server Written in Go, only 70 lines of code
View gist:3377100
package main
import (
"net"
"log"
"fmt"
"bufio"
"strings"
"strconv"
"io"
@fxsjy
fxsjy / gist:3293029
Created Aug 8, 2012
QBuffer: A little buffer tool for Node.JS
View gist:3293029
var QBuffer = exports.QBuffer= function(){
this.list = []
this.length = 0
}
QBuffer.prototype.append=function(chunk){
this.list.push(chunk)
this.length += chunk.length
}
You can’t perform that action at this time.