Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Bash Poetry Contest

Off-Topic discussions about science, technology, and non Debian specific topics.
Post Reply
Message
Author
User avatar
Soul Singin'
Posts: 1605
Joined: 2008-12-21 07:02

Bash Poetry Contest

#1 Post by Soul Singin' »

In another thread, I began writing some Bash Poetry.

Code: Select all

printf "\n\tRoses are red,\n\tViolets are blue.\n\tWhen %b is dead,\n\tI %b or two.\n\n" $(env|grep -iE "^desk|^term"|sort|head -n1|sed 's/^.*=//') "$(whatis kill|sed 's/\s(1).*to//')"
But I never had much of a head for rhythm and rhyme, so let's see if you can do better!

Rules
  1. The "poem" must be run from a Bash prompt. (No scripts allowed).
    .
  2. Due to an earlier incident in which a forum member dropped a fork bomb into obfuscated code, I think that there should be a . NO obfuscation . rule.
    1. I want to have fun. I don't feel like dealing with the consequences of rm -rf *, etc.
    2. @ moderators -- Please lock this thread if malicious commands appear.
    .
  3. May the best poet win!
.

User avatar
Pick2
Posts: 790
Joined: 2007-07-07 13:31
Location: Decatur Il

Re: Bash Poetry Contest

#2 Post by Pick2 »

There was this one dude called Soul Singin'
His Rantingly posts he'd keep a Flingin'
While reading his Bash
My head went kur-splash
I woke up with my ears still a Ringin'

I forgot about the bash part :D
Programming and poetry ... Diametrically opposed !


User avatar
nadir
Posts: 5961
Joined: 2009-10-05 22:06
Location: away

Re: Bash Poetry Contest

#4 Post by nadir »

I guess i won't win the contest:

Code: Select all

$ cat my_confusion.sh 
#!/bin/bash


INPUT_FILE="/usr/share/common-licenses/GPL-3"
OUT_FILE="my_save.txt"
RESULT="my_poem.txt"

clear; echo

exec 6>&1
exec >$OUT_FILE

sed -n '13,20p'  "$INPUT_FILE"

exec 1>&6 6>&- 
exec 2>/dev/null

dadadodo  -c 1   "$OUT_FILE" > "$RESULT"

echo "
"
cat   $RESULT

exit 0
But it took me a bit more than half an hour to figure it out. Lousy result for that, no?
Main problem is i can't deal with texts (cut,split and all that). I think you got the idea.
Put it in a one-liner someone, do a bit of formatting and voila: you got a sossegonized poem.

I know the code is lousy. Thats the stage i am at...
If oyu run it and it will burn your house down: I am already broken. You have to live with it.
I am serious with that.

Ups:
" 1. The "poem" must be run from a Bash prompt. (No scripts allowed)."
Guess i gotta start over later...(cut the text out of the liscence -somehow- and pipe it to dadadodo -somehow-...)
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.

User avatar
nadir
Posts: 5961
Joined: 2009-10-05 22:06
Location: away

Re: Bash Poetry Contest

#5 Post by nadir »

ok, somehow a start:

Code: Select all

$ sed -n '13,20p' /usr/share/common-licenses/GPL-3 > save_it.txt &&  dadadodo -c 1 save_it.txt
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.

User avatar
Soul Singin'
Posts: 1605
Joined: 2008-12-21 07:02

Re: Bash Poetry Contest

#6 Post by Soul Singin' »

nadir wrote:But it took me a bit more than half an hour to figure it out. Lousy result for that, no?
nadir wrote:I know the code is lousy. Thats the stage i am at...
But learning is all about "trial and error." You cannot learn if you do not make a lot of errors.

And look at what you learned! You learned how to redirect input and output and you learned how to use sed to isolate a few lines of text. That's a good start.
nadir wrote:Put it in a one-liner someone, do a bit of formatting and voila: you got a sossegonized poem.
OK. So all you need is to make it more concise. Using a hyphen tells dadadodo to read from STDIN. Then you use 2> /dev/null to strip away dadadodo's noise (i.e. STDERR).

Code: Select all

sed -n '13,20p' /usr/share/common-licenses/GPL-3 | dadadodo -c 1 - 2> /dev/null
Edit: Redirect to /dev/null !!! See. I'm learning too. I have to learn more about redirection!
.
Last edited by Soul Singin' on 2010-07-06 00:39, edited 2 times in total.

User avatar
jheaton5
Posts: 1488
Joined: 2008-08-20 01:40
Location: Newnan, GA, USA

