This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# nginx - this script starts and stops the nginx daemon | |
# | |
# chkconfig: - 85 15 | |
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \ | |
# proxy and IMAP/POP3 proxy server | |
# processname: nginx | |
# config: /etc/nginx/nginx.conf | |
# config: /etc/sysconfig/nginx |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dice(max = 6) | |
(rand() * max).to_i + 1 | |
end | |
# 1. まずrubyの乱数(rand)の性質を調べる | |
puts "ruby rand() test" | |
d = {} | |
1000.times{ | |
n = dice | |
d[n] ||= 0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'sinatra' | |
require 'sinatra/streaming' | |
set server: 'thin', connections: [] | |
th = Thread.new{ | |
while true | |
puts "currently connection: #{settings.connections.size}" | |
settings.connections.each{ |e| | |
e << "yes\n" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
STEAMTM SUBSCRIBER AGREEMENT | |
This Agreement is written only in the English language, which language will be controlling in all respects. All communications to be made or given pursuant to this Agreement will be in the English language, except as may be required under applicable law. | |
1. REGISTRATION AND ACTIVATION. | |
Steam is an online service (.Steam.) offered by Valve Corporation (.Valve.). | |
You become a subscriber of Steam (.Subscriber.) by installing the Steam client software and completing the Steam registration. Additionally, as a Subscriber you may obtain access to certain services, software and content (.Subscriptions.) available to Subscribers. This Steam Subscriber Agreement (.Agreement.) is a legal document that explains your rights and obligations as a Subscriber. Please read it carefully. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# RubyのHTML/XMLパーサー、nokogiriの間違えやすい問題について | |
# Nokogiri関数に渡すXMLデータのどこかのタグの属性値に"HTML"という文字が含まれていると、 | |
# HTML文書として解釈され、<html><body>というのが勝手に挿入される。そのため本来マッチするはずのXPathがマッチしなくなったりする。 | |
# | |
# Nokogiri::XMLかNokogiri::HTMLを使いましょう! (当たり前) | |
# でも属性値にHTMLという文字が含まれてるだけでHTML文書として解釈するのはまずい気がする。。 | |
# | |
# ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0] | |
# nokogiri (1.5.0) | |
require 'nokogiri' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
# encoding: utf-8 | |
# Author: kimoto | |
require 'open-uri' | |
require 'base64' | |
require 'openssl' | |
ssh_rsa_path = File.join(ENV['HOME'], ".ssh/id_rsa") | |
ssh_rsa = File.read(ssh_rsa_path) | |
pubkey = OpenSSL::PKey::RSA.new(ssh_rsa).public_key.to_s |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
# encoding: utf-8 | |
# Author: kimoto | |
require 'openssl' | |
ssh_rsa_path = File.join(ENV['HOME'], ".ssh/id_rsa") | |
ssh_rsa = File.read(ssh_rsa_path) | |
print OpenSSL::PKey::RSA.new(ssh_rsa).public_key.to_s | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# vim:encoding=UTF-8: | |
=begin | |
# gig.rb | |
Github IRC Gateway | |
=end | |
require "logger" | |
require "ostruct" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parallel.each(last_infos, :in_threads => 4){ |last_info| | |
begin | |
Proc.new do | |
timeout(20) do | |
Peercast::Screenshot.new(last_info.url).download_to(download_path) | |
end | |
last_info.capture = download_path | |
last_info.save | |
end.retry(:max => 3, :accept_exception => Timeout::Error, :logger => Logger.new(STDERR)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env ruby | |
# encoding: utf-8 | |
# Author: kimoto | |
require 'net/irc' | |
require 'net/irc/mala' | |
require 'rss' | |
require 'open-uri' | |
class Net::IRC::HateFav < Net::IRC::Server::Session | |
def server_name |