Skip to content

Instantly share code, notes, and snippets.

Chris Hunt cdhunt

Block or report user

Report or block cdhunt

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cdhunt
cdhunt / Mount Outlook Drive
Last active May 22, 2020
Browse your email from PowerShell like a folder
View Mount Outlook Drive
Import-Module Simplex
New-PSDrive mail -psprovider simplex -root "C:\Temp\outlookprov.ps1"
cd mail:\Inbox
@cdhunt
cdhunt / Get-Service.ps1
Last active Mar 25, 2020
A Linux implementation of Get-Service
View Get-Service.ps1
Function Get-Service {
[CmdletBinding()]
Param(
[Parameter( Position = 0, ValueFromPipeline = $True )][String]$Name
)
Begin {
# Stop Function if Not Linux
If ( -Not $IsLinux ) {
@cdhunt
cdhunt / map_fold.ps1
Created Oct 27, 2016
Map and Fold implementations in Powershell
View map_fold.ps1
function map([scriptblock]$map, [Collections.IEnumerable]$x, $y) { $x.ForEach({& $map $_ $y}) }
# Two parameters
map { param($x, $y) $x + $y } @(1,2,3) 10
# Anonymous function as a value
$squareIt = { param($x) $x + $x }
map $squareIt @(1,2,3)
# One parameter
@cdhunt
cdhunt / Get-CredentialFromWindowsCredentialManager.ps1
Last active Jul 11, 2019 — forked from toburger/Get-CredentialFromWindowsCredentialManager.ps1
Gets a PowerShell Credential [PSCredential] from the Windows Credential Manager. This only works for Generic Credentials.
View Get-CredentialFromWindowsCredentialManager.ps1
<#
.SYNOPSIS
Gets a PowerShell Credential (PSCredential) from the Windows Credential Manager
.DESCRIPTION
This module will return a [PSCredential] object from a credential stored in Windows Credential Manager. The
Get-StoredCredential function can only access Generic Credentials.
Alias: GSC
@cdhunt
cdhunt / downloadsgenerator.ps1
Last active Jan 23, 2018
Download Simulator
View downloadsgenerator.ps1
#requires -Module NameIt
while ($true) {
$limit = Get-Random -Minimum 500 -Maximum 4000
$t = 0
$p = 0
$r=ig "[adjective]-[noun]_v#.#.##."
$r += @('zip', 'exe', '7zip') | Get-Random
while($p -lt 100) {
View pestergenerator.ps1
#requires -Module NameIt
while ($true) {
$tc = Get-Random -Minimum 1 -Maximum 15
$t = 0
$c=ig "[noun]"
Write-Host "`t Context $c" -ForegroundColor Green
@cdhunt
cdhunt / snapdrive.psm1
Created Sep 27, 2017
NetApp Windows Unified Host Utilities DSC Resource
View snapdrive.psm1
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[parameter(Mandatory = $true)]
[System.String]
$Path,
@cdhunt
cdhunt / Humanizer.psm1
Last active Sep 7, 2017
Making Humanizer a bit easier to use in Powershell.
View Humanizer.psm1
<#
.Synopsis
Short description
.DESCRIPTION
Long description
.EXAMPLE
Example of how to use this cmdlet
.EXAMPLE
Another example of how to use this cmdlet
#>
View Should-Volume.ps1
function ArchitestVolumeHaveSizeRemaining([Microsoft.Management.Infrastructure.CimInstance]$ActualValue, $ExpectedValue, [switch] $Negate)
{
$ActualValuePropertyValue = $ActualValue | Select-Object -ExpandProperty SizeRemaining
[bool] $succeeded = $ActualValuePropertyValue -gt $ExpectedValue
if ($Negate) { $succeeded = -not $succeeded }
$failureMessage = ''
if (-not $succeeded)
@cdhunt
cdhunt / .hyper.js
Last active Mar 16, 2017
Hyper config
View .hyper.js
module.exports = {
config: {
// default font size in pixels for all tabs
fontSize: 14,
// font family with optional fallbacks
fontFamily: '"Fira Code", monospace',
uiFontFamily: '"Fira Code", monospace',
You can’t perform that action at this time.