This file contains hidden or 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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
a { color: #00c; text-decoration: none; } | |
a:visited { color: #00c; } | |
a:hover { text-decoration: underline; } | |
.clear {clear:both;} | |
.hl { |
This file contains hidden or 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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
a { color: #00c; text-decoration: none; } | |
a:visited { color: #00c; } | |
a:hover { text-decoration: underline; } | |
.clear {clear:both;} | |
#content { |
This file contains hidden or 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
/** | |
* The first commented line is your dabblet’s title | |
*/ | |
a { color: #00c; text-decoration: none; } | |
a:visited { color: #00c; } | |
a:hover { text-decoration: underline; } | |
.clear {clear:both;} | |
#content { |
This file contains hidden or 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 com.google.common.hash.HashFunction; | |
import com.google.common.hash.Hashing; | |
/** | |
* A simple MinHash implementation inspired by https://github.com/jmhodges/minhash | |
* | |
* @author tpeng ([email protected]) | |
*/ | |
public class MinHash { |
This file contains hidden or 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
WindWindows Registry Editor Version 5.00 | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Python] | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore] | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7] | |
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\Help] |
This file contains hidden or 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
# login the Quora and get notifications with unofficial API (http://www.quora.com/Edmond-Lau/Edmond-Laus-Posts/Quora-Extension-API) | |
# tpeng <[email protected]> 2013/1/7 | |
# some references | |
# https://gist.github.com/2341517 | |
# http://www.ruby-doc.org/gems/docs/q/quora-client-0.1.2/Quora/Auth.html | |
# http://stackoverflow.com/questions/10616449/how-to-programmatically-log-in-to-quora-by-java-code | |
import cookielib | |
import json |
This file contains hidden or 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 re | |
import subprocess | |
from urllib2 import urlopen | |
url = 'http://videolectures.net/ecmlpkdd08_carlson_bief/' | |
re_flv = re.compile(r'(flv:[\w/]+)') | |
html = urlopen(url).read() | |
m = re.search(re_flv, html) | |
if m: |
This file contains hidden or 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
def coroutine(func): | |
def start(*args, **kwargs): | |
cr = func(*args, **kwargs) | |
cr.next() | |
return cr | |
return start | |
@coroutine | |
def grep(pattern): |
This file contains hidden or 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
# MDS example from http://www.analytictech.com/networks/mds.htm | |
import numpy as np | |
from sklearn import manifold | |
import matplotlib.pyplot as plt | |
cities = ["BOST", "NY", "DC", "MIAM", "CHIC", "SEAT", "SF", "LA", "DENV"] | |
dis = np.array([[0, 206, 429, 1504, 963, 2976, 3095, 2979, 1949], | |
[206, 0, 233, 1308, 802, 2815, 2934, 2786, 1771], | |
[429, 233, 0, 1075, 671, 2684, 2799, 2631, 1616], | |
[1504, 1308, 1075, 0, 1329, 3273, 3053, 2687, 2037], |
This file contains hidden or 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 re | |
_SPACING_RE = re.compile(ur'\n[\s]+', re.DOTALL) | |
text = "\r\n Grand Hotel, Malahide, County Dublin, Ireland\r\n Tel. +353 1 845 0000 Fax +353 1 816 8225\r\n Email: [email protected]" | |
print _SPACING_RE.sub(u'', text) | |
print _SPACING_RE.sub(u'\n', text) | |
# output on my machine: | |
#Email: [email protected] +353 1 816 8225eland |
OlderNewer