Rename to write-quote.ps1 and speak-quote.ps1

This commit is contained in:
Markus Fleschutz 2021-08-08 11:02:12 +02:00
parent b1b52dc03a
commit af119fc7db
9 changed files with 66 additions and 112 deletions

19
Data/quotes.csv Normal file
View File

@ -0,0 +1,19 @@
Genre,Author,Quote
IQ,Thomas Edison,"Genius is one percent inspiration and ninety-nine percent perspiration."
Misc,Johann Wolfgang von Goethe,"Difficulties increase the nearer we get to the goal."
Misc,William Shakespeare,"Having nothing, nothing can he lose."
Misc,Albert Einstein,"Learn from yesterday, live for today, hope for tomorrow."
Misc,Michelangelo,"Faith in oneself is the best and safest course."
Misc,Sophocles,"It takes both sunshine and rain to make a rainbow."
Misc,Mahatma Gandhi,"We must become the change we want to see."
Misc,Johann Wolfgang von Goethe,"Knowing is not enough; we must apply!"
Misc,Immanuel Kant,"Science is organized knowledge. Wisdom is organized life."
Misc,Indira Gandhi,"You can't shake hands with a clenched fist."
Misc,Albert Einstein,"Try not to become a man of success, but rather try to become a man of value."
Misc,Pierre Auguste Renoir,"The pain passes, but the beauty remains."
Misc,Heraclitus,"All is flux; nothing stays still."
Misc,Japanese proverb,"The day you decide to do it is your lucky day."
Misc,Abraham Lincoln,"The best thing about the future is that it only comes one day at a time."
Misc,Epictetus,"We have two ears and one mouth so that we can listen twice as much as we speak."
Misc,Cervantes,"Be slow of tongue and quick of eye."
Misc,Bruce Lee,"Mistakes are always forgivable, if one has the courage to admit them."
1 Genre Author Quote
2 IQ Thomas Edison Genius is one percent inspiration and ninety-nine percent perspiration.
3 Misc Johann Wolfgang von Goethe Difficulties increase the nearer we get to the goal.
4 Misc William Shakespeare Having nothing, nothing can he lose.
5 Misc Albert Einstein Learn from yesterday, live for today, hope for tomorrow.
6 Misc Michelangelo Faith in oneself is the best and safest course.
7 Misc Sophocles It takes both sunshine and rain to make a rainbow.
8 Misc Mahatma Gandhi We must become the change we want to see.
9 Misc Johann Wolfgang von Goethe Knowing is not enough; we must apply!
10 Misc Immanuel Kant Science is organized knowledge. Wisdom is organized life.
11 Misc Indira Gandhi You can't shake hands with a clenched fist.
12 Misc Albert Einstein Try not to become a man of success, but rather try to become a man of value.
13 Misc Pierre Auguste Renoir The pain passes, but the beauty remains.
14 Misc Heraclitus All is flux; nothing stays still.
15 Misc Japanese proverb The day you decide to do it is your lucky day.
16 Misc Abraham Lincoln The best thing about the future is that it only comes one day at a time.
17 Misc Epictetus We have two ears and one mouth so that we can listen twice as much as we speak.
18 Misc Cervantes Be slow of tongue and quick of eye.
19 Misc Bruce Lee Mistakes are always forgivable, if one has the courage to admit them.

View File

