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
using namespace System.Management.Automation.Runspaces | |
using namespace System.Reflection | |
function Import-PSCmdlet { | |
param ( | |
[String]$Name, | |
[Type]$Type | |
) | |
Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...
// see: https://github.com/chadoe/docker-cleanup-volumes
$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
Any GitHub wiki can be cloned by appending wiki.git
to the repo url, so the clone url for
the repo https://myorg/myrepo/
is: [email protected]:myorg/myrepo.wiki.git
(for ssh) or https://github.com/my/myrepo.wiki.git
(for https).
You make edits, and commit and push your changes, like any normal repo. This wiki repo
is distinct from any clone of the project repo (the repo without wiki.get
appended).
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-Base64 { | |
param ( | |
$data | |
) | |
# if the $data is a string then ensure it is a byte array | |
if ($data.GetType().Name -eq "String") { | |
$data = [System.Text.Encoding]::UTF8.GetBytes($data) | |
} |
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 Create-AesManagedObject($key, $IV) { | |
$aesManaged = New-Object "System.Security.Cryptography.AesManaged" | |
$aesManaged.Mode = [System.Security.Cryptography.CipherMode]::CBC | |
$aesManaged.Padding = [System.Security.Cryptography.PaddingMode]::Zeros | |
$aesManaged.BlockSize = 128 | |
$aesManaged.KeySize = 256 | |
if ($IV) { | |
if ($IV.getType().Name -eq "String") { | |
$aesManaged.IV = [System.Convert]::FromBase64String($IV) | |
} |
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
#Calculates an eTag for a local file that should match the S3 eTag of the uploaded file. | |
$md5 = new-object -TypeName System.Security.Cryptography.MD5CryptoServiceProvider | |
$blocksize = (1024*1024*5) | |
$startblocks = (1024*1024*16) | |
function AmazonEtagHashForFile($filename) { | |
$lines = 0 | |
[byte[]] $binHash = @() |
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
# access chef's version constant directly | |
if Chef::VERSION.to_f >= 0.8 | |
# 0.8+ only features here | |
end | |
# node attribute, requires ohai version 0.5.4: | |
if node.chef_packages.chef.version.to_f >= 0.8 | |
# 0.8+ only features here |
NewerOlder