Skip to content

Instantly share code, notes, and snippets.

@takkaw
takkaw / ac_lank.rb
Created May 2, 2012 15:03
AtCoder lanking
# 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
@takkaw
takkaw / microKORG_XL_soldout.rb
Created February 26, 2012 10:58
microKORG XL soldout checker.
# coding: UTF-8
require 'open-uri'
open('http://item.rakuten.co.jp/dj/microkorgxl/') { |cont|
p !!(/売り切れました/ =~ cont.read.encode!('UTF-8'))
}
@takkaw
takkaw / gist:1506251
Created December 21, 2011 14:36
earthquake.gem amend plug_in
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
@takkaw
takkaw / gist:1506221
Created December 21, 2011 14:28
earthquake.gem delete plug_in without id
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
@takkaw
takkaw / search_ja.rb
Created November 5, 2011 13:35
earthquake.gem search plug_in from japanese
# 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
@takkaw
takkaw / gist:718591
Created November 28, 2010 04:29
twitter search example termtter config with lang option
#.termtter/config
config.search.option = {
:lang => 'ja' ,
:since => (Time.now.utc - 60*60*24*6).strftime("%Y-%m-%d")
}
# http://bit.ly/hlfxoj
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)
# 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
Github T-shirts をいっしょに買って送料を節約しませんか?
2-200枚なら送料が一律 $11 だそうですよ。
http://rubyrags.com/products/10
東京近郊で渡せる方がよいです。
我もと思うかたは fork me.
- fork youのやつSサイズを1枚
#DSC resizer with Ruby
Dir.glob('*.JPG') { |file|
`convert -resize 320x240 #{file} #{file.downcase}`
}