@ -1,69 +0,0 @@
Joke
"Chuck Norris doesnt read books. He stares them down until he gets the information he wants."
"Time waits for no man. Unless that man is Chuck Norris."
"If you spell Chuck Norris in Scrabble, you win. Forever."
"Chuck Norris breathes air five times a day."
"In the Beginning there was nothing then Chuck Norris roundhouse kicked nothing and told it to get a job."
"Chuck Norris has a mug of nails instead of coffee in the morning."
"If Chuck Norris were to travel to an alternate dimension in which there was another Chuck Norris and they both fought, they would both win."
"The dinosaurs looked at Chuck Norris the wrong way once. You know what happened to them."
"Chuck Norris tears cure cancer. Too bad he has never cried."
"Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light"
"Since 1940, the year Chuck Norris was born, roundhouse kick related deaths have increased 13,000 percent."
"Chuck Norris does not own a stove, oven, or microwave , because revenge is a dish best served cold."
"Chuck Norris does not sleep. He waits."
"There is no chin behind Chuck Norris beard. There is only another fist."
"The chief export of Chuck Norris is pain."
"Chuck Norris recently had the idea to sell his pee as a canned beverage. Its now called Red Bull."
"If paper beats rock, rock beats scissors, and scissors beats paper, what beats all 3 at the same time? Chuck Norris."
"On the 7th day, God rested Chuck Norris took over."
"Chuck Norris can dribble a bowling ball."
"Chuck Norris drinks napalm to fight his heartburn."
"Chuck Norris roundhouse kick is so powerful, it can be seen from outer space by the naked eye."
"If you want a list of Chuck Norris enemies, just check the extinct species list."
"Chuck Norris has never blinked in his entire life. Never."
"Chuck Norris does not use spell check. If he happens to misspell a word, Oxford will change the spelling."
"Some kids pee their name in the snow. Chuck Norris can pee his name into concrete."
"Chuck Norris counted to infinity twice."
"Chuck Norris can speak Braille."
"Chuck Norris can have both feet on the ground and kick butt at the same time."
"Chuck Norris can do a wheelie on a unicycle."
"Chuck Norris stands faster than anyone can run."
"Once a cobra bit Chuck Norris leg. After five days of excruciating pain, the cobra died."
"Chuck Norris once won a game of Connect Four in three moves."
"Champions are the breakfast of Chuck Norris."
"When the Boogeyman goes to sleep every night he checks his closet for Chuck Norris."
"Chuck Norris can slam revolving doors."
"Chuck Norris does not hunt because the word hunting implies the possibility of failure. Chuck Norris goes killing."
"The dark is afraid of Chuck Norris."
"Chuck Norris makes onions cry."
"Death once had a near-Chuck-Norris experience."
"When Chuck Norris writes, he makes paper bleed."
"Chuck Norris can strangle you with a cordless phone."
"Chuck Norris never retreats; He just attacks in the opposite direction."
"Chuck Norris can build a snowman out of rain."
"Chuck Norris can drown a fish."
"When Chuck Norris enters a room, he doesnt turn the lights on, he turns the dark off."
"The only time Chuck Norris was ever wrong was when he thought he had made a mistake."
"Chuck Norris is the only person that can punch a cyclops between the eye."
"Chuck Norris used to beat up his shadow because it was following to close. It now stands 15 feet behind him."
"Outer space exists because its afraid to be on the same planet with Chuck Norris."
"When Chuck Norris does a pushup, he's pushing the Earth down."
"Chuck Norris doesnt wear a watch. He decides what time it is."
"Chuck Norris does not get frostbite. Chuck Norris bites frost."
"Chuck Norris spices up his steaks with pepper spray."
"The Great Wall of China was originally created to keep Chuck Norris out. It didn't work."
"Chuck Norris can get in a bucket and lift it up with himself in it."
"Chuck Norris doesn't shower, he only takes blood baths."
"Chuck Norris can divide by zero."
"Chuck Norris once kicked a horse in the chin. Its descendants are now known as giraffes."
"When Chuck Norris does division, there are no remainders."
"It takes Chuck Norris 20 minutes to watch '60 Minutes'."
"Chuck Norris once went skydiving, but promised never to do it again. One Grand Canyon is enough."
"We live in an expanding universe. All of it is trying to get away from Chuck Norris."
"Chuck Norris beat the sun in a staring contest."
"Chuck Norris can clap with one hand."
"Chuck Norris doesn't need to shave. His beard is scared to grow."
"Chuck Norris invented airplanes because he was tired of being the only person that could fly."
"Freddy Krueger has nightmares about Chuck Norris."
"Chuck Norris can start a fire with an ice cube."
1 Joke
2 Chuck Norris doesnt read books. He stares them down until he gets the information he wants.
3 Time waits for no man. Unless that man is Chuck Norris.
4 If you spell Chuck Norris in Scrabble, you win. Forever.
5 Chuck Norris breathes air five times a day.
6 In the Beginning there was nothing then Chuck Norris roundhouse kicked nothing and told it to get a job.
7 Chuck Norris has a mug of nails instead of coffee in the morning.
8 If Chuck Norris were to travel to an alternate dimension in which there was another Chuck Norris and they both fought, they would both win.
9 The dinosaurs looked at Chuck Norris the wrong way once. You know what happened to them.
10 Chuck Norris tears cure cancer. Too bad he has never cried.
11 Chuck Norris once roundhouse kicked someone so hard that his foot broke the speed of light
12 Since 1940, the year Chuck Norris was born, roundhouse kick related deaths have increased 13,000 percent.
13 Chuck Norris does not own a stove, oven, or microwave , because revenge is a dish best served cold.
14 Chuck Norris does not sleep. He waits.
15 There is no chin behind Chuck Norris beard. There is only another fist.
16 The chief export of Chuck Norris is pain.
17 Chuck Norris recently had the idea to sell his pee as a canned beverage. Its now called Red Bull.
18 If paper beats rock, rock beats scissors, and scissors beats paper, what beats all 3 at the same time? Chuck Norris.
19 On the 7th day, God rested Chuck Norris took over.
20 Chuck Norris can dribble a bowling ball.
21 Chuck Norris drinks napalm to fight his heartburn.
22 Chuck Norris roundhouse kick is so powerful, it can be seen from outer space by the naked eye.
23 If you want a list of Chuck Norris enemies, just check the extinct species list.
24 Chuck Norris has never blinked in his entire life. Never.
25 Chuck Norris does not use spell check. If he happens to misspell a word, Oxford will change the spelling.
26 Some kids pee their name in the snow. Chuck Norris can pee his name into concrete.
27 Chuck Norris counted to infinity twice.
28 Chuck Norris can speak Braille.
29 Chuck Norris can have both feet on the ground and kick butt at the same time.
30 Chuck Norris can do a wheelie on a unicycle.
31 Chuck Norris stands faster than anyone can run.
32 Once a cobra bit Chuck Norris leg. After five days of excruciating pain, the cobra died.
33 Chuck Norris once won a game of Connect Four in three moves.
34 Champions are the breakfast of Chuck Norris.
35 When the Boogeyman goes to sleep every night he checks his closet for Chuck Norris.
36 Chuck Norris can slam revolving doors.
37 Chuck Norris does not hunt because the word hunting implies the possibility of failure. Chuck Norris goes killing.
38 The dark is afraid of Chuck Norris.
39 Chuck Norris makes onions cry.
40 Death once had a near-Chuck-Norris experience.
41 When Chuck Norris writes, he makes paper bleed.
42 Chuck Norris can strangle you with a cordless phone.
43 Chuck Norris never retreats; He just attacks in the opposite direction.
44 Chuck Norris can build a snowman out of rain.
45 Chuck Norris can drown a fish.
46 When Chuck Norris enters a room, he doesnt turn the lights on, he turns the dark off.
47 The only time Chuck Norris was ever wrong was when he thought he had made a mistake.
48 Chuck Norris is the only person that can punch a cyclops between the eye.
49 Chuck Norris used to beat up his shadow because it was following to close. It now stands 15 feet behind him.
50 Outer space exists because its afraid to be on the same planet with Chuck Norris.
51 When Chuck Norris does a pushup, he's pushing the Earth down.
52 Chuck Norris doesnt wear a watch. He decides what time it is.
53 Chuck Norris does not get frostbite. Chuck Norris bites frost.
54 Chuck Norris spices up his steaks with pepper spray.
55 The Great Wall of China was originally created to keep Chuck Norris out. It didn't work.
56 Chuck Norris can get in a bucket and lift it up with himself in it.
57 Chuck Norris doesn't shower, he only takes blood baths.
58 Chuck Norris can divide by zero.
59 Chuck Norris once kicked a horse in the chin. Its descendants are now known as giraffes.
60 When Chuck Norris does division, there are no remainders.
61 It takes Chuck Norris 20 minutes to watch '60 Minutes'.
62 Chuck Norris once went skydiving, but promised never to do it again. One Grand Canyon is enough.
63 We live in an expanding universe. All of it is trying to get away from Chuck Norris.
64 Chuck Norris beat the sun in a staring contest.
65 Chuck Norris can clap with one hand.
66 Chuck Norris doesn't need to shave. His beard is scared to grow.
67 Chuck Norris invented airplanes because he was tired of being the only person that could fly.
68 Freddy Krueger has nightmares about Chuck Norris.
69 Chuck Norris can start a fire with an ice cube.

