Skip to content

Instantly share code, notes, and snippets.

@migrs
migrs / config.ru
Created September 26, 2012 13:53
rack-server-page layout sample
require 'rack-server-pages'
require 'tilt'
run Rack::ServerPages.new { |config|
config.before do
layout('public/_layout.html')
end
}
@migrs
migrs / gist:2485264
Created April 25, 2012 01:30
Ruby Indent Style
class Hoge
def foo
puts 'foo';end
def baz
if true
puts 'baz'
else
raise 'baz';end;end;end
@migrs
migrs / bluepill
Created February 16, 2012 06:27
bluepill init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: bluepill
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: bluepill daemon, providing process monitoring
# Description: bluepill is a monitoring tool. More info at http://github.com/arya/bluepill.
@migrs
migrs / bluepill.rb
Created January 30, 2012 08:49
process checks for nscd
Bluepill.application("system", :log_file => '/var/log/bluepill/system.log') do |app|
app.process('nscd') do |process|
process.pid_file = '/var/run/nscd/nscd.pid'
process.start_command = '/etc/init.d/nscd start'
process.stop_command = '/etc/init.d/nscd stop'
process.restart_command = '/etc/init.d/nscd restart'
process.checks :mem_usage, :every => 10.minutes, :below => 100.megabytes, :times => [3,5]
end
end
@migrs
migrs / gist:1615032
Created January 15, 2012 08:14
Powder / Powify Comparison
Powder | Powify
[Server Commands]
Install pow server ( curl get.pow.cx | sh )
powder install | powify server install
Reinstall pow server
- | powify server reinstall
@migrs
migrs / gist:1501434
Created December 20, 2011 12:38
7lang7week p207
(def col-types {clojure.lang.PersistentHashSet :map clojure.lang.PersistentList :list clojure.lang.PersistentVector :vector})
(defn collection-type [col] (col-types (class col)))
source ~/.vim/config/vundle.vim
" vim
source ~/.vim/config/basic.vim
source ~/.vim/config/keymap.vim
source ~/.vim/config/omnifunc.vim
" bundles
source ~/.vim/config/skk.vim
source ~/.vim/config/rails.vim
source ~/.vim/config/unite.vim
source ~/.vim/config/neocomplcache.vim
@migrs
migrs / .screenrc
Created April 6, 2011 09:09
minimum dotfiles
escape ^Tt
defbce on
vbell off
termcapinfo xterm* ti@:te@
startup_message off
defhstatus ^En:^Et
maptimeout 0
autodetach on
altscreen on
defscrollback 10000
@migrs
migrs / fw_isb.rb
Created September 25, 2010 01:27
i.softbank.jp のメールをすべて Gmail に移動する
SB_ACCOUNT = ['USERNAME', 'PASSWORD']
GM_ACCOUNT = ['USERNAME', 'PASSWORD']
BOXCAR_ADDR = "123456.123456@push.boxcar.io"
sb.select 'INBOX'
imap_each(sb, %w(UNDELETED)) do |mail, m|
Net::SMTP.start('127.0.0.1', 25) {|smtp| smtp.send_mail mail.attr['BODY[HEADER]'], m[:from], BOXCAR_ADDR}
gm.append 'INBOX', m[:src], nil, m[:date]
sb.store mail.seqno, '+FLAGS', [:Deleted]
end
@migrs
migrs / dropbox
Created September 23, 2010 00:19
/etc/init.d/dropbox
# /etc/init.d/dropbox
### BEGIN INIT INFO
# Provides: dropbox
# Required-Start: $network $syslog $remote_fs
# Required-Stop: $network $syslog $remote_fs
# Should-Start: $named $time
# Should-Stop: $named $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start and stop the dropbox daemon for debian/ubuntu