<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><description></description><title>Only Fun PoSH Here!</title><generator>Tumblr (3.0; @funposh)</generator><link>http://funposh.tumblr.com/</link><item><title>Powershell, Zelda, and ASCII, Oh My!!!
#Code...</title><description>&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Powershell, Zelda, and ASCII, Oh My!!!&lt;/p&gt;
&lt;p&gt;#Code Start….&lt;/p&gt;
&lt;p&gt;$midiPath = “e:\dev\powershell\z1title.mid”&lt;br/&gt;$jpgPath = “e:\dev\powershell\zelda_title.jpg”&lt;br/&gt;&lt;br/&gt;function Play-Media( [String] $strMediaFilePath )&lt;br/&gt;{&lt;br/&gt;if( $strMediaFilePath )&lt;br/&gt;{&lt;br/&gt;$player = New-Object -ComObject “wmplayer.ocx”&lt;br/&gt;$media = $player.NewMedia($strMediaFilePath)&lt;br/&gt;[void] $player.CurrentPlaylist.AppendItem($media)&lt;br/&gt;$player.Controls.Play()&lt;br/&gt;}&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;function Convert-Image () {&lt;br/&gt;&lt;br/&gt;#—————————————————–&lt;br/&gt;# Copyright 2006 Adrian Milliner (ps1 at soapyfrog dot com)&lt;br/&gt;# &lt;a href="http://ps1.soapyfrog.com"&gt;http://ps1.soapyfrog.com&lt;/a&gt;&lt;br/&gt;#&lt;br/&gt;# This work is licenced under the Creative Commons &lt;br/&gt;# Attribution-NonCommercial-ShareAlike 2.5 License. &lt;br/&gt;# To view a copy of this licence, visit &lt;br/&gt;# &lt;a href="http://creativecommons.org/licenses/by-nc-sa/2.5/"&gt;http://creativecommons.org/licenses/by-nc-sa/2.5/&lt;/a&gt; &lt;br/&gt;# or send a letter to &lt;br/&gt;# Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.&lt;br/&gt;#—————————————————–&lt;br/&gt;&lt;br/&gt;# $Id: convert-image2text.ps1 91 2007-01-10 10:10:33Z adrian $&lt;br/&gt;&lt;br/&gt;#—————————————————–&lt;br/&gt;# This script loads the specified image and outputs an ascii version to the&lt;br/&gt;# pipe, line by line.&lt;br/&gt;#&lt;br/&gt;&lt;br/&gt;param(&lt;br/&gt; [string]$path = $(throw “Supply an image path”),&lt;br/&gt; [int]$maxwidth,            # default is width of console&lt;br/&gt; [string]$palette=“ascii”,  # choose a palette, “ascii” or “shade”&lt;br/&gt; [float]$ratio = 1.5        # 1.5 means char height is 1.5 x width&lt;br/&gt; )&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;#—————————————————–&lt;br/&gt;# here we go&lt;br/&gt;&lt;br/&gt;# the next line is require because FromFile below throws a /zero (?!)&lt;br/&gt;$path=(resolve-path -erroraction “stop” $path).path&lt;br/&gt;&lt;br/&gt;$palettes = @{&lt;br/&gt; “ascii” = “ .,:;=|iI+hHOE#`$”&lt;br/&gt; “shade” = “ ” + [char]0x2591 + [char]0x2592 + [char]0x2593 + [char]0x2588&lt;br/&gt; “bw"    = ” “ + [char]0x2588&lt;br/&gt;}&lt;br/&gt;$c = $palettes[$palette]&lt;br/&gt;if (-not $c) {&lt;br/&gt; write-warning "palette should be one of:  $($palettes.keys.GetEnumerator())”&lt;br/&gt; write-warning “defaulting to ascii”&lt;br/&gt; $c = $palettes.ascii&lt;br/&gt;}&lt;br/&gt;[char[]]$charpalette = $c.ToCharArray()&lt;br/&gt;&lt;br/&gt;# we need the drawing assembly&lt;br/&gt;&lt;br/&gt;[Reflection.Assembly]::LoadFrom(“C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll”) | out-null&lt;br/&gt;# load the image&lt;br/&gt;$image = [Drawing.Image]::FromFile($path)&lt;br/&gt;if ($maxwidth -le 0) { [int]$maxwidth = $host.ui.rawui.WindowSize.Width - 1}&lt;br/&gt;[int]$imgwidth = $image.Width&lt;br/&gt;[int]$maxheight = $image.Height / ($imgwidth / $maxwidth) / $ratio&lt;br/&gt;$bitmap = new-object Drawing.Bitmap ($image,$maxwidth,$maxheight)&lt;br/&gt;[int]$bwidth = $bitmap.Width; [int]$bheight = $bitmap.Height&lt;br/&gt;# draw it!&lt;br/&gt;$cplen = $charpalette.count&lt;br/&gt;for ([int]$y=0; $y -lt $bheight; $y++) {&lt;br/&gt; $line = “”&lt;br/&gt; for ([int]$x=0; $x -lt $bwidth; $x++) {&lt;br/&gt; $colour = $bitmap.GetPixel($x,$y)&lt;br/&gt; $bright = $colour.GetBrightness()&lt;br/&gt; [int]$offset = [Math]::Floor($bright*$cplen)&lt;br/&gt; $ch = $charpalette[$offset]&lt;br/&gt; if (-not $ch) { $ch = $charpalette[-1] } #overflow&lt;br/&gt; $line += $ch&lt;br/&gt; }&lt;br/&gt; $line&lt;br/&gt; start-sleep 1&lt;br/&gt;}&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;Play-Media $midiPath&lt;br/&gt;Convert-Image $jpgPath -palette shade &lt;br/&gt;start-sleep 10&lt;/p&gt;
&lt;p&gt;#Code End.&lt;/p&gt;</description><link>http://funposh.tumblr.com/post/123287367</link><guid>http://funposh.tumblr.com/post/123287367</guid><pubDate>Sun, 14 Jun 2009 03:25:00 -0400</pubDate><category>zelda</category><category>ascii</category></item><item><title>Daily PoSH Quote!</title><description>&lt;p&gt;function motd {&lt;br/&gt;$Voice = new-object -com SAPI.SpVoice&lt;br/&gt;&lt;br/&gt;$rssUrl = &amp;ldquo;http://feeds.feedburner.com/brainyquote/QUOTEBR&amp;rdquo;&lt;br/&gt;$blog = [xml](new-object System.Net.WebClient).DownloadString($rssUrl)&lt;br/&gt;$quote = $blog.rss.channel.item[0]&lt;br/&gt;&lt;br/&gt;$quote.description&lt;br/&gt;$quote.title&lt;br/&gt;&lt;br/&gt;$Voice.Speak( $quote.description, 1 )&lt;br/&gt;&lt;br/&gt;$Voice.Speak( $quote.title, 1 )&lt;br/&gt;&lt;br/&gt;}&lt;br/&gt;&lt;br/&gt;motd{}&lt;/p&gt;</description><link>http://funposh.tumblr.com/post/122155916</link><guid>http://funposh.tumblr.com/post/122155916</guid><pubDate>Fri, 12 Jun 2009 00:17:00 -0400</pubDate></item></channel></rss>