View File

@ -186,7 +186,7 @@ speak-french.ps1, speaks the given text with a French text-to-speech (TTS) voice
speak-german.ps1, speaks the given text with a German text-to-speech (TTS) voice
speak-italian.ps1, speaks the given text with an Italian text-to-speech (TTS) voice
speak-joke.ps1, speaks a random Chuck Norris joke by text-to-speech (TTS)
speak-saying.ps1, speaks a random saying by text-to-speech (TTS)
speak-quote.ps1, speaks a random quote by text-to-speech (TTS)
speak-test.ps1, performs a speak test by text-to-speech (TTS)
speak-text.ps1, speaks the given text by text-to-speech (TTS)
speak-time.ps1, speaks the current time by text-to-speech (TTS)
@ -219,9 +219,9 @@ write-lowercase.ps1, writes the given text in lowercase letters
write-marquee.ps1, writes the given text as marquee
write-morse-code.ps1, writes the given text in Morse code
write-motd.ps1, writes the message of the day (MOTD)
write-quote.ps1, writes a random quote
write-red.ps1, writes the given text in a red foreground color
write-rot13.ps1, encodes or decodes the given text with ROT13
write-saying.ps1], writes a random saying
write-typewriter.ps1, writes the given text with the typewriter effect
write-uppercase.ps1, writes the given text in uppercase letters
write-vertical.ps1, writes the given text in vertical direction

