SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2012-05-17 11:21:48

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

saywhat!?

i made a stupid script again! time to celebrate!

it uses a bunch of text-files filled with words, and the script itself simply picks a random line from each file and puts them in order, building a sentence. you can expand the text-files however you like, as long as you keep in mind the build of the sentence (or not).
i am thinking of ways to have these files in some sort of central repository or whatever, storage, where everybody can add stuff to them, which in turn will end up inside everyone else's sentences. if you have any ideas on that, let me know.

here are the text-files, with the name you need to save them as (or a different name, but in that case you'd need to modify the script of course) (oh and save them in the same directory as your script, or it won't work):

saywhat.1a > http://pastebin.com/8MimcCbL
saywhat.1b > http://pastebin.com/qaHhAxdx
saywhat.2a > http://pastebin.com/LZciXUg1
saywhat.2b > http://pastebin.com/5d9r98eg
saywhat.3a > http://pastebin.com/34PFrafQ
saywhat.3b > http://pastebin.com/AutsjaCL
saywhat.4a > http://pastebin.com/GhKCmV4R
saywhat.4b > http://pastebin.com/fwLALPzM
saywhat.verb > http://pastebin.com/CcQyPid2

and here's the script itself, called 'saywhat'

#!/bin/bash

shuffle() {
   RAND=$(od -d -N2 -An /dev/urandom)
   LENGTH=$(cat "$1" | wc -l)
   LINE=$(( RAND % LENGTH + 1 ))
   head -$LINE $1 | tail -1    
}

one_a=$(shuffle saywhat.1a)
one_b=$(shuffle saywhat.1b)
two_a=$(shuffle saywhat.2a)
two_b=$(shuffle saywhat.2b)
three_a=$(shuffle saywhat.3a)
three_b=$(shuffle saywhat.3b)
verb=$(shuffle saywhat.verb)
four_a=$(shuffle saywhat.4a)
four_b=$(shuffle saywhat.4b)

echo "$one_a, $one_b $two_a $two_b, that $three_a $three_b $verb $four_a $four_b."

simply save that somewhere as 'saywhat.bash' or whatever, then do 'chmod +x saywhat.bash' and execute it, for the following (example) results:

i read in a book somewhere, curiously not while doing drugs, that scared Nickelback-listeners call the police on boring neighbours.
i have come to understand, suspiciously during a time of making backups, that introvert moviecritics have dinner while looking at adventurous payroll administrators.
it is understood, sometimes while not devouring sunflowers, that large amounts of clerks get angry about audacious followers.
it is commonly believed, particularly while not writing code, that insecure robots eat ridiculous aunts.
many people think, presumably immediately after realizing the importance of it all, that dreaming programmers eat swimming dogs.
my neighbour's cat is said to believe, presumably while consuming beverages, that feminine monks have trouble sitting down because of sexy neighbours.

Offline

Help fund CrunchBang, donate to the project!

#2 2012-05-17 12:25:31

orionthehunter
#! Constellation
From: Japan
Registered: 2011-04-09
Posts: 844
Website

Re: saywhat!?

Strangely appropriate spammer.

Offline

#3 2012-05-17 12:27:49

machinebacon
#! unstable
From: PRC
Registered: 2009-07-02
Posts: 6,272
Website

Re: saywhat!?

Thanks so much rhowaldt for this useful script! I pipe it into espeak/festival, then I have somebody who talks to me tongue


Start Distrohopping here! -> Roast your ownVSIDO | LinuxCNC | AntiX | <-

Keep it what way?

Offline

#4 2012-05-17 12:35:57

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: saywhat!?

@orion: it is gone now. but can be read here: http://crunchbanglinux.org/forums/post/220051/#p220051

@baconboy: i'm glad i could be of help for your loneliness smile

Offline

#5 2012-05-17 13:16:10

corenominal
root
From: Lincoln, UK
Registered: 2008-11-20
Posts: 4,888
Website

Re: saywhat!?

I have no idea why I think this is brilliant, but I do. Nice work, rhowaldt! lol

