Skip to content

Instantly share code, notes, and snippets.

Tatsuhiko Miyagawa miyagawa

Block or report user

Report or block miyagawa

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
miyagawa / google-speech2text.rb
Created Feb 22, 2019
preprocess google speech-to-text wordoffsets
View google-speech2text.rb
#!/usr/bin/env ruby
# coding: utf-8
require 'json'
table = {
"じかん" => "時間",
"" => "",
"ぱーせんと" => "%",
"えん" => "",
"どる" => "ドル",
View speech.rake
namespace :speech do
desc "Merge WAV files and encode to FLAC"
task :encode do |t|
wav = "podcast-ep#{ENV['EP']}.wav"
flac = "podcast-ep#{ENV['EP']}.flac"
channels = []
wavs = Dir["#{ENV['HOME']}/Music/GarageBand/Podcast ep#{ENV['EP']}-*.wav"]
wavs.each_with_index do |w, i|
mono = "podcast-ep#{ENV['EP']}-ch#{i+1}.wav"
miyagawa /
Last active Jan 18, 2019
Convert local timestamps in text to UTC
#!/usr/bin/env perl
use strict;
use DateTime;
use Date::Parse qw(str2time);
my $pattern = qr/\d?\d:\d\d(:\d\d)?(?: ?[aApP][mM])?/;
while (<>) {
s/$pattern/utc(str2time($&), $1)/eg;
miyagawa / curl.rb
Created Aug 30, 2018
curl --resolve with typhoeus
View curl.rb
require 'typhoeus'
require 'ethon'
resolve = Ethon::Curl.slist_append(nil, "")
r =
resolve: resolve,
# verbose: true,
miyagawa /
Last active May 12, 2018
Rebuild チャプター

Rebuild のチャプターは ep181 以降からつけているため、ep180 以前のものにはついていません。膨大な数になり、手作業でつけることになるため、ボランティアでご協力していただける方を募集しています。

Show Notes と比較しながら早回し、スキップしてすすめると、1エピソードあたり5-20分程度の作業になります。Show Notes にあるリンクは非常に粒度が細かくなってしまうので、大きなトピックでまとめて1つのタグぐらいで構いません。

以下のフォーマットで .txt ファイルを作成し、

00:00 Intro
01:23 トピック1
32:44 トピック2
View gist:17d7483992e3043c8deea3d60e5223ee
Delete Files
Files in directory authors/id/M/MI/MIYAGAWA
Acme-DateTime-Duration-Numeric-0.01.meta 347 Tue, 15 Jan 2008 10:34:05 GMT
Acme-DateTime-Duration-Numeric-0.01.readme 618 Tue, 15 Jan 2008 10:33:36 GMT
Acme-DateTime-Duration-Numeric-0.01.tar.gz 33537 Tue, 15 Jan 2008 23:18:05 GMT
Acme-DateTime-Duration-Numeric-0.02.meta 385 Wed, 16 Jan 2008 01:16:27 GMT
Acme-DateTime-Duration-Numeric-0.02.readme 618 Tue, 15 Jan 2008 10:33:36 GMT
View gist:226629bcf3046f2a25cf7e10815659c2
PERL_CPANM_OPT= cpanm --mirror-only --mirror file://$PWD/xt/mirror HTTP::Tinyish --info -v
cpanm (App::cpanminus) 1.7102 on perl 5.020001 built for darwin-2level
Work directory is /Users/miyagawa/.cpanm/work/1464108652.13740
You have make /usr/bin/make
You have LWP 6.15
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
Searching HTTP::Tinyish on mirror file:///Users/miyagawa/dev/cpanminus/xt/mirror ...
Downloading index file file:///Users/miyagawa/dev/cpanminus/xt/mirror/modules/02packages.details.txt.gz ...
Uncompressing index file...
View ruby-2.2.4 on OS X Yosemite
/var/folders/g2/fzfdvxhx5bvdq5y99syc4_fh0000gn/T/ruby-build.20151217020923.4369 ~/.rbenv/plugins/ruby-build
/var/folders/g2/fzfdvxhx5bvdq5y99syc4_fh0000gn/T/ruby-build.20151217020923.4369/ruby-2.2.4 /var/folders/g2/fzfdvxhx5bvdq5y99syc4_fh0000gn/T/ruby-build.20151217020923.4369 ~/.rbenv/plugins/ruby-build
config.guess already exists
config.sub already exists
checking build system type... x86_64-apple-darwin14.5.0
checking host system type... x86_64-apple-darwin14.5.0
checking target system type... x86_64-apple-darwin14.5.0
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
View gist:b412e7bef8ffe882a948
package Plack::Builder;
sub new { ... }
sub enable {
my $self = shift;
sub enable_if {
You can’t perform that action at this time.