Can't render this file because it has a wrong number of fields in line 79.

View File

@ -27,7 +27,7 @@ Mega Collection of PowerShell Scripts
* [speak-german.ps1](Scripts/speak-german.ps1) - speaks the given text with a German text-to-speech (TTS) voice
* [speak-italian.ps1](Scripts/speak-italian.ps1) - speaks the given text with an Italian text-to-speech (TTS) voice
* [speak-joke.ps1](Scripts/speak-joke.ps1) - speaks a random Chuck Norris joke by text-to-speech (TTS)
* [speak-saying.ps1](Scripts/speak-saying.ps1) - speaks a random saying by text-to-speech (TTS)
* [speak-quote.ps1](Scripts/speak-quote.ps1) - speaks a random quote by text-to-speech (TTS)
* [speak-test.ps1](Scripts/speak-test.ps1) - performs a speak test by text-to-speech (TTS)
* [speak-text.ps1](Scripts/speak-text.ps1) - speaks the given text by text-to-speech (TTS)
* [speak-time.ps1](Scripts/speak-time.ps1) - speaks the current time by text-to-speech (TTS)
@ -246,9 +246,9 @@ Mega Collection of PowerShell Scripts
* [write-marquee.ps1](Scripts/write-marquee.ps1) - writes the given text as marquee
* [write-morse-code.ps1](Scripts/write-morse-code.ps1) - writes the given text in Morse code
* [write-motd.ps1](Scripts/write-motd.ps1) - writes the message of the day (MOTD)
* [write-quote.ps1](Scripts/write-quote.ps1) - writes a random quote
* [write-red.ps1](Scripts/write-red.ps1) - writes the given text in a red foreground color
* [write-rot13.ps1](Scripts/write-rot13.ps1) - encodes or decodes the given text with ROT13
* [write-saying.ps1](Scripts/write-saying.ps1) - writes a random saying
* [write-typewriter.ps1](Scripts/write-typewriter.ps1) - writes the given text with the typewriter effect
* [write-uppercase.ps1](Scripts/write-uppercase.ps1) - writes the given text in uppercase letters
* [write-vertical.ps1](Scripts/write-vertical.ps1) - writes the given text in vertical direction

