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
# encoding : utf-8 | |
# usdge : ruby ac_lank.rb num user_name | |
# example : ruby ac_lank.rb 002 takkaw | |
require 'nokogiri' | |
require 'open-uri' | |
arc = ARGV.shift.to_i | |
url = "http://arc%03d.contest.atcoder.jp/standings/" % arc | |
user = "/users/" + ARGV.shift |
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 'open-uri' | |
open('http://item.rakuten.co.jp/dj/microkorgxl/') { |cont| | |
p !!(/売り切れました/ =~ cont.read.encode!('UTF-8')) | |
} |
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
Earthquake.init do | |
command :amend do |m| | |
name = twitter.info["name"] | |
id = twitter.user_timeline(:screen_name => name).first["id_str"] | |
tweet = twitter.status(id) | |
async_e { | |
twitter.status_destroy(id) | |
twitter.update(m[1]) | |
} if confirm("amend '#{m[1]}'") | |
end |
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
Earthquake.init do | |
command :delete do | |
name = twitter.info["name"] | |
id = twitter.user_timeline(:screen_name => name).first["id_str"] | |
tweet = twitter.status(id) | |
async_e { twitter.status_destroy(id) } if confirm("delete '#{tweet["text"]}'") | |
end | |
end |
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 | |
Earthquake.init do | |
command :search_ja do |m| | |
search_options = config[:search_options] ? config[:search_options].dup : {} | |
search_options.merge! :lang => "ja" | |
puts_items twitter.search(m[1], search_options)["results"].each { |s| | |
s["user"] = {"screen_name" => s["from_user"]} | |
s["_disable_cache"] = true | |
words = m[1].split(/\s+/).reject{|x| x[0] =~ /^-|^(OR|AND)$/ }.map{|x| | |
case x |
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
#.termtter/config | |
config.search.option = { | |
:lang => 'ja' , | |
:since => (Time.now.utc - 60*60*24*6).strftime("%Y-%m-%d") | |
} | |
# http://bit.ly/hlfxoj |
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
require 'open-uri' | |
require 'optparse' | |
url = 'http://www.ietf.org/rfc/' | |
pager = ENV['PAGER'] || 'less' | |
force_get = false | |
opts = OptionParser.new | |
opts.on("-f"){ force_get = true } | |
opts.parse!(ARGV) |
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
# Another getc method with Curses module. | |
# You can get only one character. | |
module Curses | |
def self.curses_proc | |
Curses::init_screen | |
ret = yield | |
Curses::close_screen | |
return ret | |
end | |
end |
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
Github T-shirts をいっしょに買って送料を節約しませんか? | |
2-200枚なら送料が一律 $11 だそうですよ。 | |
http://rubyrags.com/products/10 | |
東京近郊で渡せる方がよいです。 | |
我もと思うかたは fork me. | |
- fork youのやつSサイズを1枚 |
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
#DSC resizer with Ruby | |
Dir.glob('*.JPG') { |file| | |
`convert -resize 320x240 #{file} #{file.downcase}` | |
} |