Re: Bash Poetry Contest

#7 Post by jheaton5 »

:?:

Code: Select all

jheaton5@sid:~$ sed -n '13,20p' /usr/share/common-licenses/GPL-3 > save_it.txt &&  dadadodo -c 1 save_it.txt
bash: dadadodo: command not found
jheaton5@sid:~$ sed -n '13,20p' /usr/share/common-licenses/GPL-3 | dadadodo -c 1 - 2>1
jheaton5@sid:~$ 
debian sid


User avatar
nadir
Posts: 5961
Joined: 2009-10-05 22:06
Location: away

Re: Bash Poetry Contest

#9 Post by nadir »

Thanks Soul.
So here is my final feed:

Code: Select all

clear && sed -n '13,20p' /usr/share/common-licenses/GPL-3 | dadadodo -c 1 - 2>/dev/null | cut --delimiter=" " -f 1-4
If the first run doesn't sound at minimum like sossego or like shakesbeer, run it again.*
Soul will get half of the prize-money (as he did the work), i will get the other half cause i had the idea. :D

*that was one result i did like:
We, the GNU General
for most software for
your freedom to share
your freedom to share
change the GNU General
GNU General Public License
Lets hear for more.
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.

User avatar
Soul Singin'
Posts: 1605
Joined: 2008-12-21 07:02

Re: Bash Poetry Contest

#10 Post by Soul Singin' »

I like this one from the original:
By contrast, the works are designed to take away your freedom to
guarantee your freedom to take away your freedom to take away your
freedom to take away your freedom to guarantee your freedom to share
and other change the licenses for most software and other practical
works.
nadir wrote:Lets hear for more.
+1
.

paivakil
Posts: 434
Joined: 2009-02-15 11:57

Re: Bash Poetry Contest

#11 Post by paivakil »

Using:-

Code: Select all

printf "\n\tRoses are red,\n\tViolets are blue.\n\tWhen %b is dead,\n\tI %b or two.\n\n" $(env|grep -iE "^desk|^term"|sort|head -n1|sed 's/^.*=//') "$(whatis kill|sed 's/\s(1).*to//')"
I get
Licensor shall mean the
entities that entity shall
mean the License.
and
Licensor shall mean the
union of this definition,
entity authorized by or
by or entity shall
copyright owner or are
owner or indirect to
It's not the software that's free; it's you.

User avatar
dbbolton
Posts: 2129
Joined: 2007-06-20 08:17
Location: Iapetus

Re: Bash Poetry Contest

#12 Post by dbbolton »

Soul Singin' wrote:[*]Due to an earlier incident in which a forum member dropped a fork bomb into obfuscated code, I think that there should be a . NO obfuscation . rule.
In response the mention of said "incident", presented below is a list of tasks that a user must have completed in order that he or she execute said "fork bomb". The user must have:

1. Recognized to which interpreter the code block should be passed,
2. Copied the text from the post that contained said "fork bomb" and saved it as a local file*,
3. Added an appropriate she-bang line from No. 1.**,
4. Made that file executable**,
5. Called that file from a shell**,

and finally, the most important criterion:

The user must have rectified the syntax errors on the last line:

Code: Select all

Scalar found where operator expected at ./alleged-fork-bomb line 6, near "$C $S"
	(Missing operator before $S?)
syntax error at ./alleged-fork-bomb line 6, near ""$2[2]$0[1]$0[0] \"";"
syntax error at ./alleged-fork-bomb line 6, near "$C $S"
Execution of ./alleged-fork-bomb aborted due to compilation errors.
If that obfuscated code caused any damages to any user or any user's property, the user in question irrefutably went out of his or her way to bring the consequences about himself or herself.

The reason that this alleged forkbomb was posted possibly revolved around the intent to pose a reminder that one should never execute any program or code unless one trusts the author and/or has a complete understanding of what the code will do-- an intent that may or may not have been prompted by a previous post containing obfuscated code-- and possibly did not, in any capacity, revolve around any ill will or intent to deal damage to other users or their property.

In light of the aforementioned propositions, any accusation, whether implicit or explicit, of such ill will on the part of the code's author is utterly misguided.

Perhaps, and only perhaps, these propositions ought to be considered before the issue of an obtrusive warning to the other schoolchildren to behave lest they next be banished to the corner with the dunce hat. While the context in which the prohibition of obfuscated code was presented is arbitrary, the rule is appropriate.

Notice: This post was written with the sole intent of clarifying perceived misunderstandings about said "incident", whether or not those misunderstandings in fact exist, and is no way intended to malign or otherwise defame the author or authors of any text contained herein.

