• Stars
    star
    661
  • Rank 68,192 (Top 2 %)
  • Language
    Ruby
  • License
    MIT License
  • Created over 13 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Twitter terminal client with streaming API support.

Earthquake

Terminal-based Twitter Client with Streaming API support. Only supports Ruby 1.9 and later.

Homepage: https://github.com/jugyo/earthquake
Twitter: http://twitter.com/earthquakegem
Changelog'd: earthquake: Twitter terminal client with streaming API support
Demo: http://www.youtube.com/watch?v=S2KtBGrIe5c
Slide: http://www.slideshare.net/jugyo/earthquakegem

We need patches that fix the english of the documentation!

http://images.instagram.com/media/2011/03/21/862f3b8d119b4eeb9c52e690a0087f5e_7.jpg

Features

  • Use Twitter entirely in your Terminal.
  • Receive data in real time with Streaming API.
  • Easily extend using Ruby.

Install

Quick-installation using Docker (http://docker.io)

Just clone the repo and:

$ docker build -t earthquake . --build-arg TZ='Asia/Tokyo'
$ docker run --rm -v $HOME/.earthquake:/root/.earthquake -it earthquake

Launch with options:

$ docker run -v $HOME/.earthquake:/root/.earthquake -it earthquake --no-stream --no-logo

Normall installation

You'll need openssl and readline support with your 1.9.2. If you are using rvm you can run:

$ rvm pkg install openssl
$ rvm pkg install readline
$ rvm remove 1.9.2
$ rvm install 1.9.2 --with-openssl-dir=$HOME/.rvm/usr \
  --with-readline-dir=$HOME/.rvm/usr

Then install the gem:

$ gem install earthquake

Ubuntu: EventMachine needs the package libssl-dev.

$ sudo apt-get install libssl-dev

Command-Line Usage

Launch

$ earthquake

Help

โšก :help

Tweet

โšก Hello World!

Show

โšก $xx

$xx is the alias of tweet id.

Reply

โšก $xx hi!

Delete

โšก :delete $xx

Retweet

โšก :retweet $xx

Timeline

โšก :recent
โšก :recent jugyo

Lists

โšก :recent yugui/ruby-committers

Search

โšก :search #ruby

Eval

โšก :eval Time.now

Exit

โšก :exit

Reconnect

โšก :reconnect

Restart

โšก :restart

Threads

โšก :thread $xx

Install Plugins

โšก :plugin_install https://gist.github.com/899506

Alias

โšก :alias :rt :retweet

Tweet Ascii Art

โšก :update[ENTER]
[input EOF (e.g. Ctrl+D) at the last]
    โšก
   โšก
    โšก
   โšก
^D

View Ascii Art

# permanently
โšก :eval config[:raw_text] = true

# temporarily(with :status, :recent or :thread etc...)
โšก :aa :status $aa

Stream Filter Tracking

# keywords
โšก :filter keyword earthquakegem twitter

# users
โšก :filter user jugyo matsuu

# return to normal user stream
โšก :filter off

Show config

# All config
โšก :config

# config for :key
โšก :config key

Set config

# set config for :key to (evaluated) value
โšก :config key 1 + 1
{
    :key => 2
}
โšก :config key {foo: 1, bar: 2}
{
    :key => {
        :foo => 1,
        :bar => 2
    }
}
# merge new config if both are Hash
โšก :config key {bar: 3}
{
    :key => {
        :foo => 1,
        :bar => 3
    }
}

And more!

Configuration

The default earthquake directory is ~/.earthquake.

The config file is ~/.earthquake/config.

Changing the earthquake directory

You can change the directory at launch by entering a directory as an argument. For example:

$ earthquake ~/.earthquake_foo

Changing the colors for user name

# ~/.earthquake/config
# For example, to exclude blue:
Earthquake.config[:colors] = (31..36).to_a - [34]

Changing the color scheme

# ~/.earthquake/config
Earthquake.config[:color] = {
  :info => 34,
  :notice => 41,
  :event  => 46,
  :url => [4, 34]
}

Tracking specified keywords

# ~/.earthquake/config
Earthquake.config[:api] = {
  :method => 'POST',
  :host => 'stream.twitter.com',
  :path => '/1/statuses/filter.json',
  :ssl => true,
  :filters => %w(Twitter Earthquake)
}

Tracking specified users

# ~/.earthquake/config
Earthquake.config[:api] = {
  :method => 'POST',
  :host => 'stream.twitter.com',
  :path => '/1/statuses/filter.json',
  :ssl => true,
  :params => {
    :follow => '6253282,183709371' # @twitterapi @sitestreams
  }
}

Defining aliases

# ~/.earthquake/config
Earthquake.alias_command :rt, :retweet

Default confirmation type

# ~/.earthquake/config
Earthquake.config[:confirm_type] = :n

HTTP proxy support

Please set environment variable http_proxy if you want earthquake to use an http proxy.

Desktop Notifications

To enable desktop notifications, install one of the following:

Call Earthquake.notify for desktop notification. You can try it by using the :eval command:

โšก :eval notify 'Hello World!'

Plugins

See https://github.com/jugyo/earthquake/wiki

Making Plugins

~/.earthquake/plugin is the directory for plugins. At launch, Earthquake tries to load files under this directory. The block that is specified for Earthquake.init will be reloaded at any command line input.

Defining your commands

A command named 'foo':

Earthquake.init do
  command :foo do
    puts "foo!"
  end
end

Handling the command args:

Earthquake.init do
  command :hi do |m|
    puts "Hi #{m[1]}!"
  end
end

'm' is a http://www.ruby-doc.org/core/classes/MatchData.html object.

Using regexp:

Earthquake.init do
  # Usage: :add 10 20
  command %r|^:add (\d+)\s+(\d+)|, :as => :add do |m|
    puts m[1].to_i + m[2].to_i
  end
end

Handling outputs

Keyword notifier:

Earthquake.init do
  output do |item|
    next unless item["_stream"]
    if item["text"] =~ /ruby/i
      notify "#{item["user"]["screen_name"]}: #{item["text"]}"
    end
  end
end

Favorite notifier:

Earthquake.init do
  output do |item|
    case item["event"]
    when "favorite"
      notify "[favorite] #{item["source"]["screen_name"]} => #{item["target"]["screen_name"]} : #{item["target_object"]["text"]}"
    end
  end
end

Defining filters for output

Filtering by keywords

Earthquake.init do
  output_filter do |item|
    if item["_stream"] && item["text"]
      item["text"] =~ /ruby/i
    else
      true
    end
  end
end

Replacing the output for tweets

Earthquake.init do
  output :tweet do |item|
    next unless item["text"]
    name = item["user"]["screen_name"]
    puts "#{name.c(color_of(name))}: foo"
  end
end

Defining completion

Earthquake.init do
  completion do |text|
    ['jugyo', 'earthquake', '#eqrb'].grep(/^#{Regexp.quote(text)}/)
  end
end

TODO

  • mark my tweet
  • Earthquake should parse ARGV
  • ruby1.9nize
  • guideline for plugin
  • deal proxy
  • spec

Copyright

Copyright (c) 2011 jugyo. See LICENSE.txt for further details.

More Repositories

1

tunnels

https --(--)--> http
Ruby
374
star
2

eeepub

EeePub is a Ruby ePub generator
Ruby
218
star
3

termtter

moved to https://github.com/termtter/termtter
Ruby
201
star
4

rails-sh

A mini shell for Ruby on Rails 3 that provides a uniform and quick access to commands.
Ruby
114
star
5

sunspot_mongoid

A Sunspot wrapper for Mongoid. **No longer maintained!**
Ruby
112
star
6

g

The Kernel.g that works like Kernel.p by using terminal-notifier or growl.
Ruby
111
star
7

SublimeSnippetMaker

Makes managing snippets easy in Sublime Text
Python
74
star
8

rubytter

Rubytter is a simple twitter library.
Ruby
63
star
9

mocktra

A webmock DSL using sinatra.
Ruby
60
star
10

notify

The notification function for many platforms.
Ruby
59
star
11

get-twitter-oauth-token

The "get-twitter-oauth-token" is a command to get token/secret pair of Twitter OAuth.
Ruby
52
star
12

capy

Capybara Script Runner
Ruby
41
star
13

SublimeColorSchemeSelector

Sublime Text Plugin to select theme quickly via the Quick Panel.
Python
41
star
14

SublimeSuperNavigator

Sublime Text plugin to navigate in the file.
Python
40
star
15

ws-io

The bridge between WebSocket and IO
Ruby
34
star
16

named_emoji

Named Emojis for the emojis on Campfire and GitHub.
Ruby
31
star
17

SublimeRecentActiveFiles

Sublime Text plugin that shows and opens recent activated files.
Python
25
star
18

gitki

Gitki is a wiki built on Git.
Ruby
24
star
19

termcolor

Termcolor is a library for ANSII color formatting like HTML for output in terminal.
Ruby
21
star
20

ifchanged

Do it, if changed to files.
Ruby
19
star
21

sinatra_on_gae

A sample app of Sinatra on Google App Engine.
Ruby
17
star
22

git2epub

The tool that generate epub from git repository.
Ruby
16
star
23

SublimeRubyEval

Evaluate the selection in โ™ฅโ™ฅโ™ฅRubyโ™ฅโ™ฅโ™ฅ, and print the result.
Python
16
star
24

growl-logger

Logger using Growl.
Ruby
15
star
25

rails-erb-check

A command to check syntax as rails's erb. It provides the rails-erb-check command.
Ruby
15
star
26

cinatra

Cinatra is a Sinatra like command base app library. It is like Sinatra. ใ‚ทใƒผใƒŠใƒˆใƒฉ.
Ruby
15
star
27

twiwt-blog

Twitter based blog tool
Python
15
star
28

ir_b

irb anywhere! ใฉใ“ใงใ‚‚ irb๏ผ
Ruby
14
star
29

pretty_match_data

Pretty MatchData. It provides pretty MatchData#to_s method
Ruby
14
star
30

hamlr

Hamlr is a simple blog tool using haml
Ruby
12
star
31

twitpic

Library and command for TwitPic API.
Ruby
11
star
32

pry-remote-auto

Open the Terminal and run pry-remote automatically
Ruby
11
star
33

flask-gae-template

Template of Google App Engine with Flask.
Python
11
star
34

i81n

Internationalizaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaation
Ruby
11
star
35

scala-examples

Scala
11
star
36

epubcheck

Command-line ePub check tool. It is wrapper of epubcheck(http://code.google.com/p/epubcheck/).
Ruby
11
star
37

SublimeHttpStatusCode

Sublime Text 2 Plugin to look up Http Status Code quickly.
Python
10
star
38

gae-twitter-oauth-example

A Twitter OAuth example on GAE.
Python
10
star
39

SublimeTextAPIHelper

Sublime Text Plugin to show API reference.
Python
9
star
40

SublimeRSpecNavigator

Sublime Text 2 plugin to navigate you in RSpec.
Python
9
star
41

shimeji

Server for recommendation.
Ruby
8
star
42

osx_dict

Make your own dictionary for MacOSX!
Ruby
8
star
43

www

World Wide Web. Still incomplete!!!
Ruby
8
star
44

gist_search

Search your gist
Ruby
7
star
45

jugyo-icon-set

jugyo icon set
7
star
46

TokyoRubyKaigi03

Ruby
7
star
47

rack_prof

Rack middleware for profiling
Ruby
7
star
48

SublimeSimpleTODO

Sublime Text 2 plugin to manage TODO.
Python
7
star
49

ruri

Ruri is the ใ‚‹ใ‚Šใพ shell.
Ruby
7
star
50

poormans_cron

PoormansCron is a poor man's cron for rails.
Ruby
6
star
51

using-picasa-web-albums-data-api

Using Picasa Web Albums Data API
Python
6
star
52

n

"n" is like "g".
Ruby
6
star
53

filetter

Filetter is a pluggable tool for file system.
Ruby
6
star
54

openx_helper

OpenXHelper is a rails plugin for generate html tag for banner of OpenX.
Ruby
6
star
55

super_p

The super p.
Ruby
6
star
56

resque-rails

The railtie for setup resque. It provides an initializer and rake tasks.
Ruby
6
star
57

SublimeRubyToggleString

Sublime Text 2 Plugin to toggle Ruby string literal (e.g. "foo" => 'foo' => %Q{foo}).
Python
5
star
58

twiwt-chat

Chat using Twitter account
Python
5
star
59

recommend

Library for recommendation.
Ruby
5
star
60

web_capture

Web ใ‚ตใ‚คใƒˆใฎใ‚นใ‚ฏใƒชใƒผใƒณใ‚ทใƒงใƒƒใƒˆใ‚’ไฝœๆˆใ™ใ‚‹ใŸใ‚ใฎใƒ„ใƒผใƒซ
JavaScript
5
star
61

piki

wiki ใฟใŸใ„ใช
PHP
4
star
62

gatter

Gatter is a pluggable gateway.
4
star
63

validates_for_convert_encoding

This plugin provides a validation for convert encoding.
Ruby
4
star
64

SublimeSyncScroll

Sublime Text 2 plugin that allows you to do synchronised scroll.
Python
4
star
65

pb

PB is a Clipboard tool that provide pbcopy, pbread, pbpaste. It supports only Mac :)
Ruby
4
star
66

tm_quick_edit

It inserts the links to edit the template with TextMate.
Ruby
4
star
67

InstaCache

InstaCache is a offline tool for the Instapaper.
Ruby
4
star
68

rake-sh

The Rake Shell.
Ruby
4
star
69

SublimeSimpleMarker

Sublime Text plugin to manage highlight markers
Python
4
star
70

ansi_utils

ANSI escape code utils. Move cursor, Erase data, etc...
Ruby
4
star
71

force_require

Force require for Bundler environment! Yeaaaaaaaaaaah!
Ruby
4
star
72

kvs

KVS is a simple key value store.
Ruby
3
star
73

each

A simple command to process each line of ARGF.
Ruby
3
star
74

_p_

just an alias of tapp
Ruby
3
star
75

oh-my-textmate

oh-my-tmbundles
3
star
76

gem_readme

Open gem's README
Ruby
3
star
77

entwi

Web app for social translation
Ruby
3
star
78

HotCocoaTemplate

HotCocoa Application Template
Ruby
3
star
79

carrierwave_mongoid_grid_fs

CarrierWave storage using Mongoid and GridFS
Ruby
3
star
80

instapi

Wrapper of the Instapaper Simple API
Ruby
3
star
81

SublimeGitGrep

Sublime Text Plugin to do git grep.
Python
3
star
82

mtrace

trace calling methods
Ruby
3
star
83

irby

The IRBy allows you to start irb super quickly. ใ‚ขใ‚คใ‚ขใƒผใƒซใƒ“ใ‚ฃ
Ruby
3
star
84

xsbt.g8

giter8 template that makes a simple xsbt project
Scala
2
star
85

tools

tool
2
star
86

css_reload

A Rails plugin to reload CSS per 5 seconds.
Ruby
2
star
87

skeeter-rb

A skeeter client library for ruby.
Ruby
2
star
88

rcicindela

RCicindela is a wrapper library for Cicindela.
Ruby
2
star
89

SublimeTraverse

Sublime Text 2 plugin to traverse directories and open file
Python
2
star
90

rails3_generator_sample

Sample of Rails3 generator
Ruby
2
star
91

SublimeCamelSwitch

CamelSwitch is a plugin for Sublime Text 2. It switches the word between camel case and snake case.
Python
2
star
92

increment_fu

It provides the useful methods for increment or decrement.
Ruby
2
star
93

SublimeAnyNavigator

Sublime Text 2 plugin to navigate you in current file.
Python
2
star
94

MacRubyREPL

REPL on MacRuby.
Ruby
2
star
95

facebook_auth_example

An example of facebook auth by devise + omniauth
Ruby
2
star
96

rail_data_converter

้‰„้“ใƒ‡ใƒผใ‚ฟๅค‰ๆ›ใ‚นใ‚ฏใƒชใƒ—ใƒˆ
Ruby
2
star
97

sinatra_debug_console

Debug console for sinatra
Ruby
2
star
98

nested_attributes_sample

nested attributes sample for rails2.3
Ruby
2
star
99

epub_sample

A sample of ePub
Shell
2
star
100

twitd

Twitd is a twitter daemon.
2
star