This file contains hidden or 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
| Function Invoke-WolframAlphaAPI($Query) | |
| { | |
| Return (Invoke-RestMethod -Uri "http://api.wolframalpha.com/v2/query?appid=APIKEY&input=$($Query.Replace(' ','%20'))").queryresult | |
| } |
This file contains hidden or 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
| Function Start-MediaPlayer | |
| { | |
| [cmdletbinding()] | |
| Param( | |
| [Alias('P')] [String] $Path, | |
| [Alias('Sh')] [switch] $Shuffle, | |
| [Alias('St')] [Switch] $Stop, | |
| [Alias('L')] [Switch] $Loop | |
| ) |
This file contains hidden or 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
| Function Write-Pixel | |
| { | |
| param( | |
| [String] [parameter(mandatory=$true, Valuefrompipeline = $true)] $Path | |
| ) | |
| Begin | |
| { | |
| [void] [System.Reflection.Assembly]::LoadWithPartialName("System.drawing") | |
| # Console Colors and their Hexadecimal values |
This file contains hidden or 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
| Function Show-NotifyBalloon($Title, $Message) | |
| { | |
| [system.Reflection.Assembly]::LoadWithPartialName('System.Windows.Forms') | Out-Null | |
| $Global:Balloon = New-Object System.Windows.Forms.NotifyIcon | |
| $Balloon.Icon = [System.Drawing.Icon]::ExtractAssociatedIcon((Get-Process -id $pid | Select-Object -ExpandProperty Path)) | |
| $Balloon.BalloonTipIcon = 'Info' | |
| $Balloon.BalloonTipText = $Message | |
| $Balloon.BalloonTipTitle = $Title | |
| $Balloon.Visible = $true | |
| $Balloon.ShowBalloonTip(10000) |
This file contains hidden or 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
| Function Get-MP3MetaData | |
| { | |
| [CmdletBinding()] | |
| [Alias()] | |
| [OutputType([Psobject])] | |
| Param | |
| ( | |
| [String] [Parameter(Mandatory=$true, ValueFromPipeline=$true)] $Directory | |
| ) |
This file contains hidden or 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
| ForEach($item in ("C:\Users\Prateek\Downloads\music" |Get-MP3MetaData)){ | |
| $Source = $item.Fullname | |
| $Album = $item.Album | |
| Set-Location C:\Music | |
| If(-not (gci | ?{$_.name -eq "$Album" -and $_.PSisContainer})) | |
| { | |
| New-Item -Name $Album -ItemType Directory -Force |Out-Null | |
| } | |
| $destination = "C:\Music\$album" |
This file contains hidden or 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
| # Function to Get Custom Directory path | |
| Function Get-CustomDirectory | |
| { | |
| [CmdletBinding()] | |
| [Alias("CDir")] | |
| [OutputType([String])] | |
| Param | |
| ( | |
| [Parameter(ValueFromPipeline=$true,Position=0)] | |
| $Path = $PWD.Path |
This file contains hidden or 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
| function ScrollOnPromptUntil($UntilDateTime, $prePromptMsg, $postPromptMsg, $postPromptMsgOnNextLine) | |
| { | |
| $scroll = "/-\|/-\|" | |
| $idx = 0 | |
| Write-Host $prePromptMsg -NoNewline | |
| $origpos = $host.UI.RawUI.CursorPosition | |
| do | |
| { | |
| $host.UI.RawUI.CursorPosition = $origpos |
This file contains hidden or 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
| iex (New-Object Net.WebClient).DownloadString("http://bit.ly/e0Mw9w") |
This file contains hidden or 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
| #Get important words that where length is greater than 3 to avoid - in, on, of, to, by etc | |
| $FrequencyDistribution = $Content.split(" ") |?{-not [String]::IsNullOrEmpty($_)} |` | |
| %{[Regex]::Replace($_,'[^a-zA-Z0-9]','')} |group |sort count -Descending | |
| $ImportantWords = $FrequencyDistribution |?{$_.name.length -gt 3} |` | |
| select @{n='ImportanceWeight';e={$_.Count * 0.01}}, @{n='ImportantWord';e={$_.Name}} -First 10 |