Skip to content

Instantly share code, notes, and snippets.

@drnic
Forked from jashkenas/count_shakespeare.rb
Created September 15, 2009 00:46

Revisions

  1. drnic revised this gist Sep 15, 2009. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion shakespeare_word_count.rb
    Original file line number Diff line number Diff line change
    @@ -33,7 +33,8 @@
    'http://www.gutenberg.org/dirs/etext99/1ws2911.txt', # Troilus and Cressida
    'http://www.gutenberg.org/dirs/etext98/3ws2810.txt', # Twelfth Night
    'http://www.gutenberg.org/files/1539/1539.txt' # The Winter's Tale
    ]
    ],
    'callback_url' => 'http://www.postbin.org/1i7ylr3'

    }.to_json}
    )
  2. drnic revised this gist Sep 15, 2009. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion shakespeare_word_count.rb
    Original file line number Diff line number Diff line change
    @@ -5,7 +5,7 @@

    # Let's count all the words in Shakespeare.

    RestClient.post('http://localhost:9173/jobs',
    RestClient.post('http://cloud-crowd.local/jobs',
    {:job => {

    'action' => 'word_count',
  3. @jashkenas jashkenas revised this gist Sep 10, 2009. 1 changed file with 27 additions and 27 deletions.
    54 changes: 27 additions & 27 deletions shakespeare_word_count.rb
    Original file line number Diff line number Diff line change
    @@ -6,36 +6,36 @@
    # Let's count all the words in Shakespeare.

    RestClient.post('http://localhost:9173/jobs',
    {:job => {
    {:job => {

    'action' => 'word_count',
    'action' => 'word_count',

    'inputs' => [
    'http://www.gutenberg.org/dirs/etext97/1ws3010.txt', # All's Well That Ends Well
    'http://www.gutenberg.org/dirs/etext99/1ws3511.txt', # Anthony and Cleopatra
    'http://www.gutenberg.org/dirs/etext97/1ws2510.txt', # As You Like It
    'http://www.gutenberg.org/dirs/etext97/1ws0610.txt', # The Comedy of Errors
    'http://www.gutenberg.org/dirs/etext99/1ws3911.txt', # Cymbeline
    'http://www.gutenberg.org/dirs/etext00/0ws2610.txt', # Hamlet
    'http://www.gutenberg.org/dirs/etext00/0ws1910.txt', # Henry IV
    'http://www.gutenberg.org/dirs/etext99/1ws2411.txt', # Julius Caesar
    'http://www.gutenberg.org/dirs/etext98/2ws3310.txt', # King Lear
    'http://www.gutenberg.org/dirs/etext99/1ws1211j.txt', # Love's Labour's Lost
    'http://www.gutenberg.org/dirs/etext98/2ws3410.txt', # Macbeth
    'http://www.gutenberg.org/dirs/etext98/2ws1810.txt', # The Merchant of Venice
    'http://www.gutenberg.org/dirs/etext99/1ws1711.txt', # Midsummer Night's Dream
    'http://www.gutenberg.org/dirs/etext98/3ws2210.txt', # Much Ado About Nothing
    'http://www.gutenberg.org/dirs/etext00/0ws3210.txt', # Othello
    'http://www.gutenberg.org/dirs/etext98/2ws1610.txt', # Romeo and Juliet
    'http://www.gutenberg.org/dirs/etext98/2ws1010.txt', # The Taming of the Shrew
    'http://www.gutenberg.org/dirs/etext99/1ws4111.txt', # The Tempest
    'http://www.gutenberg.org/dirs/etext00/0ws0910.txt', # Titus Andronicus
    'http://www.gutenberg.org/dirs/etext99/1ws2911.txt', # Troilus and Cressida
    'http://www.gutenberg.org/dirs/etext98/3ws2810.txt', # Twelfth Night
    'http://www.gutenberg.org/files/1539/1539.txt' # The Winter's Tale
    ]
    'inputs' => [
    'http://www.gutenberg.org/dirs/etext97/1ws3010.txt', # All's Well That Ends Well
    'http://www.gutenberg.org/dirs/etext99/1ws3511.txt', # Anthony and Cleopatra
    'http://www.gutenberg.org/dirs/etext97/1ws2510.txt', # As You Like It
    'http://www.gutenberg.org/dirs/etext97/1ws0610.txt', # The Comedy of Errors
    'http://www.gutenberg.org/dirs/etext99/1ws3911.txt', # Cymbeline
    'http://www.gutenberg.org/dirs/etext00/0ws2610.txt', # Hamlet
    'http://www.gutenberg.org/dirs/etext00/0ws1910.txt', # Henry IV
    'http://www.gutenberg.org/dirs/etext99/1ws2411.txt', # Julius Caesar
    'http://www.gutenberg.org/dirs/etext98/2ws3310.txt', # King Lear
    'http://www.gutenberg.org/dirs/etext99/1ws1211j.txt', # Love's Labour's Lost
    'http://www.gutenberg.org/dirs/etext98/2ws3410.txt', # Macbeth
    'http://www.gutenberg.org/dirs/etext98/2ws1810.txt', # The Merchant of Venice
    'http://www.gutenberg.org/dirs/etext99/1ws1711.txt', # Midsummer Night's Dream
    'http://www.gutenberg.org/dirs/etext98/3ws2210.txt', # Much Ado About Nothing
    'http://www.gutenberg.org/dirs/etext00/0ws3210.txt', # Othello
    'http://www.gutenberg.org/dirs/etext98/2ws1610.txt', # Romeo and Juliet
    'http://www.gutenberg.org/dirs/etext98/2ws1010.txt', # The Taming of the Shrew
    'http://www.gutenberg.org/dirs/etext99/1ws4111.txt', # The Tempest
    'http://www.gutenberg.org/dirs/etext00/0ws0910.txt', # Titus Andronicus
    'http://www.gutenberg.org/dirs/etext99/1ws2911.txt', # Troilus and Cressida
    'http://www.gutenberg.org/dirs/etext98/3ws2810.txt', # Twelfth Night
    'http://www.gutenberg.org/files/1539/1539.txt' # The Winter's Tale
    ]

    }.to_json}
    }.to_json}
    )

    # With 23 Workers running, and over Wifi, it counted all the words in 5.5 secs.
  4. @jashkenas jashkenas created this gist Sep 10, 2009.
    41 changes: 41 additions & 0 deletions shakespeare_word_count.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,41 @@
    #!/usr/bin/env ruby -rubygems

    require 'restclient'
    require 'json'

    # Let's count all the words in Shakespeare.

    RestClient.post('http://localhost:9173/jobs',
    {:job => {

    'action' => 'word_count',

    'inputs' => [
    'http://www.gutenberg.org/dirs/etext97/1ws3010.txt', # All's Well That Ends Well
    'http://www.gutenberg.org/dirs/etext99/1ws3511.txt', # Anthony and Cleopatra
    'http://www.gutenberg.org/dirs/etext97/1ws2510.txt', # As You Like It
    'http://www.gutenberg.org/dirs/etext97/1ws0610.txt', # The Comedy of Errors
    'http://www.gutenberg.org/dirs/etext99/1ws3911.txt', # Cymbeline
    'http://www.gutenberg.org/dirs/etext00/0ws2610.txt', # Hamlet
    'http://www.gutenberg.org/dirs/etext00/0ws1910.txt', # Henry IV
    'http://www.gutenberg.org/dirs/etext99/1ws2411.txt', # Julius Caesar
    'http://www.gutenberg.org/dirs/etext98/2ws3310.txt', # King Lear
    'http://www.gutenberg.org/dirs/etext99/1ws1211j.txt', # Love's Labour's Lost
    'http://www.gutenberg.org/dirs/etext98/2ws3410.txt', # Macbeth
    'http://www.gutenberg.org/dirs/etext98/2ws1810.txt', # The Merchant of Venice
    'http://www.gutenberg.org/dirs/etext99/1ws1711.txt', # Midsummer Night's Dream
    'http://www.gutenberg.org/dirs/etext98/3ws2210.txt', # Much Ado About Nothing
    'http://www.gutenberg.org/dirs/etext00/0ws3210.txt', # Othello
    'http://www.gutenberg.org/dirs/etext98/2ws1610.txt', # Romeo and Juliet
    'http://www.gutenberg.org/dirs/etext98/2ws1010.txt', # The Taming of the Shrew
    'http://www.gutenberg.org/dirs/etext99/1ws4111.txt', # The Tempest
    'http://www.gutenberg.org/dirs/etext00/0ws0910.txt', # Titus Andronicus
    'http://www.gutenberg.org/dirs/etext99/1ws2911.txt', # Troilus and Cressida
    'http://www.gutenberg.org/dirs/etext98/3ws2810.txt', # Twelfth Night
    'http://www.gutenberg.org/files/1539/1539.txt' # The Winter's Tale
    ]

    }.to_json}
    )

    # With 23 Workers running, and over Wifi, it counted all the words in 5.5 secs.