View File

@ -14,10 +14,10 @@
try {
$Table = import-csv "$PSScriptRoot/../Data/jokes.csv"
$NumRows = $Table.count
$Generator = New-Object System.Random
$Index = [int]$Generator.next(0,66)
$Index = [int]$Generator.next(0,$NumRows - 1)
$Joke = $Table[$Index].Joke
& "$PSScriptRoot/speak-english.ps1" "$Joke"

29
Scripts/speak-quote.ps1 Executable file
View File

@ -0,0 +1,29 @@
<#
.SYNOPSIS
speak-quote.ps1
.DESCRIPTION
Speaks a random quote by text-to-speech (TTS)
.EXAMPLE
PS> .\speak-quote.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz
License: CC0
#>
try {
$Table = import-csv "$PSScriptRoot/../Data/quotes.csv"
$NumRows = $Table.count
$Generator = New-Object System.Random
$Index = [int]$Generator.next(0,$NumRows - 1)
$Quote = $Table[$Index].Quote
$Author = $Table[$Index].Author
& "$PSScriptRoot/speak-english.ps1" "$Quote (by $Author)"
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -1,28 +0,0 @@
<#
.SYNOPSIS
speak-saying.ps1
.DESCRIPTION
Speaks a random saying by text-to-speech (TTS)
.EXAMPLE
PS> .\speak-saying.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz
License: CC0
#>
try {
$Table = import-csv "$PSScriptRoot/../Data/saying.csv"
$Generator = New-Object System.Random
$Index = [int]$Generator.next(0,66)
$Joke = $Table[$Index].Joke
& "$PSScriptRoot/speak-english.ps1" "$Joke"
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
}

View File

@ -14,11 +14,12 @@
try {
$Table = import-csv "$PSScriptRoot/../Data/jokes.csv"
$NumRows = $Table.count
$Generator = New-Object System.Random
$Index = [int]$Generator.next(0,66)
$Index = [int]$Generator.next(0,$NumRows - 1)
$Joke = $Table[$Index].Joke
"📣 $Joke"
exit 0
} catch {

View File

@ -1,10 +1,10 @@
<#
.SYNOPSIS
write-saying.ps1
write-quote.ps1
.DESCRIPTION
Writes a random saying to the console.
Writes a random quote to the console.
.EXAMPLE
PS> .\write-saying.ps1
PS> .\write-quote.ps1
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
@ -13,13 +13,15 @@
#>
try {
$Table = import-csv "$PSScriptRoot/../Data/sayings.csv"
$Table = import-csv "$PSScriptRoot/../Data/quotes.csv"
$NumRows = $Table.count
$Generator = New-Object System.Random
$Index = [int]$Generator.next(0,66)
$Index = [int]$Generator.next(0,$NumRows - 1)
$Quote = $Table[$Index].Quote
$Author = $Table[$Index].Author
$Line = $Table[$Index].Saying
"📣 $Line"
"📣 $Quote <$Author>"
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"