Skip to content

Instantly share code, notes, and snippets.

@corbob
corbob / why.ps1
Created March 10, 2018 23:20
why? But Why...
$licenses = Import-Csv $PSScriptRoot\LicenseCounts.csv
[Array]::Reverse($licenses)
$licenses = $licenses[0] | select *available*,*delta*
if($licenses.'E3 Available' -ge 25) {
write-output "E3 greater than or equal to 25: $($licenses.'E3 Available')"
$E3AvailableStyle = 'good'
} elseif ($licenses.'E3 Available' -ge 10 -and $licenses.'E3 Available' -lt 25) {
$E3AvailableStyle = 'caution'
} else {
[CmdletBinding()]
param
(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
ValueFromPipelineByPropertyName = $True)]
[string[]]$AssetTag
)
BEGIN {
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@corbob
corbob / Podcasts.md
Last active July 16, 2018 04:31
List of podcasts
function Check-Help {
[CmdletBinding()]
param (
$Command
)
$CommandExists = $false
Try {
Get-Command $Command -ErrorAction Stop
$CommandExists = $true
} catch [System.Management.Automation.CommandNotFoundException] {
@corbob
corbob / vscode-powershell-alpha-goodness.md
Last active December 24, 2023 09:01
VSCode + PSReadline - How To Start Using the Alpha PowerShell Extension for PSReadline Goodness Now

VSCode + PSReadline - How To Start Using the Alpha PowerShell Extension for PSReadline Goodness Now

Courtesy of @scrthq from slack

Chatting on Twitter with @ctmcisco about this and figured it would be worth posting for everyone here, in case anyone else is curious!

  1. Go to the Branches tab on the vscode-powershell repo in GitHub: https://github.com/PowerShell/vscode-powershell/branches
  2. Find the 2.0.0 branch, then click the green check mark in the center of the page.
  3. Click the blue Details link next to the AppVeyor line. This will take you to the most recent AppVeyor build of that branch.
  4. On the top-right of the page, just above the console output, click the Artifacts tab.
function Add-MyPhone {
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')]
param (
[Parameter(Mandatory = $true)]
[string]
$PhoneName,
[Parameter(Mandatory = $true)]
[ValidateSet('Cisco 6941', 'Cisco 7841', 'Cisco 7942')]
[string]
$Product,
function test {
[CmdletBinding(SupportsShouldProcess)]
param()
$a = New-TemporaryFile
remove-item $a
}
@corbob
corbob / ci.ps1
Created January 12, 2019 05:43
install the last searched choco package
function ci {
$lastCommand = Get-History -Count 1
$newCommand = $lastCommand.CommandLine.Replace('clist','cinst').Replace('choco list','choco install')
Invoke-Expression $newCommand
}
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
opacity: 0.8,
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',