Skip to content

Instantly share code, notes, and snippets.

facert

Block or report user

Report or block facert

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
View Dtinyurl api docs
1. Create new tiny url
```
curl -i -X POST -H "Content-Type:application/json" -d '{"url": "http://example.com"}' 'http://t.bdaily.club'
Response:
{
"msg": "ok",
"data": {
"tiny_url": "http://t.bdaily.club/ssddz",
View simplehttpserver.py
# coding: utf-8
import BaseHTTPServer
class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_FUCK(s):
s.send_response(200)
s.send_header("Content-type", "text/html")
s.end_headers()
s.wfile.write("just a kidding\n")
@facert
facert / knn.py
Created Mar 6, 2017
python k 近邻实现
View knn.py
# coding: utf-8
#########################################
# kNN: k Nearest Neighbors
# Input: newInput: vector to compare to existing dataset (1xN)
# dataSet: size m data set of known vectors (NxM)
# labels: data set labels (1xM vector)
# k: number of neighbors to use for comparison
@facert
facert / cosine_similarity.py
Last active Apr 16, 2019
python 余弦相似度代码示例
View cosine_similarity.py
# coding: utf-8
from math import sqrt
import jieba.analyse
def cut_word(content):
'''
(u'\u65b9\u5e84', 2.4582479479)
(u'\u82b3\u57ce\u56ed', 1.19547675029)
(u'\u53ef\u6708\u4ed8', 1.19547675029)
You can’t perform that action at this time.