Skip to content

Instantly share code, notes, and snippets.

Avatar

Cory Knox corbob

View GitHub Profile
@corbob
corbob / why.ps1
Created Mar 10, 2018
why? But Why...
View why.ps1
$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 {
View Recycle.ps1
[CmdletBinding()]
param
(
[Parameter(Mandatory = $True,
ValueFromPipeline = $True,
ValueFromPipelineByPropertyName = $True)]
[string[]]$AssetTag
)
BEGIN {
View perhaps.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View Check-Help.ps1
function Check-Help {
[CmdletBinding()]
param (
$Command
)
$CommandExists = $false
Try {
Get-Command $Command -ErrorAction Stop
$CommandExists = $true
} catch [System.Management.Automation.CommandNotFoundException] {
View add-myphone.ps1
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,
View wtf.ps1
function test {
[CmdletBinding(SupportsShouldProcess)]
param()
$a = New-TemporaryFile
remove-item $a
}
@corbob
corbob / ci.ps1
Created Jan 12, 2019
install the last searched choco package
View ci.ps1
function ci {
$lastCommand = Get-History -Count 1
$newCommand = $lastCommand.CommandLine.Replace('clist','cinst').Replace('choco list','choco install')
Invoke-Expression $newCommand
}
View hyper.js
// 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',
View hmmmm.ps1
I would like to turn this:
[ordered]@{
Envelope = [ordered]@{
Header = ''
Body = [ordered]@{
listPhone = [ordered]@{
searchCriteria = [ordered]@{
callingSearchSpaceName = '%'
}
returnedTags = [ordered]@{