Skip to content

Instantly share code, notes, and snippets.

require 'rubygems'
require 'net/imap'
require 'kconv'
require 'pit'
require 'logger'
class ImapFetcher
def initialize(pit_name)
@pit = Pit.get(
import sys
import re
import yaml
if len(sys.argv) != 2:
print 'Usage: python %s <mod_name>' % sys.argv[0]
quit()
mod_name = sys.argv[1]
mod = __import__(mod_name)
@mirakui
mirakui / make_token.rb
Created May 3, 2010 13:05
To get twitter/oauth access token
require 'twitter_oauth'
print 'Consumer Key> '
consumer_key = gets.chomp
print 'Consumer Secret> '
consumer_secret = gets.chomp
t = TwitterOAuth::Client.new(
:consumer_key => consumer_key,
@mirakui
mirakui / auto_growlnotify.sh
Created May 11, 2010 03:58
Pops up a growl notification when a command spends over 5 seconds
# source: http://d.hatena.ne.jp/umezo/20100508/1273332857
local COMMAND=""
local COMMAND_TIME=""
function precmd() {
if [ "$COMMAND_TIME" -ne "0" ] ; then
local d=`date +%s`
d=`expr $d - $COMMAND_TIME`
if [ "$d" -ge "5" ] ; then
COMMAND="$COMMAND "
@mirakui
mirakui / Gemfile
Created July 19, 2010 09:44
AWS S3 read/write Benchmark
source :gemcutter
gem 'pit'
gem 'sauberia-aws-s3'
@mirakui
mirakui / imlib2_magick_benchmark2.rb
Created July 24, 2010 04:29
Benchmark Imlib2 vs ImageMagick
require "rubygems"
require "benchmark"
require "imlib2"
N = (ARGV.shift || 1).to_i
def bench(title)
puts "\nBenchmark: #{title} (#{N} times)"
Benchmark.bm(7, ">total:", ">avg:") do |bm|
@mirakui
mirakui / awsconsoleactivator.user.js
Created September 27, 2010 02:55
AWS Console Activator
// ==UserScript==
// @name AWS Console Activator
// @description AWS Console Activator
// @match https://console.aws.amazon.com/*
// ==/UserScript==
(function() {
var interval = 1000*60;
setInterval(function() {$("#refresh_btn-button").click()}, interval);
})();
@mirakui
mirakui / dmm_util.user.js
Created October 10, 2010 02:14
dmm_util.user.js
// ==UserScript==
// @name DMM Util
// @description DMM Utility
// @match http://www.dmm.co.jp/*
// ==/UserScript==
(function() {
function replaceImg(img) {
var src = img.src
img.onload = function(){
img.width = img.naturalWidth;
@mirakui
mirakui / mirakui_chrome_keyconfig.json
Created November 4, 2010 09:14
Chrome Keyconfig Config
{
"name": "Chrome Keyconfig",
"version": "1.13.1",
"normal_actions": {
"j": {
"name": "scroll down",
"args": []
},
"k": {
"name": "scroll up",