Skip to content

Instantly share code, notes, and snippets.

Satoshi KOJIMA skoji

Block or report user

Report or block skoji

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
skoji / raw-to-jpg.rb
Last active Jun 9, 2019
Pentax RAW file to jpeg, preserving creation date
View raw-to-jpg.rb
filename = ARGV[0]
raise "specify PEF file." unless filename =~ /.PEF$/ # should change according to what you want to convert
raise "file #{filename} does not exists." unless File.exist?(filename)
stat =
converted = filename.sub(/.PEF$/, ".jpg")
raise "convesion failed" unless system "convert #{filename} #{converted}"
File.utime(stat.mtime, stat.mtime, converted)
skoji /
Created May 16, 2019
Update Let's Encrypt (Ubuntu 16.04)
sudo apt-get update
sudo apt-get upgrade certbot -y
# follow the instructions here
sudo certbot renew
# change e-mail
sudo certbot update_account --email <new email address>
skoji / FromEscapeToJapanese_eisuu.json
Created Nov 20, 2018
karabinier : ~/.config/karabiner/assets/complex_modifications/FromEscapeToJapanese_eisuu.json
View FromEscapeToJapanese_eisuu.json
"title": "Terminal等でESCあるいは^[で日本語入力を英数に",
"rules": [
"description": "Terminal, iTerm2またはMacVimでESCあるいは^[を押したときに日本語入力を英数に切り替える。",
"manipulators": [
"type": "basic",
"from": { "key_code": "escape", "modifiers": { "optional": [ "any" ] } },
"to": [ { "key_code": "japanese_eisuu" }, { "key_code": "escape" } ],
// 参考:
use std::collections::HashMap;
fn mean(data : &Vec<i32>) -> f32 {
let mut r = 0;
for i in data {
r = r + i;
r as f32 / data.len() as f32
fn median(data: &Vec<i32>) -> i32 {
View check-fixed-layout.rb
require 'gepub'
rendition_layout = GEPUB::Book.parse('/path/to/epub/file.epub')).rendition_layout
if rendition_layout == 'pre-paginated'
puts "rendition:layout is #{rendition_layout}, which means fixed layout"
puts "rendition:layout is #{rendition_layout}, which means reflow"
skoji /
Last active Apr 9, 2018
Comparing UTF-8 text with git diff
git diff --word-diff-regex=$'[^\x80-\xbf][\x80-\xbf]*' --word-diff=color ...
View sandbox.skoji.jpのdocker info
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
View test2.css
.latin {
font-family: HelveticaNeueLT Std, sans-serif;
.japanese {
font-family:'A-OTF 新ゴ Pro',A-OTF Shin Go Pro,sans-serif;
View test.css
body {
font-family: HelveticaNeueLT Std, 'A-OTF 新ゴ Pro',A-OTF Shin Go Pro,sans-serif;
skoji / mastodon-search-hashtag-and-createpage.rb
Last active Jan 2, 2018
View mastodon-search-hashtag-and-createpage.rb
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
You can’t perform that action at this time.