Skip to content

Instantly share code, notes, and snippets.

View phillipsj's full-sized avatar

Jamie Phillips phillipsj

View GitHub Profile
@phillipsj
phillipsj / init.ps1
Last active May 5, 2021 02:08
PowerShell script to use with Docker and custom script extension.
[CmdletBinding()]
param (
[Parameter(Position = 0)]
[String]
$Command
)
Write-Host "It started"
if (Get-Service 'Docker' -ErrorAction SilentlyContinue) {
Write-Host "Checking Docker"
if ((Get-Service Docker).Status -ne 'Running') { Start-Service Docker }
@phillipsj
phillipsj / DotnetGraph.cs
Created February 10, 2021 02:46
Example for doing Graph stuff in .NET Core
using System;
using System.Collections.Generic;
using System.Linq;
namespace Graph {
public class Vertex {
public string Value { get; }
public List<Vertex> AdjacentVertices { get; }
public Vertex(string value) {
sudo apt-get update
sudo apt-get install -y wget curl ca-certificates curl apt-transport-https lsb-release gnupg build-essential git docker.io docker-compose
wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
# Add Repos
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
@phillipsj
phillipsj / palindrome.js
Created November 30, 2020 03:09
My version which is faster than the other version. Interesting.
function myIsPalindrome(string){
let reversed = string.split("").reverse().join("");
return string === reversed ? true : false;
}
@phillipsj
phillipsj / myscript.sh
Created November 26, 2020 04:51
Just a script for testing.
#!/bin/bash
echo "It worked!"
@phillipsj
phillipsj / hosts
Created October 21, 2020 01:00
Adding sqlserver container hostname to hosts.
# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
@phillipsj
phillipsj / sqlserver-run-with-host.sh
Last active October 21, 2020 00:52
Setting the hostname when running a SQL Server Container
$ docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=SuperCoolPass123" -p 1636:1433 --name sqlserver --hostname sqlserver -d mcr.microsoft.com/mssql/server:2019-latest
4ef2e5e0c9c91b4f1e86ef807262d0f639b10ae7364c9c9cce0996e3dc28d8db
@phillipsj
phillipsj / sqlserver-run-no-host.sh
Created October 21, 2020 00:33
Running SQL Server Container without hostname defined.
$ docker run -e "ACCEPT_EULA=Y" -e "SA_PASSWORD=SuperCoolPass123" -p 1635:1433 -d mcr.microsoft.com/mssql/server:2019-latest
Unable to find image 'mcr.microsoft.com/mssql/server:2019-latest' locally
2019-latest: Pulling from mssql/server
171857c49d0f: Pull complete
419640447d26: Pull complete
61e52f862619: Pull complete
e7083eff87ee: Pull complete
8b5eb8c165f6: Pull complete
b469c4d6160e: Pull complete
ec9a85cf10f9: Pull complete
@phillipsj
phillipsj / azure-pipelines.yml
Created October 20, 2020 00:23
Azure DevOps Pipeline YAML for building database backup containers.
trigger:
- master
stages:
- stage: BackupTests
displayName: Test Database Backups
pool:
vmImage: 'Ubuntu-18.04'
jobs:
@phillipsj
phillipsj / build-execution.ps1
Created October 20, 2020 00:16
Running of the build script.
$ .\build.ps1
[+] Building 0.2s (8/8) FINISHED
=> [internal] load .dockerignore 0.0s
=> => transferring context: 2B 0.0s
=> [internal] load build definition from Dockerfile 0.1s
=> => transferring dockerfile: 981B 0.0s
=> [internal] load metadata for mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-18.04 0.1s
=> [internal] load build context 0.0s
=> => transferring context: 46B 0.0s
=> [1/3] FROM mcr.microsoft.com/mssql/server:2019-CU5-ubuntu-18.04@sha256:a4c896f11c73fd6eecaab1b96eb256c6bc0bdc 0.0s