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
#!/bin/bash | |
# macでフォーマットしたipodをWindowsに持ってきたときUnicodeの正規化により | |
# 困ったことになるのを解消 | |
# Windows上で、cygwinとnkfが入っている環境を想定。 | |
CMD_NKF=nkf32 | |
CMD_AWK=gawk | |
IFS=$'\n' |
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
# 事前に、環境変数 APP_NAME、PROWL_APIを設定しておく | |
# | |
# なお、下記ソースではエラーの重複排除を行っていないため | |
# 連続エラーで大量に送信されることになるので注意 | |
require 'prowler' | |
# prowlの困ったところとして、メッセージの終端がきちんと表示出来ないことがある。 | |
# そのため、メッセージに改行2つ付け加えてます。 | |
def notify_sys_error(msg) |
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 |
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
# 数値文字参照ではなく、文字実体参照への変換 | |
# なお、実際使う際はメソッド名"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
# 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
# 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
# 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
# -*- 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
# androidのアウトラインプロセッサ "Outliner"から | |
# Windowsのアウトラインプロセッサ "あうとら"へのファイル変換 | |
# | |
# Outlinerでは、「bonsai CSV (UTF-8)」としてエクスポート。 | |
# あうとらでは、インポートメニューから取り込み。 | |
require "csv" | |
csv_file_name = ARGV[0] | |
unless csv_file_name =~ /\.csv$/ |