Skip to content

Instantly share code, notes, and snippets.

@hongo35
hongo35 / .block
Created March 13, 2017 04:00
都道府県別 人口の推移
license: mit
library(ggplot2)
library(scales)
# データの読み込み
data <- read.csv("/path/to/activities.csv", header=T)
# 基本統計量
summary(data$steps)
# グラフ(日ごとの推移)
require 'withings'
require 'time'
include Withings
Withings.consumer_key = <CONSUMER KEY>
Withings.consumer_secret = <CONSUMER SECRET>
user_id = <USER ID>
access_token = <ACCESS TOKEN>
access_token_secret = <ACCESS_TOKEN_SECRET>
require 'uri'
require 'net/http'
url = "http://amzn.to/hoge"
uri = URI.parse(url)
expanded_uri = Net::HTTP.new(uri.host, uri.port).get(uri.path).header['location']
@hongo35
hongo35 / tw_pagerank.rb
Last active December 30, 2015 14:09
Calculate pagerank of twitter follow network.
#!/usr/bin/env ruby
$:.unshift(File.dirname(__FILE__))
require 'twitter'
require 'mysql2-cs-bind'
require 'yaml'
require 'pagerank'
# parameter
DUMPING_FACTOR = 0.85
@hongo35
hongo35 / pagerank.rb
Last active October 4, 2019 11:14
PageRank algorithm implemented in ruby.
#!/usr/bin/env ruby
class PageRank
#parameter
EPS = 0.00001
def initialize(matrix)
@dim = matrix.size
@p = []
<!DOCTYPE html>
<html lang='ja'>
<head>
<meta charset='utf-8' />
<title>D3.js</title>
</head>
<body>
<script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
<script type='text/javascript'>
window.onload = function(){
@hongo35
hongo35 / cnn.rb
Last active December 20, 2015 17:48
require 'json'
class CNN
#parameter
P = 0.75
REPEAT = 200
def initialize
@nodes = [{"name" => 0}]
@links = []