Skip to content

Instantly share code, notes, and snippets.

View skoji's full-sized avatar
:octocat:
Working from home

Satoshi KOJIMA skoji

:octocat:
Working from home
View GitHub Profile
require 'gepub'
rendition_layout = GEPUB::Book.parse(File.open('/path/to/epub/file.epub')).rendition_layout
if rendition_layout == 'pre-paginated'
puts "rendition:layout is #{rendition_layout}, which means fixed layout"
else
puts "rendition:layout is #{rendition_layout}, which means reflow"
end
@skoji
skoji / diff.sh
Last active April 9, 2018 06:25
Comparing UTF-8 text with git diff
git diff --word-diff-regex=$'[^\x80-\xbf][\x80-\xbf]*' --word-diff=color ...
Containers: 5
Running: 5
Paused: 0
Stopped: 0
Images: 20
Server Version: 17.12.1-ce
Storage Driver: devicemapper
Pool Name:
Pool Blocksize: 65.54kB
Base Device Size: 10.74GB
.latin {
font-family: HelveticaNeueLT Std, sans-serif;
}
.japanese {
font-family:'A-OTF 新ゴ Pro',A-OTF Shin Go Pro,sans-serif;
}
body {
font-family: HelveticaNeueLT Std, 'A-OTF 新ゴ Pro',A-OTF Shin Go Pro,sans-serif;
}
@skoji
skoji / mastodon-search-hashtag-and-createpage.rb
Last active January 2, 2018 12:06
userlocalのMastodonリアルタイム検索に頼ってhashtag検索結果をHTMLにする
require 'open-uri'
require 'json'
require 'nokogiri'
require 'uri'
raise 'should specify keyword' if ARGV.size < 1
keyword = ARGV[0]
title = keyword
title = ARGV[1] if ARGV.size >= 2
@skoji
skoji / profile.md
Created October 4, 2017 22:58
Profile

小嶋 智(こじま さとし)

テキスト処理・ページ記述言語・マークアップ言語の周辺をぐるぐるまわりながら仕事をしつつ、趣味のEPUB制作環境をちまちま作っているエンジニア。 アサガヤデンショ店長、MastodonインスタンスBookwor.ms運営者。

@skoji
skoji / pockebell.rb
Last active June 28, 2017 02:46
ポケベル入力を読む
pockebell = [%w(わ を ん ゛ °),
%w(あ い う え お),%w(か き く け こ),%w(さ し す せ そ),
%w(た ち つ て と),%w(な に ぬ ね の),%w(は ひ ふ へ ほ),
%w(ま み む め も),%w(や ( ゆ )よ),%w(ら り る れ ろ)]
s = ARGV[0].strip.scan(/.{1,2}/).map do |c|
a,b = c.split(//)
pockebell[a.to_i][b.to_i - 1]
end
puts s.join
@skoji
skoji / mastodon assets-precompile-on-other-machine.sh
Last active October 5, 2023 09:11
Mastodon : execute assets:precompile on a local machine.
# on the mastodon server
cd /home/mastodon/live
git checkout <release tag>
docker-compose pull && docker-compose build && docker-compose stop
# on the local machine
rsync -trzv --delete --rsync-path='sudo rsync' mastodon@server.example.com:/home/mastodon/live/ backup # get full backup
cd backup
docker-compose pull && docker-compose build && docker-compose run --rm web rails assets:precompile
cd ..
@skoji
skoji / .py
Created February 6, 2017 13:50
Convert all fonts opened in Glyphs to TTF
# Write this in Macro Panel and click on the Run button
for myFont in Glyphs.fonts:
for ins in myFont.instances:
print "Exporting:", ins.familyName
ins.generate(Format='TTF',AutoHint=False, RemoveOverlap=False,FontPath='path_to_the_converted_fonts/')