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
# Back-Propagation Neural Networks | |
# | |
# Written in Python. See http://www.python.org/ | |
# Modified by JSun to solve the problem here: http://www.weibo.com/1497035431/ynPEvC78V | |
# Neil Schemenauer <nas@arctrix.com> | |
import math | |
import random | |
import string |
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
# Back-Propagation Neural Networks | |
# another way: solve it as a Regression Problem | |
# Written in Python. See http://www.python.org/ | |
# Modified by JSun to solve the problem here: http://www.weibo.com/1497035431/ynPEvC78V | |
# Neil Schemenauer <nas@arctrix.com> | |
import math | |
import random | |
import string |
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
#!/usr/bin/env python | |
# Problem: http://www.weibo.com/2090476735/ynJtWvN1K | |
# junyi sun (weibo.com/treapdb) | |
from numpy import * | |
def Q(L): | |
H = [0]*11 | |
H[0] = 1 #bias item | |
for x in L: | |
H[x+1]+=1 |
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
var http=require('http') | |
url =require("url") | |
var cluster = require('cluster'); | |
if (cluster.isMaster) { | |
// Fork workers. | |
for (var i = 0; i < 20; i++) { | |
cluster.fork(); | |
} |
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 random | |
import time | |
size=100000000 | |
t1 = time.time() | |
f=open('x.db','wb') | |
f.write('x'*size) | |
f.close() | |
print 'write:', time.time()-t1 | |
f=open('x.db','rb') | |
t2=time.time() |
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(" ") |
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 |
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
var QBuffer = exports.QBuffer= function(){ | |
this.list = [] | |
this.length = 0 | |
} | |
QBuffer.prototype.append=function(chunk){ | |
this.list.push(chunk) | |
this.length += chunk.length | |
} |
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
package main | |
import ( | |
"net" | |
"log" | |
"fmt" | |
"bufio" | |
"strings" | |
"strconv" | |
"io" |
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
package main | |
import ( | |
"net/http" | |
"net/url" | |
"log" | |
"io/ioutil" | |
"regexp" | |
"fmt" | |
//"net/http/httputil" |
OlderNewer