Let it be known that the proscription of obfuscated code is agreeable and just.

* - Or, awkwardly passed the five long lines to the interpreter on the command line and fixed the subsequent quotation problems.
** Of course, these steps could be substituted with a passing of the file containing the code block to the correct interpreter from a shell.
Last edited by dbbolton on 2010-07-09 23:10, edited 1 time in total.
GitHub | zsh docs in Letter PDF
Telemachus wrote:Put down the CGI.


User avatar
nadir
Posts: 5961
Joined: 2009-10-05 22:06
Location: away

Re: Bash Poetry Contest

#14 Post by nadir »

Back to the topic and hint for Pick2
(you may still win the contest,
just do it like this :-)
$ echo "
> most_easy
>
> duh, bolton, have it done?
> the bomb, bonmot
> a frog, the gun
> i ask:
> my $shell
>
> Have you done wrong?
>
> A soul, came run:
> there was a bomb!
> Complain: gone, gone
> Thats what
> i ask:
>
> Where is:
> the Fun?
> "
$
Not exactly Shakespeare, but the guidelines don't allow the use my little helpers...
It is a single command, from what i understand, so it should be taken into the final round
(i really need the money... )

It's a top-secret bavarian-style of poems (not that boring japanese stuff).
It's called:
inardiburgisgeharse.
(Bavarian? :roll: Hint, hint hint: have a beer. Better a sixer. Both of you)

greetings.

Edit: to edit.
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.

User avatar
dbbolton
Posts: 2129
Joined: 2007-06-20 08:17
Location: Iapetus

Re: Bash Poetry Contest

#15 Post by dbbolton »

I called Saul, and he drafted it for me. Note the conspicuous lack of identifying pronouns.

nadir: I will take you up on your generous offer and have some of your beers.*


But on a serious note, I have a few ideas for some bash poems-- I just have one question. Does the output have to be the poem, or can the command itself be the poem (assuming that it's valid)?



* - a quote from that episode
GitHub | zsh docs in Letter PDF
Telemachus wrote:Put down the CGI.

User avatar
Soul Singin'
Posts: 1605
Joined: 2008-12-21 07:02

Re: Bash Poetry Contest

#16 Post by Soul Singin' »

dbbolton wrote:But on a serious note, I have a few ideas for some bash poems-- I just have one question. Does the output have to be the poem, or can the command itself be the poem (assuming that it's valid)?
Surprise us!
.

clie09
Posts: 2
Joined: 2022-12-03 06:32

Re: Bash Poetry Contest

#17 Post by clie09 »

Id=`printf "THIS IS IT" | sed -u "s:IS::" | awk '$2' | bash -c "cat $(and=mouse)"

&& for i in "10" $minutes; do echo "something until $it is"; done

`&& There="is an" echo $Id | ALWAYS="JUST" sed "s:

IS IT:${N}E $VER GOING $(TO="BE WHAT YOU'RE AS") KING - FOR, that :"|cut -d- -f1

|WAS_JUST_TOO_DEEP= IS_WHAT_THE= cat|

$OWNER sed "s:GOING$TO_HAPPEN:BASH$ING $THE SCRIPTING $LIKE$THAT IS:" $WRONG



-Admin Edit: Until Al Gore gets here to verify this string of what may be beautiful code, lets break it up a bit for those who would unknowingly input random Internet text.
Last edited by donald on 2022-12-03 12:03, edited 1 time in total.
Reason: Yeah ....

User avatar
sunrat
Administrator
Administrator
Posts: 6412
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 116 times
Been thanked: 461 times

Re: Bash Poetry Contest

#18 Post by sunrat »

:lol: 12 year old topic!
zombie-thread.jpg
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

clie09
Posts: 2
Joined: 2022-12-03 06:32

Re: Bash Poetry Contest

#19 Post by clie09 »

I believe this is still relevant today! It started as a conversation with a colleague about why all the hype with python these days when we could code the same thing up in bash in a fraction of the time that runs faster and uses less memory - was trying to prove a point here why in many cases python is easier to maintain:

Note: this code will only execute correctly as a one-liner...I swear it is harmless, but this is also a strategy that can be used for nefarious purposes.

Admin edit to remove posted code. - Another admin decided to be cautious and not allow your code to be posted as a one liner and you reposted it. Sorry, can't allow that or override his decision.
If anyone wants to try your code, I'm sure they can reconstruct it from your first post.
Attachments
bash_poetry.png

Post Reply