Skip to content

Instantly share code, notes, and snippets.

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

robinfang robinfang

🐌
人都麻了
View GitHub Profile
@robinfang
robinfang / t2s.py
Last active October 7, 2015 06:18
转换时间序列
import pandas as pd
import sys
if __name__ == "__main__":
print sys.argv[0]
print sys.argv[1]
# print sys.argv[2]
if not len(sys.argv)==2:
print "usage: python t2s.py"
sys.exit()
#coding=utf-8
import datetime
import codecs
if __name__ == "__main__":
result = []
l4 = []
f = codecs.open("3638347916812769_retweets_id_text_time.txt",encoding="utf-8")
rootId = "3638347916812769_retweets"
l = f.readlines()
@robinfang
robinfang / graph.sh
Created March 10, 2015 07:04
对应数据集http://strict.dista.uninsubria.it/?p=364 将形如6018932 78569316,214680621,1780528处理成6018932,78569316\n6018932,214680621
cat graph2009.txt |awk -F '[\t,]' '{for(i=2;i<=NF;i++)printf "%d,%d\n",$1,$i}' > g2009.txt
# 查看flash大小
dmesg |grep spi
# 查看ram大小
cat /proc/meminfo
^(?!#)\S
0,0.154809919797,107
1,0.228287956083,315
2,0.19198364525,0
3,0.315938338416,280
4,0.35699725512,328
5,0.72111832494,315
6,0.282519582448,95
7,0.311267913269,322
8,0.515471921796,201
9,0.263237627761,185
0,0.35576102242,189
1,0.559566798778,88
2,0.794561501505,0
3,0.595558671342,323
4,0.417838973942,0
5,0.972616881912,156
6,0.566599989337,0
7,0.696754701701,213
8,0.484723354854,0
9,0.537928726461,231
@robinfang
robinfang / rresult
Created January 4, 2015 11:01
as_ic模型一次传播结果
(1000, 0, -1)
(835, 0.051563364643194, 1000)
(361, 0.0702508457330101, 835)
(1060, 0.08227877018317253, 835)
(416, 0.0837444471268659, 835)
(107, 0.0841415403067276, 1060)
(957, 0.0842458583415494, 107)
(1367, 0.08685428882957202, 361)
(439, 0.08865879497714191, 107)
(515, 0.08938792757419567, 439)
cat 12306.txt|gawk -F '----' '{print $2}'|sort|uniq -c|sort -r|head
@robinfang
robinfang / send_udp.py
Last active August 29, 2015 14:10
发送udp广播到局域网
from socket import *
cs = socket(AF_INET, SOCK_DGRAM)
cs.bind(("10.22.13.19",54545)) # http://is.gd/73aRUm for detail
cs.setsockopt(SOL_SOCKET, SO_BROADCAST, 1)
cs.sendto('This is a test', ('255.255.255.255', 54545))
# tcpdump http://is.gd/gw2OBN