This file contains hidden or 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 'rubygems' | |
require 'json' | |
require 'rest-client' | |
require 'mechanize' | |
agent = Mechanize.new | |
res = agent.post( 'https://www.virustotal.com/api/get_file_report.json', | |
'key' => 'your key', | |
'resource' => 'file hash(md5/sha1/sha256)' ) |
This file contains hidden or 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
def tip(msg); puts; puts msg; puts "-"*100; end | |
# | |
# 30 Ruby 1.9 Tips, Tricks & Features: | |
# http://www.igvita.com/2011/02/03/new-ruby-19-features-tips-tricks/ | |
# | |
tip "Upgrading to Ruby 1.9 is simple: rvm install 1.9.2 && rvm --default 1.9.2" | |
tip "Ruby 1.9 supports named captures in regular expressions!" |
This file contains hidden or 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 is a demonstration of using SQLite3's Virtual File System API in Ruby. | |
# | |
# == Synopsis | |
# | |
# This program will store it's SQLite database after the __END__ line. | |
# | |
# === In Detail | |
# | |
# SQLite3 uses the DATABase class as a proxy for our IO object. Upon |
This file contains hidden or 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 -*- | |
# | |
# Earthquakeを実況モードにするプラグインです | |
# 普通に起動した後 | |
# :tsunami #K-ON #tbs | |
# のようにして実況モードに入ります | |
# | |
# すると #K-ON (空白区切りで最初のキーワードのみ) で検索した結果が | |
# リアルタイムに更新されます | |
# |
This file contains hidden or 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
# earthquake.gem plugin | |
# shorten url using bit.ly | |
Earthquake.init do | |
_ = config[:bitly] ||= {} | |
_[:username] ||= '' | |
_[:api_key] ||= '' | |
_[:domain] ||= 'j.mp' | |
_[:only_long_tweet] ||= false | |
This file contains hidden or 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
# user_filter plugin | |
# ==== | |
# | |
Earthquake.init do | |
_ = config[:user_filter] ||= {} | |
_[:enable] ||= true | |
_[:default] ||= :show # :show or :hide | |
_[:excludes] ||= [] | |
_[:includes] ||= [] |
This file contains hidden or 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
# keyword plugin | |
# ==== | |
# | |
# config example: | |
# | |
# Earthquake.config[:keyword] = {:pattern => /ruby|rails|earthquake/i} | |
# | |
Earthquake.init do | |
config[:keyword] ||= {} | |
config[:keyword][:pattern] ||= /ruby|rails|earthquake/i |
This file contains hidden or 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
# event_notifier plugin | |
Earthquake.init do | |
output do |item| | |
if item["event"] && item["source"]["screen_name"] != twitter.info["screen_name"] | |
notify "#{item["source"]["screen_name"]} => #{item["target"]["screen_name"]}" + | |
(item["target_object"] ? " : #{item["target_object"]["text"].u}" : ""), | |
:title => "[#{item["event"]}]" | |
end | |
end | |
end |
This file contains hidden or 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 | |
Earthquake.init do | |
once do | |
config[:prompt] = twitter.info['screen_name'] + config[:prompt] | |
end | |
end |
This file contains hidden or 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
Earthquake.init do | |
config[:imgur] ||= {api_key: '5cb04404b1ff26a88cbfe42de5aba23f'} | |
command :imgur do | |
require 'tempfile' | |
image_path = Tempfile.open('imgur').path | |
puts "capture an image from the screen!" | |
system 'screencapture', '-s', image_path # NOTE: Mac only :( | |
unless File.size(image_path) == 0 | |
input ":imgur #{image_path}" |
OlderNewer