Skip to content

Instantly share code, notes, and snippets.

# Prefix
set-option -g prefix C-u
# History mode
set-option -g history-limit 10000
# emacs mode
set-window-option -g mode-keys emacs
# default color
set-option -g default-terminal screen-256color
# Font code for status line
#
escape ^j^j
vbell off
hardstatus alwayslastline "[%02c] %`%-w%{=b bw}%n %t%{-}%+w"
startup_message off
autodetach on
[core]
editor = emacs
[user]
email = [email protected]
name = pochi.black
[color]
ui = auto
[alias]
s = status
ci = commit
@pochi
pochi / gem_fetcher.rb
Created April 19, 2012 02:17
Fetch gem file from Gemfile.lock for can not connect gem server.
# coding: utf-8
# ex) ruby gem_fetcher.rb #{TARGET_Gemfile.lock}
INSTALL_REGEXP = /^ ([a-zA-Z].+) ¥((.+)¥)$/
open(ARGV[0]).each_line do |line|
if match_data = INSTALL_REGEXP.match(line).to_a and !match_data.empty?
gem_file_name = match_data[1]
gem_versin = match_data.last
system "gem fetch #{gem_file_name} -v #{gem_version}"
* TCP backlogのOS側の設定はどこにあるのか?
** portごとにいくつキューを持つか設定できる
** RedhatのOSパラメータで持ってる
** C言語でSocket数を制限できるのか調査!
*** Listen BackLogはApache側で設定できるがOSにより設定されている場合はOS側が優先される
* 実質ApacheでSSLしない理由
** コストが高い。Apacheの台数分ベリサインに申請する必要がある。
*** SSLつき負荷分散で実現
** 性能が落ちてしまう
#!/usr/bin/env ruby
require 'rubygems'
require 'eventmachine'
require 'libwebsocket'
module EchoServer
def post_init
puts "someone with websocket!"
end
#!/usr/bin/env ruby
require 'rubygems'
require 'eventmachine'
require 'libwebsocket'
module EchoServer
def post_init
puts "someone with websocket!"
end
# coding: utf-8
require "socket"
require 'libwebsocket'
require 'eventmachine'
class WebSocket
def initialize(url, params = {})
@hs ||= LibWebSocket::OpeningHandshake::Client.new(:url => url, :version => params[:version])
# coding: utf-8 [1/9254]
require "sinatra"
require "json"
@@clients = []
get "/login.json" do
@@clients << { :id => params[:id], :unreads => [] }
# encoding: utf-8
require "net/http"
threads = []
def ping_pong(num)
Net::HTTP.start("localhost", 4567) do |http|
http.get("/login.json?id=#{num.to_s}")
end