Skip to content

Instantly share code, notes, and snippets.

@takehiko
takehiko / photominifier.sh
Last active August 29, 2015 14:10
Photo Minifier
#!/bin/zsh
# photominifier.sh
# 撮影画像を縮小化する
# by takehikom
# 準備
# ・要 Zsh, ImageMagick (convert, idenfity)
# ・DIR1 に,縮小化させたい画像ファイルのディレクトリを指定する
# ・DIR2 に,画像ファイルのバックアップディレクトリを指定する
@takehiko
takehiko / wizquest.dot
Last active August 29, 2015 14:13
Cheetsheet of daily & weekly quests (Wizardry Schema)
digraph wizardry_schema_cheetsheet_of_daily_and_weekly_quests {
// node[fontname="ms gothic"]; // Windowsではコメントを外す
graph [rankdir = LR, bgcolor = "#006600"];
node [shape = box, style = filled, fillcolor = "#ccffcc"];
日ダ [label = "日:ダンジョンを2回制覇せよ"];
日S [label = "日:評価SSを獲得せよ"];
日月 [label = "日:月曜ダンジョンを制覇せよ"];
日火 [label = "日:火曜ダンジョンを制覇せよ"];
日水 [label = "日:水曜ダンジョンを制覇せよ"];
@takehiko
takehiko / triangle-triangle.rb
Created February 25, 2015 20:57
三角形三角形問題の描画
#!/usr/bin/env ruby
# triangle-triangle.rb
# 三角形三角形問題の描画
# by takehikom
# 要ImageMagick (convertコマンド), フォント (IPAexゴシック)
# ruby triangle-triangle.rb
# env FONT=/full/path/of/ipaexg.ttf ruby triangle-triangle.rb
@takehiko
takehiko / calc1.rb
Created March 11, 2015 21:08
6÷2(1+2)=1 using Racc
#!/usr/bin/env ruby
# $ ruby calc1.rb
# 1+2×3=7
# 3×(8+5×(6-2))÷2=42
# 6÷2(1+2)=1
# 6÷2×(1+2)=9
# Racc required (gem install racc)
@takehiko
takehiko / calc2.rb
Created March 11, 2015 21:09
6÷2(1+2)=9 using Racc (failed)
#!/usr/bin/env ruby
# $ ruby calc2.rb
# 1+2×3=7
# 3×(8+5×(6-2))÷2=42
# 2(1+2)-2=4
# 2(1+2)÷2=3
# 6÷2(1+2)=1
# 6÷2×(1+2)=9
@takehiko
takehiko / calc3.rb
Created March 13, 2015 20:33
6÷2(1+2)=1 and 6÷2(1+2)=9 using Racc
#!/usr/bin/env ruby
# $ ruby calc3.rb
# 1+2×3=7
# 3×(8+5×(6-2))÷2=42
# 2(1+2)-2=4
# 2 (1+2)÷2=3
# 2 - 2(1 + 2)=-4
# 2 / 2 (1 + 2)=0
# 2(1+2)(3+4)=42
@takehiko
takehiko / circle3.rb
Created March 24, 2015 21:38
Circle Trisection
#!/usr/bin/env ruby
# ruby circle3.rb
# creates Quadrant3.png, Circle3L.png, Circle3C.png, and Circle3Lrotate.png.
# rmagick required (gem install rmagick)
require "rmagick"
require "bigdecimal"
require "bigdecimal/newton"
@takehiko
takehiko / ggl.zsh
Created April 19, 2015 19:37
A function for Google URL Shortener
# Usage
# ggl http://d.hatena.ne.jp/takehikom/
# ggl -k Google_API_Key http://d.hatena.ne.jp/takehikom/
# ggl -f Google_API_Key_File http://d.hatena.ne.jp/takehikom/
# ggl -F http://d.hatena.ne.jp/takehikom/ http://d.hatena.ne.jp/takehikom/rss
function ggl () {
local longurl json
local apiurl=https://www.googleapis.com/urlshortener/v1/url
@takehiko
takehiko / isilx.rb
Created April 27, 2015 20:30
ISIL extractor
#!/usr/bin/env ruby
# isilx.rb : ISIL extractor
# by takehikom
# see also: http://www.ndl.go.jp/jp/aboutus/standards/opendataset.html
require 'rexml/document'
class IsilExtractor
@takehiko
takehiko / assocchecker.rb
Created April 29, 2015 21:04
Associativity checker for well-known logical operations
#!/usr/bin/env ruby
# assocchecker.rb : associativity checker for well-known logical operations
# by takehikom
class AssociativityChecker
def initialize
end
def and(*param)