VagrantでOVAファイルを出力するプラグインを作った

便利そうで,かつ,誰か作ってそうだけど,ネットを漁っても出てこなかったので作ってみた. ガバガバなソースコードなので,オープンソースでプルリクでいい感じに直して欲しい.

github.com

インストールの仕方

$ git clone https://github.com/miettal/vagrant-ova.git
$ cd vagrant-ova
$ rake build
$ vagrant plugin install ./pkg/vagrant-ova-[version].gem

使い方

$ cd path-to-vagrantfile-directory
$ ls
Vagrantfile
$ vagrant up # if you didnt create VM yet
$ vagrant halt # if you didnt shutdown VM yet
$ vagrant ova
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Successfully exported 1 machine(s).
$ ls
Vagrantfile  vm-name.ova

↓をかなり参考にさせていただきました.

github.com

JALの機内WiFiサービスにある動画を一括ダウンロードする.

1年前北海道-東京の便に乗ったとき暇だったので書いた. 今年乗ったら,コンテンツがHLSに切り替わっていて,簡単にダウンロードできなくなっていた. 飛行機で暇な時は,こういう遊びをすると時間を潰せて楽しい.

gist0df3e33a617d0cf10d0baa2140794220

↑を実行すると下記のような.shが出来上がるよ.

gist6a707a53fffe34b28fd765e2c5e2b0ff

Ubuntu 16.04でSATySFi環境構築&コンパイル

2017/02/12時点の情報です. まだSATySFiは絶賛開発途中であり,特に今インストール周りが改善中のようですので,うまくいかない場合はgithubのページを追ってください.

↓ココらへんを参考にした.

qiita.com

github.com

SATySFi

型づけがしっかりしていて,エラーメッセージのわかりやすい組版システム(を目指しているらしい). texのように文章の構造や装飾をマークアップして記述する. 未踏に採択されて先日成果発表会が行われた.

github.com

依存関係をインストール

$ sudo apt-get update
$ sudo apt-get install opam autoconf

opam構築

.profileを読んでくれないので,.bashrcに直接書き込んだ

$ cd
$ opam init
$ echo "¥n. /home/satysfi/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true" >> $HOME/.bashrc
$ opam switch 4.05.0
$ eval `opam config env`

SATySFi構築

$ cd
$ git clone https://github.com/gfngfn/SATySFi.git
$ cd $HOME/SATySFi
$ git submodule update -i
$ opam pin add satysfi .
$ opam install satysfi
$ satysfi --help
  -o  Specify output file
  --output  Specify output file
  -v  Print version
  --version  Print version
  --full-path  Display paths in full-path style
  -help  Display this list of options
  --help  Display this list of options

demo/demo.satyをコンパイル

フォントや画像が足りないので用意する

$ cd $HOME/SATySFi/demo

ArnoPro-Regular.otfを用意

$ wget https://www.wfonts.com/download/data/2014/12/28/arno-pro/ArnoPro-Regular.otf -P $HOME/.satysfi/dist/fonts/
$ wget https://ipafont.ipa.go.jp/old/ipaexfont/ipaexm00201.php -P /tmp
$ unzip -d /tmp /tmp/ipaexm00201.php
$ cp /tmp/ipaexm00201/ipaexm.ttf $HOME/.satysfi/dist/fonts/

Osaka.ttf

ttc→ttfに変換するために,unitettcをインストールする

UniteTTC

$ wget http://yozvox.web.fc2.com/unitettc.zip -P /tmp
$ unzip -d /tmp /tmp/unitettc.zip
$ chmod +x /tmp/unitettc/unitettc64
$ wget http://osaka.is.land.to/files/Osaka.zip -P /tmp
$ unzip -d /tmp /tmp/Osaka.zip
$ /tmp/unitettc/unitettc64 /tmp/Osaka.ttc
$ cp /tmp/Osaka001.ttf $HOME/.satysfi/dist/fonts/Osaka.ttf

satysfi-logo.png

png→jpgに変換するために,imagemagickをインストールする

$ sudo apt-get install imagemagick
$ wget https://raw.githubusercontent.com/wiki/gfngfn/SATySFi/img/satysfi-logo.png -P /tmp
$ convert /tmp/satysfi-logo.png satysfi-logo.jpg

コンパイル

$ make

make satysfi/demo/

$ file demo.pdf
demo.pdf: PDF document, version 1.7

C:¥windows¥installerの容量が大きすぎる

Cドライブの容量がいっぱいになっていた.

ちなみに実家パソコン

f:id:miettal:20180211174842p:plain

WinDirStatで見たらC:¥windows¥installerが20GB以上食っていた.

Windows Updateインストーラが入ってるらしい

windirstat.net

f:id:miettal:20180211174928p:plain

PatchCleanerでWindows Updateインストーラを削除した.

PatchCleanerを使うと,いらないインストーラだけ削除してくれる

www.homedev.com.au

f:id:miettal:20180211175042p:plain f:id:miettal:20180211175049p:plain

直った.

よかった

f:id:miettal:20180211175301p:plain

httpstatを使ってみた

インストール

ubuntu

$ sudo apt install python-pip
$ sudo pip install httpstat

mac

$ brew install httpstat

使い方

httpstat http://example.com

httpstat --help

所管

httpリクエストを見やすく整形して出力してくれるツール. 内部でcurlを使っているようで,curlのオプションがそのまま使える. タイミング系はいつもgoogle chromeのdevelopper toolsで見たけどこれでいいなと思った.