Skip to content

Instantly share code, notes, and snippets.

@teyc
teyc / Invoke-Test.ps1
Created May 22, 2020 22:57
Powershell Run Tests and Rerun Failed ones again
# READ ME
# > Import-Module psake
# > Invoke-PSake
#
# TODO consider marking failed tests in the first pass as inconclusive
# rather than deleting them?
param (
[Parameter(mandatory=$false)] $Assembly = ".\Prism.AutomatedTesting.CustomerFirst\bin\Debug\Prism.AutomatedTesting.CustomerFirst.dll",
[Parameter(mandatory=$false)] $exclude = @("FixMe","IgnoreMe","Sprint17","FutureSprint")
)
@teyc
teyc / https.go
Created May 10, 2020 04:26
Makes a HTTPS server in go that returns headers and client cert
package main
/*
# Generate private key
openssl ecparam -genkey -name secp384r1 -out server.key
# request a new certificate with subj (sign request with this key)
openssl req -new -subj "/CN=test.agaassistance.com.au" -key server.key
@teyc
teyc / Wait-FileChangeEvent.ps1
Created May 7, 2020 23:15
Waits until a file is changed
<#
.SYNOPSIS
Waits until a file changes
.EXAMPLE
.\Wait-FileChangeEvent.ps1 site.scss { taildwindcss site.scss -o output\site.css }
Waits until site.scss changes and runs a script
#>
@teyc
teyc / FsSQLProvider.fsproj
Created March 14, 2020 08:41
F# SQL provider
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
@teyc
teyc / cloud-config.yml
Last active August 30, 2019 23:12
Rancher OS cloud-config.yml
# from auto-login in rancher
# $ sudo /bin/bash
# $ passwd rancher
# <type new password>
# $ ros install -d /dev/sda -c https://gist.githubusercontent.com/teyc/7456b73a2b6b0a4d0363afd3f8bfd010/raw/47a6c7e2d03b74bb416c71a8598dd49bbf2ca7a3/cloud-config.yml
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMLtZknmnutqaOIKBgF9WNSHAn5rOOC19+xpIvE8xGE teyc@cognoware.com
@teyc
teyc / cloud-config.yml
Created August 30, 2019 22:54
Rancher OS cloud-config.yml
ssh_authorized_keys:
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMLtZknmnutqaOIKBgF9WNSHAn5rOOC19+xpIvE8xGE teyc@cognoware.com
@teyc
teyc / .ok
Last active October 12, 2019 00:41
Ansible - Setting up new website
# OK profile for Ansible
eval $(ssh-agent)
ansible-playbook git-install.yml --extra-vars="hostname=webservers" -K
ansible-playbook nginx-install.yml --extra-vars="hostname=webservers" -K
# deployment
ansible-playbook lemp-install.yml --extra-vars="hostname=drsweeteng.com domain=drsweeteng.com ansible_user=root"
ansible-playbook main-install.yml --extra-vars="hostname=drsweeteng.com domain=drsweeteng.com ansible_user=root"
ansible-playbook add-domain-git.yml --extra-vars="hostname=drsweeteng.com domain=drsweeteng.com ansible_user=root"
@teyc
teyc / index.html
Created June 3, 2019 20:48
Monitoring Health Checks
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Health Check Status</title>
<link href="//unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" rel="stylesheet">
<link rel="stylesheet" href="index.css">
@teyc
teyc / SerilogTraceListener.cs
Last active March 11, 2024 12:05
Enterprise Log Lib Serilog Listener
[ConfigurationElementType(typeof(CustomTraceListenerData))]
public class SerilogTraceListener: CustomTraceListener
{
public override void Write(string message)
{
}
public override void WriteLine(string message)
{
@teyc
teyc / convertToCamelCase.js
Last active February 7, 2019 01:18 — forked from sibu-github/convertToCamelCase.js
convert a JSON keys to camel case
// convert a key string to camelcase
function toCamelCase(str) {
// when str is not defined reuturn
if (!str) {
return str;
}
return str.charAt(0).toLowerCase() + str.substring(1);
}