Skip to content

Instantly share code, notes, and snippets.

View piyo7's full-sized avatar

Takatomo Torigoe piyo7

View GitHub Profile
@piyo7
piyo7 / file0.html
Last active November 6, 2015 05:34
Nightmareで郵便局から住所をスクレイピング ref: http://qiita.com/piyo7/items/d771559c0fb1386f1ffa
<tr>
<td class="data"><small>100-0001</small></td>
<td class="data"><small>東京都</small></td>
<td class="data"><small>千代田区</small></td>
<td>
<div class="data">
<p><small><a href="zipcode.php?pref=13&city=1131010&id=46366&merge=">千代田</a></small></p>
<p class="comment"><small>チヨダ</small></p>
</div>
</td>
@piyo7
piyo7 / file0.txt
Created September 29, 2015 00:45
Gitにリリースタグを打つRakeタスク ref: http://qiita.com/piyo7/items/eee68999d5f74a2266ce
require "open3"
require "time"
task :add_release_tag do
day = Time.now.strftime("%Y%m%d")
ver = 0
tag = "#{day}.#{ver}"
while Open3.capture3("git show #{tag}")[2].exitstatus == 0
ver += 1
tag = "#{day}.#{ver}"
@piyo7
piyo7 / file0.scala
Last active August 29, 2015 14:20
ディープラーニング勉強会 AutoEncoder ref: http://qiita.com/piyo7/items/60576759430910ffe5be
import scala.math
import scala.util.Random
import MatrixImplicits._ // 自作のimplicit classによるSeqラッパ
class dA(train_N: Int, n_visible: Int, n_hidden: Int, seed: Int) {
val rng = new Random(seed)
var W = Seq.fill(n_hidden, n_visible)(uniform(-1.0 / n_visible, 1.0 / n_visible))
var hbias = Seq.fill(n_hidden)(0.0)
var vbias = Seq.fill(n_visible)(0.0)
@piyo7
piyo7 / file0.cpp
Last active August 29, 2015 14:19
出力ストリームに区切り文字を自動で挿入する ref: http://qiita.com/piyo7/items/a8aefda160e997a7349b
for (size_t i = 1; i < 10; i++) {
std::cout
<< "[csv] "
<< i
<< ", " << std::string(i, 'x')
<< ", " << std::boolalpha << (i % 2 == 0)
<< "\n";
}
@piyo7
piyo7 / app.coffee
Last active August 29, 2015 14:17
CoffeeScriptでMapboxことはじめ ref: http://qiita.com/piyo7/items/dd5dcc7d750d5b3b6507
L.mapbox.accessToken = '<your access token here>'
# MIT-licensed code by Benjamin Becquet
# https://github.com/bbecquet/Leaflet.PolylineDecorator
class L.RotatedMarker extends L.Marker
constructor: (pos, options) ->
super(pos, options)
@angle = 0
_setPos: (pos) ->
super(pos)
@piyo7
piyo7 / file0.scala
Created March 11, 2015 11:14
Boost.Rangeをパイプライン記法のままコンテナに変換 ref: http://qiita.com/piyo7/items/94e022dd9a0b57bd704b
val vec = (1 to 10).
filter(i => i % 2 != 0).
map(i => i * i).
toVector
print(vec.mkString(",")) // 1,9,25,49,81
@piyo7
piyo7 / file0.cpp
Last active August 29, 2015 14:16
参照を返すゲッターで範囲for文を回したらバグった ref: http://qiita.com/piyo7/items/4c2ba618a58c3bb72c0c
#include <iostream>
#include <vector>
// vectorのラッパークラス
template<typename T>
class Foo {
std::vector<T> data_;
public:
Foo(const std::vector<T>& data) : data_(data) {}
@piyo7
piyo7 / Main.scala
Created March 1, 2015 09:24
Qiita:Teamの投稿をMarkdownファイルでエクスポート ref: http://qiita.com/piyo7/items/6d0a831b1fb90392f485
case class QiitaTeamUser(url_name: String)
case class QiitaTeamPost(title: String, user: QiitaTeamUser, raw_body: String)
object Main extends App {
splitQiitaTeamJson("C:\\TEMP\\123456789.json") // エクスポートしたJSONファイルのパス
def splitQiitaTeamJson(file: String) {
using(scala.io.Source.fromFile(file, "UTF-8")) { source =>
@piyo7
piyo7 / file0.scala
Created November 26, 2014 09:14
一時オブジェクトの生成コスト回避による高速化 ref: http://qiita.com/piyo7/items/c8e576c6b010256c66f9
scala> Seq(1, 2, 3).view.map(_ + 1).map(_ * 2)
res0: scala.collection.SeqView[Int,Seq[_]] = SeqViewMM(...)
scala> res0.force
res1: Seq[Int] = List(4, 6, 8)
@piyo7
piyo7 / build.properties
Last active August 29, 2015 14:08
型に数値を埋めこんでみよう ref: http://qiita.com/piyo7/items/5df3ad7e53216df5f65f
sbt.version = 0.13.6