Skip to content

Instantly share code, notes, and snippets.

View toshi3221's full-sized avatar

Toshiharu Takematsu toshi3221

View GitHub Profile
RICOH THETAで撮った写真をPTP-IPで取得する - stoikheia(@3xv)の日記 http://d.hatena.ne.jp/stoikheia/20131201
ここにあるサンプル、Socketが生書きなのでラッピングをこころみてる
@toshi3221
toshi3221 / gist:d92a3691084eb45dd8c3
Created March 2, 2015 08:20
YAML⇔XML相互変換
require 'active_support/core_ext'
require 'yaml'
require "rexml/document"
# YAML→XML
open('ja.xml', 'w') do |f|
f.write YAML.load_file('ja.yml').to_xml
end
# XML→YAML
@toshi3221
toshi3221 / gist:53816d60947e2bf91e7b
Created March 2, 2015 09:03
Rails翻訳依頼のためのHTML変換スクリプト
require 'yaml'
def to_html hash, html='', prefix_key=''
hash.each do |key, value|
html = if value.is_a? String
html+"<tr><td>#{prefix_key[0..-1]+key}</td><td>#{value}</td></tr>\n"
else
to_html value, html, prefix_key+key+'.'
end
end
@toshi3221
toshi3221 / gist:ce8c4ce90e4e8749802d
Last active August 29, 2015 14:17
ffmpegにかける為、連番にするスクリプト
i=0 ; for f in $(ls -1 *.JPG | sort -t'-' -k2h)
do
mv "$f" $(printf "out/%04d.jpg" $i)
$((i++)) > /dev/null
done
@toshi3221
toshi3221 / gist:3776052
Created September 24, 2012 13:51
EM::Iterator sample
def em
EM.run do
EM::Iterator.new(0..10, 3).each(proc{ |num, iter|
(0..(rand(100))).inject(0){|sum,i| sum+=i}
puts num.inspect
iter.next
}, proc{|responses|
puts 'complete!'
EM.stop
})
puts 'hello Ruby!'
@toshi3221
toshi3221 / gist:5743827
Created June 9, 2013 14:55
simpleWebRTC
<!DOCTYPE html>
<html>
<head>
<script src="http://simplewebrtc.com/latest.js"></script>
</head>
<body>
<div id="localVideo"></div>
<div id="remotesVideos"></div>
<script>
var webrtc = new WebRTC({
@toshi3221
toshi3221 / README.md
Last active January 9, 2018 03:39
init.d向けinspircdサービス設定ファイル

サービスに登録する手順

@toshi3221
toshi3221 / Amazon.css
Last active July 25, 2019 00:21
Stylish拡張機能用twitterカスタマイズCSS。ドメインURLをtwitter.comにしてとりこむ
#nav-link-prime,
.nav-prime-1 .nav-logo-tagline,
.nav-right #nav-swmslot,
#PrimeMusicAdoptionUpsell,
#PrimePhotos,
.adcenterRowWrapper,
.billboardRowWrapper,
.displayAd, .issuance-banner,
.nav-link[href*='Prime'], .nav-link[href*='dmusic'], a[href*='prime'], a[href*='AC-student'],
input[value='exp-jp-timed'], input[value='scheduled-delivery-jp'],
@toshi3221
toshi3221 / GithubActions.md
Last active December 9, 2019 06:06
Github Actionsの概要とRSpecテストフローサンプル

Github Actions

(2019/12/9現在)

概要

  • Githubが提供するCI/CD
  • CircleCIとほぼ同じ事が出来るが2019/11/14に正式版になったことを発表したばかりでCacheなどBeta機能もある
  • Linux/MacOS/Windowsの実行を提供
  • 各OS共、2core CPU / 7GB RAM / 14GB SSD