Skip to content

Instantly share code, notes, and snippets.

View myokoym's full-sized avatar
💭
hi

Masafumi Yokoyama myokoym

💭
hi
View GitHub Profile
@myokoym
myokoym / convert-mts-in-64-giga-byte-sd-card-into-mp4-on-ubuntu.md
Created February 10, 2014 03:49
Ubuntuで64GBのSDカードから動画を抜いてMP4に変換する手順

Ubuntuで64GBのSDカードから動画を抜いてMP4に変換する手順

exFATのファイルシステムをマウントする準備

sudo apt-get install exfat-fuse exfat-utils
@myokoym
myokoym / try-multibyte-uri.rb
Created February 17, 2014 03:28
Ruby標準添付のURIモジュールをマルチバイトのファイル名に対応させたくてがんばった結果
module URI
class Generic
alias :__path__ :path
def path
URI.decode_www_form_component(__path__, Encoding.find("locale"))
end
end
def self.parse(uri)
uri = URI.encode_www_form_component(uri)
@myokoym
myokoym / image-viewer-sample.rb
Last active August 29, 2015 13:57
デスクトップアプリケーションを作る会@札幌 2014-03-16 http://atnd.org/events/48050 のサンプルアプリケーション『横に何枚でも並べられる画像ビューアー』です。引数に指定した画像ファイルを表示します。また、右クリックメニューから非表示にできます。事前に `gem install gtk2` してから実行してください。(3/14追記:OS XでFinder-XQuartz間のドラッグ&ドロップができないようなので、一部修正しました)
#!/usr/bin/env ruby
require "gtk2"
window = Gtk::Window.new
window.title = "Image Viewer sample"
window.set_default_size(640, 480)
window.signal_connect("destroy") do
Gtk.main_quit
end
@myokoym
myokoym / blocks.rb
Last active August 29, 2015 13:57
GosuとRubyで動くブロック崩しゲーム (リリース版はこちら: https://github.com/myokoym/bricks_meet_balls
require "gosu"
module ZOrder
Background, Block, Bar, Ball, Message = *0..5
end
module Util
def draw_square(window, x1, y1, x2, y2, color, z_order=0)
window.draw_quad(x1, y1, color,
x2, y1, color,
@myokoym
myokoym / persosta.rb
Last active August 29, 2015 13:57
A baseball game for PC. (under construction...)
require "gosu"
module Persosta
module ZOrder
Background, Ball, Bat = *0..2
end
module Base
def draw_square(window, x1, y1, x2, y2, color, z_order=0)
window.draw_quad(x1, y1, color,
@myokoym
myokoym / screenshot.rb
Created March 28, 2014 14:44
Ruby/WebKitGTK2でWebページのスクリーンショットを取得する例。引数にURLを指定して、sキーで取得。
#!/usr/bin/env ruby
require "webkit-gtk2"
uri = ARGV[0]
window = Gtk::Window.new
window.signal_connect("destroy") do
Gtk.main_quit
end
@myokoym
myokoym / tetris.rb
Last active August 29, 2015 13:58
A game as Tetris using Gosu and Ruby.
#!ruby
#
# This program is licensed under the MIT license. (c) 2014 Masafumi Yokoyama
#
require "gosu"
module Tetris
SCALE = 20
@myokoym
myokoym / bricks_meet_balls-gtk.rb
Last active August 29, 2015 13:59
A game launcher by Ruby/GTK3.
require "gtk3"
require "bricks_meet_balls"
class GameButton < Gtk::Button
PROPERTIES = [
"num_of_rows",
"num_of_columns",
"num_of_balls",
"ball_images",
"brick_images",
@myokoym
myokoym / rbshogi.rb
Last active August 29, 2015 13:59
A Shogi board using Gosu and Ruby. (under construction...)
require "gosu"
require "shogi"
require "socket"
module RbShogi
PIECES = [
"FU", "TO",
"KY", "NY",
"KE", "NK",
"GI", "NG",
@myokoym
myokoym / gosu_image_viewer.rb
Last active August 29, 2015 14:00
Image Viewer using Gosu and Ruby
require "gosu"
module GosuImageViewer
class Window < Gosu::Window
def initialize(width=640, height=480)
super(width, height, false)
self.caption = "Image Viewer using Gosu"
@images = []
@scale = 1.0
@angle = 0