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
<# | |
iwr http://bit.ly/gifterm | iex | |
$env:gifq='cats and dogs'; iwr http://bit.ly/gifterm | iex | |
#> | |
using namespace System.IO | |
param( | |
[string]$Query = ($env:gifq), | |
[string]$QueryRoot = 'https://giphy.com/search' | |
) |
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
[alias] | |
start = "!f() { \ | |
baseTag='1'; \ | |
startTag=$1; \ | |
selectedTag=${startTag:-${baseTag:-startTag}}; \ | |
git reset --hard $selectedTag; \ | |
git clean -df; \ | |
git tag -l $selectedTag -n999; \ | |
}; f" | |
next = "!f() { \ |
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
<# | |
.SYNOPSIS | |
A simple example of Write-Host | |
#> | |
# Displays the message | |
Write-Host -Object 'Hello' | |
# Try to silence directly | |
Write-Host "Still shown :-(" -InformationAction SilentlyContinue |
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
<# | |
.SYNOPSIS | |
Creates a guid of a specified format and writes to the clipboard | |
.EXAMPLE | |
PS> NewGuid | |
Write a new guid to your clipboard | |
e.g. 8a3c4316-5865-405d-94b7-5992446b12ce |
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
$feedStub = "http://www.myget.org/F/{0}/api/v2/FindPackagesById()?Id='{1}'" | |
$package = "Microsoft.Framework.Runtime.Roslyn" | |
$feeds = @("aspnetmaster", "aspnetvnext") | |
$feeds | % { Invoke-RestMethod -uri ($feedStub -f $_, $package) } | select -ExpandProperty properties | select version | |
<# | |
Output | |
Version | |
------- |
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
<# | |
.EXAMPLE | |
Get the "Batch File Download" address for the (Hyper-V) VM of your choice from https://modern.ie/en-gb/virtualization-tools#downloads | |
PS> $source = "https://az412801.vo.msecnd.net/vhd/VMBuild_20141027/HyperV_2012/IE11/Windows/IE11.Win7.For.Windows.HyperV_2012.txt" | |
PS> $destination = (mkdir "$env:USERPROFILE\downloads\vms" -Force) # or use default | |
PS> Install-IEVM $source $destination -import # Will import to default locations | |
#> | |
Function Install-IEVM { | |
param( | |
[Parameter(Mandatory=$true)] |
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
# Example of running Invoke-FillDB.ps1 | |
# Additional files to download | |
$downloads= @( | |
"http://www.gutenberg.org/files/42698/42698-0.txt", | |
"http://www.gutenberg.org/cache/epub/42705/pg42705.txt", | |
"http://www.gutenberg.org/cache/epub/42710/pg42710.txt", | |
"http://www.gutenberg.org/files/42700/42700-0.txt", | |
"http://www.gutenberg.org/files/42706/42706-0.txt" | |
) |
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 Copy-ItemWithPath { | |
param( | |
[Parameter(Mandatory=$true, Position=0, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] | |
[Alias("FullName")] | |
[string[]]$item, | |
[Parameter(Mandatory=$true, Position=1)] | |
[string]$destination, | |
[Parameter(Mandatory=$true, Position=2)] | |
[string]$root | |
) |
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
<# | |
.SYNOPSIS | |
Calculate a high Fibonnachi number and send a Pushover message | |
#> | |
Import-Module PS-Pushover | |
Start-Job -ScriptBlock { | |
$current = $previous = 1; | |
while ($current -lt 1000000000) { |
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
<# | |
.NOTES | |
You'll need the excellent C# driver: http://docs.mongodb.org/ecosystem/drivers/csharp/ | |
#> | |
Add-Type -Path "c:\mongodb\bin\MongoDB.Bson.dll" | |
Add-Type -Path "c:\mongodb\bin\MongoDB.Driver.dll" | |
Function Import-CsvToMongo{ | |
param($path, $dbUrl, $collection, $matchCol) #matchCol is used as a lookup to check if entry is to be added or updated |
NewerOlder