Skip to content

Instantly share code, notes, and snippets.

Avatar

Masato Igarashi migrs

View GitHub Profile
View gist:2870
default
{
state_entry()
{
vector fwd = <llSqrt(2)/2, llSqrt(2)/2, 0.0>;
vector left = < 0.0, 1.0, 0.0>;
vector up = < 0.0, 0.0, 1.0>;
rotation rot = llAxes2Rot(fwd, up % fwd, up);
llSay(DEBUG_CHANNEL, (string) rot);
View del
#!/usr/bin/env ruby
# vim: ft=ruby
def mk_uniq_name_by(filename, path)
uniq_name = filename
prefix = 0
while FileTest.exist?(File.join(path, uniq_name))
prefix += 1
uniq_name = sprintf("%d.%s", prefix, filename)
end
uniq_name
View inline_filter.rb
module Inline
include Haml::Filters::Base
def self.[](key)
@@data[key.to_s] rescue nil
end
def render(str)
@@data = Hash[*str.split(/^\s*@@\s*(\w+)\s*\n/m)[1..-1]]
return nil
View .vimrc
" Tabs
nnoremap <D-t> :<C-u>tabnew<CR>:tabmove<CR>
nnoremap <D-w> :<C-u>tabclose<CR>
nnoremap <D-}> :<C-u>tabnext<CR>
nnoremap <D-{> :<C-u>tabprevious<CR>
@migrs
migrs / google_analytics.rb
Created Aug 18, 2010
Google Analytics Mobile for Rails Metal
View google_analytics.rb
# Allow the metal piece to run in isolation
require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
class GoogleAnalytics
extend Rack::Utils
G_COOKIE_NAME = '__utmmobile'
GIF_DATA = "GIF89a\001\000\001\000\200\000\000\377\377\377\377\377\377!\371\004\001\n\000\001\000,\000\000\000\000\001\000\001\000\000\002\002L\001\000;"
UTM_GIF_LOCATION = "http://www.google-analytics.com/__utm.gif";
View unicorn
#!/bin/sh
#
# init.d script for single or multiple unicorn installations. Expects at least one .conf
# file in /etc/unicorn
#
# Modified by jay@gooby.org http://github.com/jaygooby
# based on http://gist.github.com/308216 by http://github.com/mguterl
#
## A sample /etc/unicorn/my_app.conf
##
View gist:558762
fib = Hash.new {|h,k| h[k] = k < 2 ? 1 : h[k-2] + h[k-1]}
@migrs
migrs / fw_isb.rb
Created Sep 22, 2010
i.softbank.jp 宛のメールを Gmail に転送するスクリプト
View fw_isb.rb
require 'net/imap'
require 'time'
sb_account = %W(USERNAME PASSWORD)
gm_account = %W(USERNAME PASSWORD)
sb = Net::IMAP.new 'imap.softbank.jp', 993, true
sb.login *sb_account
sb.select 'INBOX'
@migrs
migrs / fw_isb.rb
Created Sep 25, 2010
i.softbank.jp のメールをすべて Gmail に移動する
View fw_isb.rb
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 / .screenrc
Created Apr 6, 2011
minimum dotfiles
View .screenrc
escape ^Tt
defbce on
vbell off
termcapinfo xterm* ti@:te@
startup_message off
defhstatus ^En:^Et
maptimeout 0
autodetach on
altscreen on
defscrollback 10000