Skip to content

Commit

Permalink
Rewrote parrot.ps1 to actually use the parrot.live http server. Renam…
Browse files Browse the repository at this point in the history
…ed to parrot-dance.ps1.
  • Loading branch information
stevefranchak committed Mar 27, 2018
1 parent 605b5e3 commit b217198
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
31 changes: 31 additions & 0 deletions parrot-dance.ps1
@@ -0,0 +1,31 @@
<#
.SYNOPSIS
Makes a parrot dance on your shell.
.EXAMPLE
./parrot-dance.ps1
#>

$request = [System.Net.HttpWebRequest]::Create("http://parrot.live");
$response = $request.GetResponse();
$receiveStream = $response.GetResponseStream();
$readStream = [System.IO.StreamReader]::new($receiveStream);

[console]::TreatControlCAsInput = $true;
$initialForegroundColor = [Console]::ForegroundColor;
while ($line = $readStream.ReadLine()) {
if ([Console]::KeyAvailable) {
$key = [System.Console]::ReadKey($true)
if (($key.modifiers -band [ConsoleModifiers]"control") -and ($key.key -eq "C"))
{
break;
}
}

[Console]::WriteLine($line);
}

$readStream.Close();
$receiveStream.Close();
$request.Abort();
[console]::TreatControlCAsInput = $false;
[Console]::ForegroundColor = $initialForegroundColor;
4 changes: 0 additions & 4 deletions parrot.ps1

This file was deleted.

0 comments on commit b217198

Please sign in to comment.