Skip to content

Instantly share code, notes, and snippets.

View mh61503891's full-sized avatar
🍣

Masayuki Higashino mh61503891

🍣
View GitHub Profile
@mh61503891
mh61503891 / gist:900218
Created April 3, 2011 05:25
Gmail Fetcher
#! ruby
# -*- coding: utf-8 -*-
# CONFIG
IMAP_USER=''
IMAP_PASS=''
# MAIN
require 'net/imap'
require 'parsedate'
FROMS = %w{
@mh61503891
mh61503891 / gist:949497
Created April 30, 2011 07:01
Tree to OPML1.0
-- Readme
-- Tree.app1.6.2でOPML1.0でエクスポートするAppleScript.
-- [注意] GUI Scriptingでゴリ押しなのでTree.appのバージョンが違うと誤作動する可能性がある.
-- [注意] 同名の.opmlファイルが存在する場合は上書きされる.
-- References
-- AppleScript Help - Apple - http://docs.info.apple.com/help/guide.html?path=AppleScript/2.1/jp/
-- AppleScriptの構造を上手に調べる - http://allabout.co.jp/gm/gc/80938/3/
tell application "Tree"
activate
@mh61503891
mh61503891 / gist:1602333
Created January 12, 2012 18:48
OKWebのパートナーサイトからOKWeb本家の印刷用ページにジャンプするブックマークレット
javascript:location.href='http://okwave.jp/print/qa/q' + location.pathname.match(/\d+/) +'.html'
@mh61503891
mh61503891 / tex_to_multibyte_lines.sh
Created January 12, 2012 19:05
TeXソースファイルから全角文字が含まれている行を行番号付きで表示するRubyスクリプト
#!/bin/sh
# Example: $ cat example.txt | this_script
# This script works only for ruby 1.9.x
ruby1.9 -e 'while l=gets;puts "#{$stdin.lineno} #{l}" if l !~ /\A\s*%/&&!l.each_char.select{|c|c.bytesize!=1}.empty?;end'
@mh61503891
mh61503891 / mp4_to_m4a.sh
Created January 13, 2012 05:12
OSXでMP4動画からAAC音声抽出するShellスクリプト
#!/bin/sh
# == References
#
# * OSXでMP4動画からAAC音声抽出
# http://d.hatena.ne.jp/ikki_j/20080304/1204629353
# > H.264+AACなMP4動画から再コンパイルなしでAAC音声のみを抽出する方法。
#
# * EvalVid - A Video Quality Evaluation Tool-set Pre-compiled binaries (static)
# http://www2.tkn.tu-berlin.de/research/evalvid/fw.html#bin
@mh61503891
mh61503891 / gist:1628031
Created January 17, 2012 18:37
DummynetをDebian6でビルドできるようにするためのパッチ
--- ipfw3/dummynet2/Makefile.orig 2012-01-18 02:51:29.000000000 +0900
+++ ipfw3/dummynet2/Makefile 2012-01-18 02:51:42.000000000 +0900
@@ -55,8 +55,8 @@
ipfw-cflags += -D_BSD_SOURCE
ipfw-cflags += -DKERNEL_MODULE # build linux kernel module
# the two header trees for empty and override files
-ipfw-cflags += -I $(M)/include_e
-ipfw-cflags += -I $(M)/include
+ipfw-cflags += -I$(M)/include_e
+ipfw-cflags += -I$(M)/include
@mh61503891
mh61503891 / gist:2348523
Created April 10, 2012 05:44
ネストしたイテレート処理の比較(Java、Ruby、Prolog)
※0オリジンか1オリジンという意味では等価なコードではない。
// written in Java
for(int k = 0, k < K, k++)
for(int j = 0, j < J, j++)
for(int i = 0, i < I, i++)
execute(i, j, k);
# written in Ruby
@mh61503891
mh61503891 / judy-to-dictionary.rb
Created July 9, 2012 05:03
「Judy先生の英語科学論文の書き方」付属のCD-ROMのデータをDictionary.app用のXMLデータに変換するスクリプト
#!/opt/local/bin/ruby1.9
# encoding: utf-8
# 「Judy先生の英語科学論文の書き方」[1]付属のCD-ROMのデータを
# Dictionary.app用のXMLデータに変換するスクリプト。
# Usage :: ruby1.9 judy-to-dictionary.rb > MyDictionary.xml && make && make install
#
# Author :: Masayuki Higashino
#
# References ::
@mh61503891
mh61503891 / opac.rb
Created July 31, 2012 21:23
OPAC所蔵確認スクリプト
#! ruby
# -*- coding: utf-8 -*-
# OPAC所蔵確認スクリプト
# Usage :: $ cat isbn-keyword-list.txt | ruby opac.rb
# Author :: Masayuki Higashino
# Note :: 本スクリプトは某サイト専用です。OPACのインタフェースはWebサイ
# トによって異なるので某サイト以外では使えません。
#
# CONFIG
@mh61503891
mh61503891 / gist:3220732
Created July 31, 2012 21:27
ニコニコ動画からニコニコビューアにジャンプするブックマークレット
javascript:location.href='http://nicoviewer.net/'+location.href.match(/sm\d+/)