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
resource "null_resource" "secret_tune" { | |
triggers { | |
config_content = "${sha512("${file("data/sys/mounts/secret/tune.json")}")}" | |
} | |
provisioner "local-exec" { | |
command = "curl -X POST -H \"X-VAULT-TOKEN:$VAULT_TOKEN\" -d '${file("data/sys/mounts/secret/tune.json")}' $VAULT_ADDR/v1/sys/mounts/secret/tune" | |
} | |
} |
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
#! /bin/bash | |
WHITELIST=$(vault list -format=json auth/aws-ec2/identity-whitelist | jq -r '.[]') | |
INSTANCES=$(aws ec2 describe-instances) | |
INSTANCE_LIST=$(echo $INSTANCES | jq -r '.Reservations[].Instances[] | .InstanceId') | |
for item in $WHITELIST; do | |
if echo $INSTANCE_LIST | grep -w $item > /dev/null; then | |
echo "Skipping..." |
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
var SCREEN_WIDTH = window.innerWidth, | |
SCREEN_HEIGHT = window.innerHeight, | |
mousePos = { | |
x: 400, | |
y: 300 | |
}, | |
// create canvas | |
canvas = document.createElement('canvas'), | |
context = canvas.getContext('2d'), |
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-FileHash | |
{ | |
param( [string]$filePath, | |
[string]$alg = 'SHA256') | |
$stream = $null | |
$filePath = Resolve-Path $filePath | |
try | |
{ |
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 Convert-ToBase64 | |
{ | |
param( [Parameter(Mandatory=$true)][String]$target ) | |
$b = [System.Text.Encoding]::UTF8.GetBytes($target) | |
[System.Convert]::ToBase64String($b) | |
} | |
function Convert-FromBase64 | |
{ | |
param( [Parameter(Mandatory=$true)][String]$target ) |
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
param( | |
[string] $file = $(throw 'a filename is required'), | |
[string] $algorithm = 'sha256' | |
) | |
$fileStream = [system.io.file]::openread((resolve-path $file)) | |
$hasher = [System.Security.Cryptography.HashAlgorithm]::create($algorithm) | |
$hash = $hasher.ComputeHash($fileStream) | |
$fileStream.close() | |
$fileStream.dispose() |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project InitialTargets="" DefaultTargets="All" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | |
<PropertyGroup> | |
<AssemblyFile>$(MSBuildThisFileDirectory)\..\packages\MSBuild.Extension.Pack\tools\net40\MSBuild.ExtensionPack.TaskFactory.PowerShell.dll</AssemblyFile> | |
</PropertyGroup> | |
<UsingTask TaskFactory="PowershellTaskFactory" TaskName="CreateDatabaseTask" AssemblyFile="$(AssemblyFile)"> | |
<ParameterGroup> | |
<ScriptsDirectory Required="true" ParameterType="System.String" /> | |
<Server Required="true" ParameterType="System.String" /> |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0"> | |
<Target Name="SetupProject"> | |
<MakeDir Directories="$(MSBuildProjectDirectory)\obj;$(MSBuildProjectDirectory)\bin" /> | |
</Target> | |
<Target Name="CleanProject"> | |
<RemoveDir Directories="$(MSBuildProjectDirectory)\obj;$(MSBuildProjectDirectory)\bin" /> | |
</Target> |
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
# All you should have to do to connect to a remote machine is type: | |
# Remote-Connect <machineIP> | |
# Then the cmdlet will ask you for your credentials and you can continue. | |
function Remote-Connect | |
{ | |
param([Parameter(Mandatory=$true)][string]$machine) | |
$opt=New-PSSessionOption –skipcacheck | |
Enter-PsSession $machine -usessl -SessionOption $opt –cred (get-credential) |
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
param($VersionOne, $VersionTwo) | |
$result = compare-object (get-content $VersionOne) (get-content $VersionTwo) -IncludeEqual | |
Write-Host "+ " $VersionOne -ForegroundColor DarkGray | |
Write-Host "- " $VersionTwo -ForegroundColor DarkGray | |
Write-Host "=======================================" -ForegroundColor DarkGray | |
$result | foreach { | |
if($_.SideIndicator -eq "==") |
NewerOlder