Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
# @Author: xuyannis
# @Date: 2017-02-25 12:35:15
# @Last Modified by: xuyannis
# @Last Modified time: 2017-02-25 13:22:54
import numpy as np
from numpy import linalg as la
import pandas as pd
def cosineSimilarity (vec1, vec2):
@yannisxu
yannisxu / dota2_match.json
Last active January 7, 2017 09:20
dota2 比赛数据的 json 格式
{
"engine": 1,
"barracks_status_dire": 63,
"tower_status_radiant": 0,
"match_id": 2887679385,
"lobby_name": "Public matchmaking",
"start_time": 1483302173,
"match_seq_num": 2518934190,
"barracks_status_radiant": 0,
"cluster": 224,
@yannisxu
yannisxu / proxy.sh
Last active April 24, 2016 10:57
修改 Mac 网络自动代理配置
alias pacon='sudo networksetup -setautoproxyurl Wi-Fi https://yourproxy.pac'
alias pacoff='sudo networksetup -setautoproxyurl Wi-Fi off'
@yannisxu
yannisxu / read_line_by_line.js
Created December 4, 2014 17:17
read file line by line in nodejs
var fs = require('fs'),
readline = require('readline');
var rd = readline.createInterface({
input: fs.createReadStream('demo.txt'),
output: process.stdout,
terminal: false
});
rd.on('line', function(line) {
@yannisxu
yannisxu / javascriptDownload
Created November 28, 2014 03:12
js download file
var downloadURL = function downloadURL(url) {
var hiddenIFrameID = 'hiddenDownloader',
iframe = document.getElementById(hiddenIFrameID);
if (iframe === null) {
iframe = document.createElement('iframe');
iframe.id = hiddenIFrameID;
iframe.style.display = 'none';
document.body.appendChild(iframe);
}
iframe.src = url;
@yannisxu
yannisxu / httpGet
Created November 28, 2014 03:09
javascript get
function httpGet(theUrl)
{
var xmlHttp = null;
xmlHttp = new XMLHttpRequest();
xmlHttp.open( "GET", theUrl, false );
xmlHttp.send( null );
return xmlHttp.responseText;
}
@yannisxu
yannisxu / cVimrc
Last active January 4, 2016 12:57
cVimrc
set nosmoothscroll
let scrollduration = 10
let scrollstep = 70
let blacklists = ["https://fengcheco.com/*","https://inbox.google.com/*","https://en.todoist.com/*","https://todoist.com/*"]
" Code blocks (see below for more info)
getIP() -> {{
httpRequest({url: 'http://api.ipify.org/?format=json', json: true},
@yannisxu
yannisxu / alias_command
Created November 8, 2014 04:33
mac osx alias
#mysql start
alias mysqlstart='sudo /usr/local/mysql/support-files/mysql.server start'
alias mysqlstop='sudo /usr/local/mysql/support-files/mysql.server stop'
wget -np -nH -r --span-hosts www.xxx.org/pub/path/
# update 2014-06-19 18:51
# Section Start: dropbox
108.160.166.62 dropbox.com
108.160.165.62 dropbox.com
205.251.196.138 dropbox.com
108.160.166.20 www.dropbox.com
108.160.167.204 www.dropbox.com
108.160.166.13 www.dropbox.com
108.160.165.147 www.dropbox.com
108.160.167.208 www.dropbox.com