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
<!DOCTYPE HTML> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>imageScroll</title> | |
</head> | |
<body> | |
</body> | |
<script type="text/javascript"> | |
function $(e) { return document.getElementById(e); } |
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 | |
# -*- coding:utf8 -*- | |
import os | |
import tornado.web | |
from tornado.httpserver import HTTPServer | |
from tornado.ioloop import IOLoop | |
import uuid |
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 | |
def is_cn_char(c): | |
""" | |
Chinese char detecting | |
""" | |
return 0x4e00 <= ord(c) <= 0x9fa5 | |
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
(defn diff [f] | |
(fn [x] | |
(let [dx (/ 1 Integer/MAX_VALUE)] ;nearly 0 | |
(/ (- (apply f [(+ x dx)]) (apply f [x])) dx)))) | |
(defn g [x] ; given function | |
(* x x)) | |
(def dg (diff g)) ; get dg | |
(print (float (dg 3))) ; 6 |
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
(defn F [a b c]; generate the target function | |
(fn [x] | |
(+ (* (+ (* a x) b) x) c))) | |
(def f1 (F 1 2 1)) | |
(defn | |
^{:doc "(Solve f a b) | |
f-- the target function | |
a,b the interval for isolating the root" |
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 python2 | |
#coding:utf-8 | |
import numpy | |
import wave | |
class MainHandler(object): | |
def __init__(self, duration=10, frequency=2000): |
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 python2 | |
#coding:utf-8 | |
import re | |
import time | |
import os | |
import urllib | |
import requests |
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 fs = require('fs'), | |
path = require('path'); | |
exports.walk = function(abspath, callback){ | |
/* | |
* callback will get { dirname: {file1: file1_abs_path, subdir: { fil2: file2_abs_path, subdir2: {}.. }}; | |
* if not callback passed, it just returns a tree like above; | |
*/ |
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 node | |
/* | |
* Author: ibigbug | |
* Language: NodeJS | |
*/ | |
var fs = require('fs'); | |
function Controller(){ // Global Controller |
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 crypto = require('crypto'); | |
function CodeUserName(name) { | |
var md5 = crypto.createHash('md5'); | |
var time = Math.floor((new Date()).getTime() / 1000); | |
time = 1387112383; | |
var timediv5 = Math.floor(time / 5); | |
var timestr = ""; |
OlderNewer