Skip to content

Instantly share code, notes, and snippets.

View bzuillsmith's full-sized avatar

Ben Zuill-Smith bzuillsmith

View GitHub Profile
@bzuillsmith
bzuillsmith / Readme.md
Created January 24, 2023 02:42
Setting up a windows container in Docker

I thought WSL 2 somehow also supported windows containers but Docker 4.13.1 indicates that Hyper-V is required. 4.16.x just wouldn't work and gave a .//pipe/docker_engine-windows related exception. Could be that it didn't give a proper error message when Hyper-V was missing.

On 4.13.1 I got it running.

Setting up the mcr.microsoft.com/dotnet/framework/sdk:latest image

  1. I didn't immediately have internet. To fix this I had to add dns: [8.8.8.8] to the docker engine daemon.json settings.

  2. After step 1, TLS failed. This old image doesn't have Tls12 turned on by default. Enable it with the following run in the container

@bzuillsmith
bzuillsmith / Readme.md
Created December 22, 2022 18:02
Pipeline Script: Install mongosh and initialize a test DB
script:
  # Install mongosh
  - >
    curl -fSsL --output mongosh.tgz https://downloads.mongodb.com/compass/mongosh-1.6.1-linux-x64.tgz &&
    tar -xf mongosh.tgz -C /usr/share &&
    rm mongosh.tgz
  # Initialize test db
  - /usr/share/mongosh-1.6.1-linux-x64/bin/mongosh mongodb://root:[email protected]:27017  -f scripts/init.js
  # Run tests
  • dotnet test
@bzuillsmith
bzuillsmith / Readme.md
Created December 22, 2022 17:54
Pipeline Script: Install the AWS CLI
@bzuillsmith
bzuillsmith / gist:32571caf1f78f028ed46856dc6976096
Created December 22, 2022 17:49
Pipeline Scripts: Fetch git submodules
# How to grab git submodules
# image: mcr.microsoft.com/dotnet/sdk:6.0
# openssh required for git submodule
- apt-get update
- apt-get install --yes openssh-client
- git submodule update --init --recursive
@bzuillsmith
bzuillsmith / gist:5d5a13d6fab9194dd66fbd298798009a
Created January 16, 2018 23:24
Self-Signed Certificate for Token Signing
# The main thing to remember here is -KeySpec Signature
New-SelfSignedCertificate -CertStoreLocation cert:\localmachine\my `
-FriendlyName "Token Signing" -TextExtension @("2.5.29.37={text}1.3.6.1.5.5.7.3.3") `
-KeyUsage DigitalSignature -KeyAlgorithm RSA -KeyLength 2048 -KeySpec Signature `
-DnsName <DNS HERE>
@bzuillsmith
bzuillsmith / Self-Signed Certificate Powershell Script.ps1
Last active October 9, 2017 17:06
Powershell script to generate a self-signed certificate which is useful for ASP.NET Core 2.0
<#
.DESCRIPTION
SelfSignedCertificate Script
.NOTES
Author: Freist Li
Modified By: Ben Zuill-Smith
Usage:
1) Copy this script to a .ps1 file.
@bzuillsmith
bzuillsmith / gist:c8affaebcb6fb10ee345
Last active August 29, 2015 14:09
Odd VB error on RaisePropertyChanged
Private _selectedServerInstance As String
Property SelectedServerInstance As String
Get
Return _selectedServerInstance
End Get
Set(value As String)
_selectedServerInstance = value
RaisePropertyChanged(Function() Me.SelectedServerInstance)
End Set
End Property
/**
* Removes {}, '', null, undefined values from objects and arrays recursively
* WARNING: This should be used only on objects that are known to not have
* circular refrences. User input can't have circular dependencies because
* it could not be JSON.stringified if it did, therefore user input is safe.
*/
function scrub(obj) {
for(var prop in obj) {
if(_.isArray(obj[prop])) {
obj[prop].forEach(function() {