Skip to content

Instantly share code, notes, and snippets.

@takehiko
takehiko / aws.rb.diff
Last active December 14, 2015 03:48
A patch for removing "iconv" from ruby-aaws-0.7.0.
*** aws.rb.orig 2013-02-24 19:27:57.448147103 +0900
--- aws.rb 2013-02-24 21:23:29.332241237 +0900
***************
*** 9,15 ****
require 'amazon'
require 'amazon/aws/cache'
require 'enumerator'
! require 'iconv'
require 'rexml/document'
require 'uri'
@takehiko
takehiko / aws.rb.patch
Created February 24, 2013 13:20
A patch for removing "iconv" from ruby-aaws-0.8.1.
*** aws.orig.rb 2013-02-24 22:10:49.823223500 +0900
--- aws.rb 2013-02-24 22:14:02.582248700 +0900
***************
*** 9,15 ****
require 'amazon'
require 'amazon/aws/cache'
require 'enumerator'
! require 'iconv'
require 'rexml/document'
require 'uri'
@takehiko
takehiko / setting-ruby.zsh
Last active December 14, 2015 09:39
Settings for installing and utilizing Ruby snapshots
# settings for installing and utilizing Ruby snapshots
# function:
# ruby-snss-install
# ruby-snapshot-install
# ruby-sn-install
# ruby-stable-snapshot-install
# ruby-ss-install
# ruby-install
# use-ruby-snapshot
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# threeposition.rb by takehikom
# ruby threeposition.rb 541 => "541-145=396, 396+693=1089"
# ruby threeposition.rb
# Inspired by
# 藤井斉亮「数学的問題解決過程における文字式の役割と機能」,
@takehiko
takehiko / pazdracombo.rb
Created June 8, 2013 20:53
A tiny combo checker for Puzzle & Dragons
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# A tiny combo checker for Puzzle & Dragons
# by takehikom (http://d.hatena.ne.jp/takehikom/)
# You can find the updated version:
# https://gist.github.com/takehiko/5750263
# Usage:
@takehiko
takehiko / padsim.rb
Created June 10, 2013 16:42
A tiny combo simulator of Puzzle & Dragons
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# A tiny combo simulator of Puzzle & Dragons
# by takehikom (http://d.hatena.ne.jp/takehikom/)
# Usage:
# ruby padsim.rb
# ruby padsim.rb 111234 511123 451116 234234 234234
@takehiko
takehiko / jamaica.rb
Created July 8, 2013 20:42
JAMAICA solver
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# JAMAICA solver
# by takehikom (http://d.hatena.ne.jp/takehikom/)
# Usage:
# ruby jamaica.rb | more
# ruby jamaica.rb 25 1 3 2 4 1
@takehiko
takehiko / archi.zsh
Created September 12, 2013 20:18
Settings for the environmental variable ARCHI, whose value is one of "linux", "cygwin", and "dummy"
# settings for ARCHI
if [ -f $ZDOTDIR/.archi.linux ]; then export ARCHI="linux"
elif [ -f $ZDOTDIR/.archi.cygwin ]; then export ARCHI="cygwin"
elif [ -f $ZDOTDIR/.archi.dummy ]; then export ARCHI="dummy"
elif which uname > /dev/null; then
case "`uname -sr`" in
Linux*); export ARCHI="linux" ; touch $ZDOTDIR/.archi.$ARCHI ;;
CYGWIN*); export ARCHI="cygwin" ; touch $ZDOTDIR/.archi.$ARCHI ;;
*); export ARCHI="dummy" ; touch $ZDOTDIR/.archi.$ARCHI ;;
@takehiko
takehiko / ppg.rb
Last active December 23, 2015 09:09
Parity Problem Generator
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
# ppg.rb : Parity Problem Generator
# by takehikom (http://d.hatena.ne.jp/takehikom/)
# Usage:
# ruby ppg.rb
# ruby ppg.rb 3
@takehiko
takehiko / pngtogif.sh
Created November 25, 2013 18:24
From PNG files generated by PowerPoint to an animated GIF image
#!/bin/zsh
# スライド1.PNG ... スライド27.PNG
# => slide__01.png ... slide__27.png
# => result.gif
if [ 1 = 1 ]
then
for i in {1..27}
do