This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
domain,count | |
portal.nifty.com,303 | |
trafficnews.jp,277 | |
kabumatome.doorblog.jp,196 | |
blog.livedoor.jp/vitaminw,125 | |
honz.jp,77 | |
mag.japaaan.com,69 | |
dhanow.ldblog.jp,66 | |
reki.hatenablog.com,52 | |
delete-all.hatenablog.com,52 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import csv | |
import networkx as nx | |
g = nx.read_pajek("russians.net") | |
f = open("nodes.csv", "w") | |
writer = csv.writer(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
import networkx as nx | |
import py2neo | |
g = nx.read_gml("netscience.gml") | |
db = py2neo.Graph("http://192.168.33.11:7474/db/data") | |
db.delete_all() | |
for n, data in g.nodes(data=True): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATCH (n) WITH count(n) AS ncount MATCH (m)-[r:COAUTH]-(b) RETURN m, toFloat(count(r)) / ncount AS d ORDER BY d DESC LIMIT 100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from pyquery import PyQuery as pq | |
doc = pq("http://www.hatena.ne.jp/") | |
for box in doc.items("div#p2 div.box"): | |
category = box.attr("class").split(" ")[0] | |
print("[{}]".format(category)) | |
for li in box.items("li.js-bookmark-item"): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def func(ll): | |
ave_ll = 1.0 * sum(ll) / len(ll) | |
sum_ll = 1.0 * sum([abs(i - j) for i in ll for j in ll]) | |
md = sum_ll / (len(ll) ** 2) | |
gini = sum_ll / (2 * (len(ll) ** 2) * ave_ll) | |
print("Mean difference: {}".format(md)) | |
print("Gini coefficient: {}".format(gini)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from abc import ABCMeta, abstractmethod | |
class Banner(object): | |
def __init__(self, string): | |
self.__string = string | |
def show_with_paren(self): | |
print("(" + self.__string + ")") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
from abc import ABCMeta, abstractmethod | |
class Aggregate(object, metaclass=ABCMeta): | |
@abstractmethod | |
def iterator(self): | |
pass | |
class Iterator(object, metaclass=ABCMeta): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<source> | |
type tail | |
format apache | |
time_format %d/%b/%Y:%T %z | |
path /var/log/nginx/access.log | |
pos_file /var/log/td-agent/nginx.access.pos | |
tag nginx.access | |
</source> | |
<match nginx.access> |
NewerOlder