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
#!/usr/bin/env ruby | |
module Temperature | |
refine Numeric do | |
def to_fahr | |
self.to_f * 9 / 5 + 32 | |
end | |
def to_cels | |
(self.to_f - 32) * 5 / 9 |
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
Earthquake.init do | |
_ = config[:auto_restart] ||= {} | |
_[:interval] ||= 60 * 60 | |
system "stty echo" # for readline | |
EM.defer do | |
sleep config[:auto_restart][:interval] | |
loop do | |
if Readline.line_buffer.nil? || Readline.line_buffer.empty? |
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
require "date" | |
Earthquake.init do | |
_ = config[:fav_machine] ||= {} | |
_[:dir] ||= File.expand_path("./fav_machine", config[:dir]) | |
_[:screen_names] ||= [twitter.info["screen_name"]] | |
FileUtils.mkdir_p(_[:dir]) unless Dir.exist? _[:dir] | |
output_filter do |item| | |
if item["event"] == "favorite" && config[:fav_machine][:screen_names].include?(item["source"]["screen_name"]) |
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
module TwitterOAuth | |
class Client | |
def update_profile(params) | |
post("/account/update_profile.json", params) | |
end | |
end | |
end | |
Earthquake.init do | |
%w[name description url location].each do |word| |
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
module TwitterOAuth | |
class Client | |
def get_lists(user) | |
get("/lists/list.json?screen_name=#{user}") | |
end | |
end | |
end | |
module Earthquake::Input | |
def lists |
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
require "date" | |
Earthquake.init do | |
_ = config[:save_image] ||= {} | |
_[:dir] ||= File.expand_path("./image", config[:dir]) | |
FileUtils.mkdir_p(_[:dir]) unless Dir.exist? _[:dir] | |
command :save_image do |m| | |
tweet = twitter.status(m[1]) | |
media = tweet["entities"]["media"] |
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
# Earthquake.config[:event_chain] = { | |
# :favorite => [':retweet %{id}'], | |
# :favorited => [':update @%{him} thx 4 ur fav!'], | |
# :followed => ['unblock %{him}', ':follow %{him}'], | |
# } | |
module Earthquake::Input | |
def passivise(str) | |
if str.end_with?("ed") | |
str | |
elsif str.end_with?("e") |
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
description "earthquake server" | |
author "babie <[email protected]>" | |
start on filesystem or runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
respawn limit 10 5 | |
setuid babie |
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
description "earthquake server" | |
author "babie wildheart <[email protected]>" | |
# start,stopは正常に動くがsocat&reptyrで繋いだ時、文字入力に不具合がある | |
start on filesystem or runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
respawn limit 10 5 |
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
description "earthquake server" | |
author "babie wildheart <[email protected]>" | |
start on filesystem or runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
respawn limit 10 5 | |
setuid babie |
OlderNewer