- id: joker1007
- ブログ: http://d.hatena.ne.jp/joker1007/
- Twitter: http://twitter.com/joker1007
- コード書く時は大体vim。
主に個人用のWebアプリを作るのに使ってます。
--- cmdline-fu 2011-01-18 12:07:51.000000000 +0900 | |
+++ proxy/cmdline-fu 2011-01-18 12:04:02.000000000 +0900 | |
@@ -21,6 +21,7 @@ | |
class CommandLineFu | |
API_URL = 'http://www.commandlinefu.com/commands' | |
+ PROXY_HOST, PROXY_PORT = (ENV["HTTP_PROXY"] || '').sub(/http:\/\//, '').split(':') | |
# attr_reader :api_url | |
# wrong argument type JSON::Pure::Generator::State (expected Data)対策 | |
class Fixnum | |
def to_json(options = nil) | |
to_s | |
end | |
end | |
# vi:ft=ruby |
主に個人用のWebアプリを作るのに使ってます。
# Gitorious Installation to Ubuntu Server 10.04 | |
# from gitorious mainline: | |
# commit e2e70edd42ac1c00dab518d61d566ee3fec929db | |
# Author: Marius Mathiesen <[email protected]> | |
# Date: Wed Apr 13 11:43:07 2011 +0200 | |
: << '#COMMENT_OUT' | |
Ubuntu Server 10.04 に Gitorious をインストールしたときのメモ。 |
class MyParser | |
def self.parse(thing, url = nil, encoding = nil, | |
options = Nokogiri::XML::ParseOptions::DEFAULT_HTML, &block) | |
thing=NKF.nkf("-wm0E", thing).sub(/euc-jp/, "utf-8") | |
Nokogiri::HTML::Document.parse(thing, url, encoding, options, &block) | |
end | |
end | |
# vim:ft=ruby |
#!/bin/zsh | |
rvm_path=/home/joker/.rvm | |
source /home/joker/.rvm/scripts/rvm | |
rvm use ruby-1.9.2-p290 | |
cd /home/joker/mctiwt | |
/usr/bin/env ruby bot.rb |
source 'http://rubygems.org' | |
gem "rspec" | |
gem "factory_girl" | |
gem "i18n" | |
gem "guard" | |
gem "guard-rspec" | |
if RUBY_PLATFORM.downcase.include?("darwin") | |
gem "rb-fsevent" |
require "rubygems" | |
require "rspec" | |
require "factory_girl" | |
RSpec.configure do |config| | |
end | |
Dir.glob(File.join(File.dirname(__FILE__), "factories", "*.rb")).each do |f| | |
load(f) | |
end |
check process unicorn with pidfile "/var/www/rails_apps/pasokara_player/shared/pids/unicorn.pid" | |
start program = "/bin/su - joker bash -c '. /home/joker/.rvm/scripts/rvm; cd /var/www/rails_apps/pasokara_player/current; bundle exec unicorn_rails -D -E production -p 8000'" | |
with timeout 20 seconds | |
stop program = "/bin/su - joker bash -c '/bin/kill -QUIT `/bin/cat /var/www/rails_apps/pasokara_player/shared/pids/unicorn.pid`'" | |
if totalmem > 500 MB for 2 cycles | |
then exec "/bin/kill -HUP `/bin/cat /var/www/rails_apps/pasokara_player/shared/pids/unicorn.pid`" | |
if 2 restarts within 3 cycles then timeout | |
if cpu usage > 95% for 3 cycles then restart | |
# vim:ft=monitrc |
require "shellwords" | |
require "open3" | |
module FFmpegInfo | |
FFMPEG = `which ffmpeg`.chop | |
def self.getinfo(input) | |
video = {} | |
audio = {} | |
duration = 0 |