Skip to content

Instantly share code, notes, and snippets.

View mill5james's full-sized avatar

James Pansarasa mill5james

View GitHub Profile
@mill5james
mill5james / main.tf
Created April 14, 2021 20:51
Docker for Windows Airflow Development Env
##############################################################################
# State Storage
##############################################################################
terraform {
backend "kubernetes" {
secret_suffix = "airflow"
load_config_file = true
}
}
{{/*
Convert YAML to envirment variables for .NET Core hosting environment naming
*/}}
{{- define "translateEnv" -}}
{{- range $key, $value := . }}
{{- if or (kindIs "map" $value) (kindIs "slice" $value) }}
{{- include "prefixItem" (dict $key $value) }}
{{- else }}
- name: {{ $key }}
value: {{ $value | squote }}
function Repeat-Command
{
param (
[Parameter(Mandatory=$true)][scriptblock]$Command,
[Parameter(Mandatory=$false)][int]$Delay = 1
)
$Title = $host.ui.RawUI.WindowTitle;
try {
$host.ui.RawUI.WindowTitle = $Command
<#
.SYNOPSIS
Configures remote machine debugging for Visual Studio Code and Visual Studio 2017+.
.DESCRIPTION
Will ensure that all the required software is available or it will install the prerequisites, creates any necessary SSH keys and files on the local and remote machine, validates the connection to the remote host, and finally configures remote debugging for IoT Edge modules.
.PARAMETER RemoteHost
The DNS name or IP address of the remote host. If not suppllied, the script will prompt the user.
function Init-AzSphere {
pushd "C:\Program Files (x86)\Microsoft Azure Sphere SDK"
cmd /c "InitializeCommandPrompt.cmd&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
Write-Host "`nDeveloper Command Prompt for Azure Sphere tools set." -ForegroundColor Yellow
function Tfs-GetAll { tf vc get /force /noprompt /recursive }
function Tfs-CleanAll {
param (
[switch]$NoPrompt = $false
)
$optional = ''
if ($NoPrompt) { $optional += '/noprompt '}
Move-Item -Path ./.vscode ./.vscode-hold
tf vc reconcile /clean /recursive /exclude:.store,.vs,.vscode-hold,*.vspscc $optional
@mill5james
mill5james / docker.ps1
Created November 5, 2018 13:10
Docker helpers
function Clean-DockerImages {
docker images -q | % { docker rmi -f $_ }
}
function Stop-DockerContainers {
docker ps -a -q | % { docker rm -f $_ }
}
@mill5james
mill5james / Retry-Command.ps1
Created November 5, 2018 13:09
PowerShell Retry
function Retry-Command
{
param (
[Parameter(Mandatory=$true)][string]$command,
[Parameter(Mandatory=$true)][hashtable]$args,
[Parameter(Mandatory=$false)][int]$retries = 5,
[Parameter(Mandatory=$false)][int]$secondsDelay = 2
)
# Setting ErrorAction to Stop is important. This ensures any errors that occur in the command are
@mill5james
mill5james / VsDev.ps1
Created November 5, 2018 13:08
Visual Studio Vars in PowerShell
function VsDev {
pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools"
cmd /c "VsDevCmd.bat&set" |
foreach {
if ($_ -match "=") {
$v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])"
}
}
popd
Write-Host "`nVisual Studio 2017 Command Prompt variables set." -ForegroundColor Yellow
@mill5james
mill5james / App.java
Last active April 20, 2018 15:25
Rulebook problem
import com.deliveredtechnologies.rulebook.Fact;
import com.deliveredtechnologies.rulebook.FactMap;
import com.deliveredtechnologies.rulebook.NameValueReferableMap;
import com.deliveredtechnologies.rulebook.model.runner.RuleBookRunner;
public class App {
public static void main(String[] args) {
RuleBookRunner rules = new RuleBookRunner("rules");
NameValueReferableMap<String> facts = new FactMap<>();
facts.put("key", new Fact<>("value"));