Created
January 2, 2014 02:58
-
-
Save anonymous/8214328 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# PowerShell v3 | |
# | |
$template =" | |
input | |
_IN_ | |
output | |
0 | |
b 1 | |
a 2 | |
9 3 | |
8 4 | |
7 5 | |
6" | |
filter Get-Clock { | |
$d = Get-Date $_ | |
$h = "{0:x}" -f ($d.Hour % 12) | |
$m = "{0:x}" -f ([Math]::Round($d.Minute / 5) -as [int]) | |
$t = $template | |
($h,"X"),($m,"x"),("[\dab]","o"),("_IN_",$_) | % { $t = $t -replace $_ } | |
$t | |
} | |
"18:35","00:00","10:03" | Get-Clock | |
# [Result] | |
# | |
# input | |
# 18:35 | |
# output | |
# o | |
# o o | |
# | |
# o o | |
# | |
# o o | |
# | |
# o o | |
# | |
# x o | |
# X | |
# | |
# input | |
# 00:00 | |
# output | |
# X | |
# o o | |
# | |
# o o | |
# | |
# o o | |
# | |
# o o | |
# | |
# o o | |
# o | |
# | |
# input | |
# 10:03 | |
# output | |
# o | |
# o x | |
# | |
# X o | |
# | |
# o o | |
# | |
# o o | |
# | |
# o o | |
# o |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment