This file contains 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 | |
# -*- coding: utf-8; -*- | |
# | |
# scraping nikkei.com for Kindle | |
# | |
require 'nokogiri' | |
require 'open-uri' | |
TOP = 'http://www.nikkei.com' |
This file contains 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 | |
# | |
# Convert tDiary's documents from HikiDoc to Markdown | |
# | |
# Copyright (C) Tada, Tadashi <t@tdtds.jp> | |
# | |
require 'open-uri' | |
require 'nokogiri' | |
require 'cgi' |
This file contains 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 | |
# | |
# tsite.rb: getting current T-Point by scraping tsite.jp. | |
# | |
# Copyright (C) 2011 by TADA Tadashi <t@tdtds.jp> | |
# Distributed under GPL. | |
# | |
require 'rubygems' | |
require 'mechanize' |
This file contains 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 | |
require 'open-uri' | |
require 'rexml/document' | |
def metainfo(isbn) | |
uri = 'http://rpaproxy.tdiary.org/rpaproxy/jp/' | |
uri << "?Service=AWSECommerceService" | |
uri << "&SubscriptionId=1CVA98NEF1G753PFESR2" | |
uri << "&Operation=ItemLookup" |
This file contains 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 'zlib' | |
module Rack | |
class UnknownCompressMethod < StandardError; end | |
class RequestDecompressor | |
def initialize(app) | |
@app = app | |
end |
This file contains 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 | |
require 'mongoid' | |
class Agent | |
include Mongoid::Document | |
field :guid, type: String | |
validates :guid, uniqueness: true | |
has_many :commands | |
end |
This file contains 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
define puppet::module( | |
$ensure = installed, | |
){ | |
$module = regsubst($name, '^.*?-(.*)$', '\1') | |
if $ensure == installed { | |
exec { "install": | |
path => ['/bin', '/usr/local/bin'], | |
command => "puppet module install ${name}", | |
creates => "/etc/puppet/modules/${module}", | |
} |
This file contains 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
javascript:jQuery('span.headerStatus').each(function(){var e=jQuery(this);e.append(jQuery('<a>').attr('href',e.attr('id').replace(/^Row.*_/,'javascript:Fion.deleteItem("deleteItem_')+'");return false;').text('×'))}) |
This file contains 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 | |
cols = (ARGV[0] || 5).to_i - 1 | |
rows = (ARGV[1] || 9).to_i | |
begin | |
table = (0...rows).map do |i| | |
(0...cols).map { rand(2) }.join | |
end | |
end until table.join =~ /1/ |
This file contains 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
# | |
# This command was obsolete. see also https://github.com/tdtds/aozoragen | |
# | |
#!/usr/bin/env ruby | |
# -*- coding: utf-8; -*- | |
# | |
# usage: renzaburo2aozora <URL> | |
# URL: the index of a novel in renzaburo, only HTML version NOT Flash. | |
# |
NewerOlder