PostHeaderIcon Holy Profile Trick! Add a Daily Bible Verse to Your PowerShell Console


Excellent profile customization.  I use this one myself, and honestly it’s my favorite one.  Keeps my head in the right place.

This PowerShell profile customization is simple and sweet:  Go grab a webpage source; parse the lines to get to the juice; display a daily bible verse on my PowerShell console.

Step 1:  Create your PowerShell profile.

Step 2:  Add this code to your PowerShell profile.

# Add a daily bible verse
$web = new-object system.net.webclient
($web.DownloadString("http://www.christnotes.org/dbv.php").split("<")|? {$_ -match "dbv-reference"}).split(">")[1]
($web.DownloadString("http://www.christnotes.org/dbv.php").split("<")|? {$_ –match "dbv-content"}).split(">")[1].replace("&quot;","`"").replace("&#039","’")

I’ve done the webpage parsing before.  It really does work, but there’s a caveat:  The webpage source can change. 

If, for example the source webpage changes their <DIV> names to be something other than “dbv-reference” and “dbv-content” I would have refigure how to parse the page for the content I want.

God bless!

Michael

5 Responses to “Holy Profile Trick! Add a Daily Bible Verse to Your PowerShell Console”

  • Marcus says:

    Very nice tip. I have added this and plan on keeping it as long as it works… I’ll be trying to fix it if things change.

    • ILovePowershell says:

      Thanks for the positive feedback. I’ve noticed it down before for a day or 2, but so far it’s always come back in the right place. I really miss it when it’s gone!

  • Darrin says:

    Hello,

    I’m very new to PowerShell and I was wondering if you could help me use your bible quote trick for a different website. This may sound like a joke, but it actually isn’t. I would like to pull Atheist quotes from http://www.chrisbeach.co.uk/viewQuotes.php

    Maybe I can just change the web address but I’m guessing there is more to it than that.

    Thanks in advance.

    Darrin

  • Yasutaka says:

    Very nice technique indeed, thanks!
    The script was fetching data from the website twice, so have modified it to fetch it once.

    # Add a daily bible verse
    $web = new-object system.net.webclient
    $content = $web.DownloadString(“http://www.christnotes.org/dbv.php”)
    ($content.split(“”)[1]
    ($content.split(“”)[1].replace(“"”,”`”").replace(“&#039″,”’”)

Leave a Reply

Real Time Web Analytics