Add write-saying.ps1 and speak-saying.ps1

This commit is contained in:
Markus Fleschutz 2021-08-05 14:53:40 +02:00
parent d57ff61273
commit b1b52dc03a
5 changed files with 131 additions and 3 deletions

69
Data/sayings.csv Normal file
View File

@ -0,0 +1,69 @@
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

@ -142,7 +142,6 @@ make-repo.ps1, builds the current/given Git repository
make-repos.ps1, builds all Git repositories under the current/given directory
moon.ps1, prints the current moon phase
mute-audio.ps1, mutes audio
next-joke.ps1], gets the next random Juck Norris joke
open-browser.ps1, starts the default Web browser
open-calculator.ps1, starts the calculator program
open-email-client.ps1, starts the default email client
@ -186,7 +185,8 @@ speak-file.ps1, speaks the content of the given text file by text-to-speech (TTS
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 the next joke by text-to-speech (TTS)
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-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)
@ -214,12 +214,14 @@ write-big.ps1, writes the given text in big letters
write-blue.ps1, writes the given text in a blue foreground color
write-braille.ps1, writes the given text in Braille
write-green.ps1, writes the given text in a green foreground color
write-joke.ps1], writes a random Juck Norris joke
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-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,6 +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-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)
@ -240,13 +241,14 @@ Mega Collection of PowerShell Scripts
* [write-blue.ps1](Scripts/write-blue.ps1) - writes the given text in a blue foreground color
* [write-braille.ps1](Scripts/write-braille.ps1) - writes the given text in Braille
* [write-green.ps1](Scripts/write-green.ps1) - writes the given text in a green foreground color
* [write-lowercase.ps1](Scripts/write-lowercase.ps1) - writes the given text in lowercase letters
* [write-joke.ps1](Scripts/write-joke.ps1) - writes a random Juck Norris joke
* [write-lowercase.ps1](Scripts/write-lowercase.ps1) - writes the given text in lowercase letters
* [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-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

28
Scripts/speak-saying.ps1 Executable file
View File

@ -0,0 +1,28 @@
<#
.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
}

27
Scripts/write-saying.ps1 Executable file
View File

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