Skip to content

Instantly share code, notes, and snippets.

@DeadlyBrad42
Last active August 29, 2020 11:11
Show Gist options
  • Save DeadlyBrad42/ae56667f3ed085bbe822 to your computer and use it in GitHub Desktop.
Save DeadlyBrad42/ae56667f3ed085bbe822 to your computer and use it in GitHub Desktop.
rage-quit support for PowerShell
# ¡uʍop-ǝpısdn ʇxǝʇ ɹnoʎ dı|ɟ
function Flip-Text { param ([parameter(ValueFromPipeline=$True)][string] $in)
$table = New-Object Collections.Hashtable ([StringComparer]::CurrentCulture)
$table.Add([char]'a', [char]0x0250)
$table.Add([char]'b', [char]'q')
$table.Add([char]'c', [char]0x0254)
$table.Add([char]'d', [char]'p')
$table.Add([char]'e', [char]0x01DD)
$table.Add([char]'f', [char]0x025F)
$table.Add([char]'g', [char]0x0183)
$table.Add([char]'h', [char]0x0265)
$table.Add([char]'i', [char]0x0131)
$table.Add([char]'j', [char]0x027E)
$table.Add([char]'k', [char]0x029E)
$table.Add([char]'l', [char]'|')
$table.Add([char]'m', [char]0x026F)
$table.Add([char]'n', [char]'u')
$table.Add([char]'o', [char]'o')
$table.Add([char]'p', [char]'d')
$table.Add([char]'q', [char]'b')
$table.Add([char]'r', [char]0x0279)
$table.Add([char]'s', [char]'s')
$table.Add([char]'t', [char]0x0287)
$table.Add([char]'u', [char]'n')
$table.Add([char]'v', [char]0x028C)
$table.Add([char]'w', [char]0x028D)
$table.Add([char]'x', [char]'x')
$table.Add([char]'y', [char]0x028E)
$table.Add([char]'z', [char]'z')
$table.Add([char]'A', [char]0x0250)
$table.Add([char]'B', [char]'q')
$table.Add([char]'C', [char]0x0254)
$table.Add([char]'D', [char]'p')
$table.Add([char]'E', [char]0x01DD)
$table.Add([char]'F', [char]0x025F)
$table.Add([char]'G', [char]0x0183)
$table.Add([char]'H', [char]0x0265)
$table.Add([char]'I', [char]0x0131)
$table.Add([char]'J', [char]0x027E)
$table.Add([char]'K', [char]0x029E)
$table.Add([char]'L', [char]'|')
$table.Add([char]'M', [char]0x026F)
$table.Add([char]'N', [char]'u')
$table.Add([char]'O', [char]'o')
$table.Add([char]'P', [char]'d')
$table.Add([char]'Q', [char]'b')
$table.Add([char]'R', [char]0x0279)
$table.Add([char]'S', [char]'s')
$table.Add([char]'T', [char]0x0287)
$table.Add([char]'U', [char]'n')
$table.Add([char]'V', [char]0x028C)
$table.Add([char]'W', [char]0x028D)
$table.Add([char]'X', [char]'x')
$table.Add([char]'Y', [char]0x028E)
$table.Add([char]'Z', [char]'z')
$table.Add([char]'.', [char]0x02D9)
$table.Add([char]'[', [char]']')
#$table.Add([char]'\'', [char]',')
#$table.Add([char]',', [char]'\'')
$table.Add([char]'(', [char]')')
$table.Add([char]'{', [char]'}')
$table.Add([char]'?', [char]0x00BF)
$table.Add([char]'!', [char]0x00A1)
$table.Add([char]'<', [char]'>')
$table.Add([char]'_', [char]0x203E)
$table.Add([char]' ', [char]' ')
$out = New-Object System.Text.StringBuilder
$in.ToCharArray() | %{
$char = if ($table.ContainsKey($_)) {$table[$_]} else {$_}
$out.Append($char) | Out-Null
}
# Reverse string and print
$out = $out.ToString();
$out = -join $out[-1..-$out.Length]
Write-Output $otu
}
function Fuck-You { param ([parameter(ValueFromPipeline=$True)][string] $in)
try
{
kill -processname $in -ErrorAction Stop
$tableFlipGuy = "(╯°□°)╯︵"
Write-Host " $tableFlipGuy $(Flip-Text $in)"
}
catch
{
Write-Host "Nothin' to kill here."
}
}

rage-quit support for Powershell

How To Install

Open your profile script and add add the Flip-Text and Fuck-You functions into it. The easiset way to do this is to open up PowerShell and type notepad $profile, and then just copy-and-paste the functions below into your profile script.

⚠️ Issues

Unfortunately, this script is apparently light-years ahead of Windows' command line, so unfortunately the table-flip emoticon can only be displayed when this script is run from PowerShell ISE, and isn't displayed in the normal PowerShell prompt. Hopefully Microsoft fixes this in a future update... 😟

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment