Skip to content

Instantly share code, notes, and snippets.

View robinfang's full-sized avatar
🐌
人都麻了

robinfang robinfang

🐌
人都麻了
View GitHub Profile
@robinfang
robinfang / paseincmd.ahk
Created November 29, 2014 03:38
ahk脚本,cmd中鼠标中键粘贴
#IfWinActive ahk_class ConsoleWindowClass
$*MButton::
SendInput {Raw}%clipboard%
return
#IfWinActive
#coding=utf-8
from igraph import *
from sets import Set
import random
import copy
import math
def diffusion(g, beta=0.2, origin=0, timeLength=4040):
print "beta:%f, origin:%d" % (beta,origin)
lastNewSet = Set() # set of newly infected nodes in last timestep
currentNewSet = Set() # set of newly infected nodes in current timestep
set nocompatible
set encoding=utf-8
set termencoding=utf-8
set fileencoding=utf-8
set fileencodings=ucs-bom,utf-8,chinese,cp936
set nu
set ts=4
set expandtab
set autoindent
set shiftwidth=4
@robinfang
robinfang / diffusion_g.py
Last active August 29, 2015 14:09
传播模拟
#coding=utf-8
import diffusion_i as dfi
import numpy as np
import pylab as pl
from igraph import *
def countN(g,beta,times):
count = []
for i in xrange(times):
result = dfi.diffusion(g=g,beta=beta)
print('.'),
@robinfang
robinfang / matlab_plot.m
Last active August 29, 2015 14:08
一些matlab脚本
% pagerank
A=[0.0166666666666667,0.466666666666667,0.0166666666666667,0.0166666666666667,0.166666666666667,0.0166666666666667;0.466666666666667,0.0166666666666667,0.916666666666667,0.0166666666666667,0.166666666666667,0.0166666666666667;0.466666666666667,0.466666666666667,0.0166666666666667,0.316666666666667,0.166666666666667,0.0166666666666667;0.0166666666666667,0.0166666666666667,0.0166666666666667,0.0166666666666667,0.166666666666667,0.466666666666667;0.0166666666666667,0.0166666666666667,0.0166666666666667,0.316666666666667,0.166666666666667,0.466666666666667;0.0166666666666667,0.0166666666666667,0.0166666666666667,0.316666666666667,0.166666666666667,0.0166666666666667;]
P0=[0.166666666666667;0.166666666666667;0.166666666666667;0.166666666666667;0.166666666666667;0.166666666666667;]
r(:,1)=P0
for i = 1:50
r(:,i+1) = A^i*P0
end
x = [1:51]
plot(x,r,'DisplayName','r vs.x','XDataSource','x','YDataSource','r');figure(gcf)
% ----
select c from (SELECT count(*) as c, weibo.uid FROM demo.weibo join user on weibo.uid = user.uid group by weibo.uid order by c desc) as temp where c > 5;
select * from pond.userrelation ur left join user u on ur.tuid = u.uid where u.uid is null;
alter table userrelation add constraint fk_userrelation_tuid foreign key (tuid) references user(uid);

##可能涉及的东西 Java html css js 数据库 Python ##版本与开发环境 Java版本:1.7
开发环境:Eclipse IDE for Java EE Developers,版本代号Luna ##学习方式 不限,自学为主,有问题可以问。 ##学习过程:

@robinfang
robinfang / PostIndexer.java
Created September 9, 2014 17:45
lucene 4.10 basic indexer
package hpcde;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import org.apache.lucene.analysis.Analyzer;
@robinfang
robinfang / PostSearcher.java
Last active August 29, 2015 14:06
lucene 4.10 basic searcher
package hpcde;
import java.io.File;
import java.io.IOException;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;