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
# http://www.diigo.com/tools/exportからRSS Formatで取得したファイルを | |
# import.txtとして保存して実行 | |
# 量が多いと、Rate Limit Exceededになるので注意 | |
require "cgi" | |
require "net/https" | |
ril = File.read("import.txt") | |
unread = ril.scan(%r{<link>(.*?)</link>}m) |
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
# Windowsのアウトラインプロセッサ "あうとら"から | |
# androidのアウトラインプロセッサ "Outliner"へのファイル変換 | |
# | |
# あうとらでは、「階層付きテキスト」としてエクスポート。 | |
# Outlinerでは、「bonsai CSV (UTF-8)」としてインポート。 | |
require "csv" | |
def write_page(w, l, t, b) | |
line = [t, 0, 1, (l - 1), 0, 2, 0, "", "", "", "", "Unfiled", "", "", b] |
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
# androidのアウトラインプロセッサ "Outliner"から | |
# Windowsのアウトラインプロセッサ "あうとら"へのファイル変換 | |
# | |
# Outlinerでは、「bonsai CSV (UTF-8)」としてエクスポート。 | |
# あうとらでは、インポートメニューから取り込み。 | |
require "csv" | |
csv_file_name = ARGV[0] | |
unless csv_file_name =~ /\.csv$/ |
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
# -*- coding: utf-8 -*- | |
# icloudに格納したメモ帳をテキストファイルとしてダウンロードする | |
# ファイル名は、[更新日付-タイトル.txt] | |
require 'mail' | |
require 'cgi' | |
account = '(ユーザ名)@me.com' | |
pass = '(パスワード)' |
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
# instapaper文字化け再登録ツール (エッセンス版) | |
# 利用にはOauthキーが必要ですので、Webサービス化する予定です。 | |
# | |
# 利用に関して | |
# ・ 修正したRead Laterは、再登録するため登録日付が「今」に変更されます。 | |
# (表示順が逆転します) | |
# ・ 有料会員である必要があります | |
# (InstapaperのFull APIの利用規約がそうなっている) | |
require 'open-uri' |
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
# Sinatra::ContribのConfigFileに対して、RACK_ENV(settings.environment) | |
# に依存しないパラメータを記述可能にする | |
# | |
# 例: | |
# | |
# 通常ならば、以下の通り共通的な値「settings.aaa」も複数記述する必要がある | |
# ------ yaml の内容(before) ---------------------------- | |
#development: | |
# database: AAA | |
# aaa: info |
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
# googleのstarred-items-jas.jsonのままだと処理しにくいため、 | |
# 一度単純なデータに変換する | |
# | |
# ファイル"bookmarks.json"に「登録時刻(time)/タイトル(title)/URL(url)」の | |
# 行列となったjsonファイルをはき出す | |
# | |
# 「情報をエクスポート」→「JSON アクティビティ ストリーム」から取得 | |
require 'json' | |
require 'time' |
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
# 数値文字参照ではなく、文字実体参照への変換 | |
# なお、実際使う際はメソッド名"charref"は変更してください。 | |
CGI.class_eval do | |
class << self | |
attr_accessor :char_ref | |
alias :orig_unescapeHTML :unescapeHTML | |
def unescapeHTML(str) | |
result = orig_unescapeHTML(str) | |
result.gsub!(/&\w*;/) { |ent| @char_ref[ent]} |
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
# 「192.168.0.0/24」の様なIPレンジ指定のテキストファイルを読み込み、 | |
# 該当IPアドレスかどうかをチェックする。 | |
# | |
# (制約) ネットワークアドレス長を9以上で指定する必要があります。 | |
# | |
# ・使い方 | |
# initialize - テキストファイルをパラメータとして指定 | |
# contain? - IPアドレスが含まれていたら true | |
class IPFilter |
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
34 quot | |
38 amp | |
60 lt | |
62 gt | |
160 nbsp | |
161 iexcl | |
162 cent | |
163 pound | |
164 curren | |
165 yen |
OlderNewer