Skip to content

Instantly share code, notes, and snippets.

View akm's full-sized avatar

Takeshi Akima akm

View GitHub Profile
@akm
akm / gist:eb02445ccc051844ef66
Created March 11, 2016 02:28 — forked from billsinc/gist:1157544
Remove Firebird DB from MacOS
#!/bin/sh
echo "Clean Services"
echo "Clean User"
dscl localhost -delete /Local/Default/Users/firebird
echo "Clean Group"
dscl localhost -delete /Local/Default/Groups/firebird
if [ -f "/Library/StartupItems/Firebird" ]; then
echo "Remove SuperServer StartupItem"
rm -fr /Library/StartupItems/Firebird
fi
# -*- coding: utf-8 -*-
require "rubygems"
require "amqp" # requires version >= 0.8.0.RC14
puts "=> Example of automatic AMQP channel and queues recovery"
puts
AMQP.start(:host => "localhost") do |connection, open_ok|
puts "AMQP.start block runs"
# on_open, on_closedに渡されたブロックは、何度再接続をしても最初の一度だけしか呼び出されないが、
@akm
akm / gemspec
Created November 13, 2010 15:08 — forked from defunkt/gemspec
#!/usr/bin/env ruby
# Usage: gemspec [-s] GEMNAME
#
# Prints a basic gemspec for GEMNAME based on your git-config info.
# If -s is passed, saves it as a GEMNAME.gemspec in the current
# directory. Otherwise prints to standard output.
#
# Once you check this gemspec into your project, releasing a new gem
# is dead simple:
#
obj = Object.new
def obj.foo(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
options = {:name=>"A", :no=>1}.update(options)
"#{args.inspect} #{options.inspect}"
end
@akm
akm / gist:9362
Created September 8, 2008 02:21 — forked from taka2/gist:9290
require 'java'
require 'poi-3.1-FINAL-20080629.jar'
class RubyOutputStream < java.io.OutputStream
def set_io(io)
@io = io
end
def write(b)
if b.is_a?(Fixnum)
@akm
akm / gist:9360
Created September 8, 2008 02:19 — forked from taka2/gist:9289
require 'java'
require 'poi-3.1-FINAL-20080629.jar'
java.io.FileOutputStream.new("test2.xls") do |io|
wb = org.apache.poi.hssf.usermodel.HSSFWorkbook.new
wb.createSheet("First")
wb.write(io)
end