Offline

#6 2012-05-17 13:19:04

orionthehunter
#! Constellation
From: Japan
Registered: 2011-04-09
Posts: 844
Website

Re: saywhat!?

Thank you for memorializing that moment of joy.  :-D

Offline

#7 2012-05-17 14:12:47

hinto
#! Die Hard
From: Cary, NC
Registered: 2010-12-08
Posts: 1,069

Re: saywhat!?

Mad Libs ?
-Hinto


"Sometimes I wish I hadn't taken the red pill" -Me

Offline

#8 2012-05-17 15:11:50

dkeg
#! Die Hard
From: PA
Registered: 2011-12-05
Posts: 586

Re: saywhat!?

^ +1... took the words right out from under me!


the rocky path may just be the best path | linuxbbq | github

Offline

#9 2012-05-17 15:28:15

johnraff
#!Drunkard
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,497
Website

Re: saywhat!?

Great stuff!

...er, just...

irritatingly fastidious proofreaders notice, especially while not more gainfully occupied, that script generated sentences are failing to commence with capital letters.

John
--------------------
( a boring Japan blog , and idle twitterings )

Offline

#10 2012-05-17 16:30:25

pvsage
Internal Affairs
From: North Carolina
Registered: 2009-10-18
Posts: 9,255

Re: saywhat!?

orionthehunter wrote:

Strangely appropriate spammer.

I thought this was in reference to the generated text. lol  Brilliant!


while ( ! ( succeed = try() ) );
We've earned a reputation as a nice, friendly community; please help us keep it that way.

Online

#11 2012-05-17 16:34:29

Vansgo
#! Die Hard
Registered: 2011-05-02
Posts: 1,580
Website

Re: saywhat!?

say what -0 say Celebrate - woooooooo

Offline

#12 2012-05-17 17:48:34

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: saywhat!?

@hinto: hey, i never heard of madlibs before! smile

@johnraff: yes, indeed. i made it that way for 2 reasons:
1. it is the way i always write things (in case you didn't notice!)
2. i figured i'd do capitalization on the first word afterwards, instead of capitalizing the words in the text-file. however, i forgot. so feel free to add it yourself if you want to big_smile

@the_rest_of_the_enthusiastic_people: thanks! i really like it too smile

Offline

#13 2012-05-17 17:56:02

hinto
#! Die Hard
From: Cary, NC
Registered: 2010-12-08
Posts: 1,069

Re: saywhat!?

^cool stuff rhowaldt
-H


"Sometimes I wish I hadn't taken the red pill" -Me

Offline

#14 2012-05-17 20:34:41

mahatman2
#! Die Hard
From: Chattanooga TN
Registered: 2009-09-13
Posts: 550

Re: saywhat!?

We can always count on you, rhowaldt, for a useless (yet diverting) wordy script! wink


Punch all your friends.

Offline

#15 2012-05-17 21:30:32

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: saywhat!?

^ you can say it is my specialty big_smile

Offline

#16 2012-05-18 05:49:28

johnraff
#!Drunkard
From: Nagoya, Japan
Registered: 2009-01-07
Posts: 2,497
Website

Re: saywhat!?

OK, for capital letter at start of sentences, how about:

#!/bin/bash

...stuff...

echo "${one_a^}, $one_b $two_a $two_b, that $three_a $three_b $verb $four_a $four_b."

John
--------------------
( a boring Japan blog , and idle twitterings )

Offline

#17 2012-05-18 15:05:00

gutterslob
#! Resident Bum
Registered: 2009-11-03
Posts: 2,671

Re: saywhat!?

This is beautifully useless!!... or should I say uselessly brilliant?!

Either way, me likes.
You're definitely my favourite overdosed mutt, rhowaldt. =P

Last edited by gutterslob (2012-05-18 15:06:47)


Point & Squirt

Offline

#18 2012-05-18 15:14:27

rhowaldt
#!*$%:)
Registered: 2011-03-09
Posts: 4,396

Re: saywhat!?

^ big_smile thanks gutterslob!

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.

Debian Logo