Skip to content

Instantly share code, notes, and snippets.

@satomacoto
satomacoto / yahoo_keiba.py
Created June 27, 2012 02:59
競馬 - Yahoo!スポーツ
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
from subprocess import *
import urllib2,re,math
from BeautifulSoup import BeautifulSoup
def get_races(url,r=10):
@satomacoto
satomacoto / label_propagation.py
Created July 4, 2012 06:24
label propagation
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from scipy.sparse import dok_matrix, dia_matrix, identity
from scipy.sparse.linalg import spsolve
# ネットワークの構造
# ノードiとノードjの間にリンクがあるときW[i,j]=1
W = dok_matrix((10,10))
W[0,2] = W[2,0] = 1
@satomacoto
satomacoto / AttachLabelsToPoints.bas
Created July 20, 2012 08:20
Excelの散布図にラベルをつける AttachLabelsToPoints
Sub AttachLabelsToPoints()
'Dimension variables.
Dim RCounter As Integer, CCounter As Integer, xVals As String
'Disable screen updating while the subroutine is run.
Application.ScreenUpdating = False
'Store the formula for the first series in "xVals".
xVals = ActiveChart.SeriesCollection(1).Formula
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello world!</title>
</head>
<body>
<h1>Hello world!</h1>
<p>hogehoge</p>
</body>
@satomacoto
satomacoto / labeledarrow.html
Created August 18, 2012 06:56
labeled arrow w/ D3.js
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="http://d3js.org/d3.v2.js"></script>
<style>
line.arrow {
stroke: #666;
@satomacoto
satomacoto / nx_karate.py
Created September 6, 2012 06:03
NetworkX
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import networkx as nx
import numpy as np
import matplotlib.pyplot as plt
# Zachary's Karate Club graph
G = nx.karate_club_graph()
@satomacoto
satomacoto / gist_import.html
Last active October 10, 2015 08:28
BloggerでGistのファイルをAPIで取得して表示させる
<h1 id="gist_120907_description" style="font-weight:300;">Loading...</h1>
<iframe id="gist_120907_hello_html" marginwidth="0" marginheight="0" scrolling="no" style="border:solid 1px #ccc; display:inline; margin:0px; position:static; width:400px; height:300px;"></iframe>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
var id = '3347397';
var filename = 'hello.html';
$.ajax({
type: 'GET',
@satomacoto
satomacoto / app.yaml
Created October 24, 2012 09:48
aozoramakura
application: aozoramakura
version: 1
runtime: python
api_version: 1
handlers:
- url: /post_update
script: app.py
login: admin
@satomacoto
satomacoto / ekf.py
Created November 3, 2012 16:01
ekf
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import scipy as sp
from scipy.optimize.slsqp import approx_jacobian
import matplotlib.pyplot as plt
def main():
# 初期化
@satomacoto
satomacoto / lkf.py
Last active August 2, 2016 10:09
lkf
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
def lkf(T, Y, U, mu0, Sigma0, A, B, C, Q, R):
'''Linear Kalman Filter
- 状態方程式