Skip to content

Instantly share code, notes, and snippets.

Avatar

Joost joostmeijles

View GitHub Profile
View run-ssh.ps1
# Only install when sshd service is not available
if (-Not (Get-Service sshd -ErrorAction SilentlyContinue))
{
# Install choco
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
# Install SSH
choco install openssh --yes
# Install SSH server
View RemoveDockerImages.md

To remove all Docker images that match a certain repo and tag using Bash:

$ docker images --filter "reference=*/sitecore*:9.1.0-20190717" -q --no-trunc | xargs docker rmi

Using Powershell:

PS> docker images --filter "reference=*/sitecore*:9.1.0-20190717" -q --no-trunc | %{docker rmi $_}
View CreateVM.ps1
# Prepare the VM parameters
$rgName = "<region name>"
$location = "westeurope"
# Copy subnet link from Azure Portal URL
$subnet = "/subscriptions/xxxxxxxxx/resourceGroups/<resource-group-name>/providers/Microsoft.Network/virtualNetworks/<virtual-network>/subnets/<subnet>"
$nicName = "<NIC name>"
$vmName = "<VM name>"
$osDiskName = "$vmName-OSDisk"
# Copy disk URI from Azure Portal
$osDiskUri = "<disk uri>"
View CreateBlobFromSnapshot.ps1
$storageAccountName = "<accountname>"
$storageAccountKey = "<primary or secondary key>"
$absoluteUri = "<url from container blob storage>"
# Create the Azure Blob container first (in the Azure Portal)
$destContainer = "<blob container storage name>"
$blobName = "<blob name, e.g. filename>"
$destContext = New-AzureStorageContext -StorageAccountName $storageAccountName -StorageAccountKey $storageAccountKey
Start-AzureStorageBlobCopy -AbsoluteUri $absoluteUri -DestContainer $destContainer -DestContext $destContext -DestBlob $blobName
@joostmeijles
joostmeijles / 0_reuse_code.js
Created Mar 15, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@joostmeijles
joostmeijles / gist:9046f81bcd964affc8db
Created Nov 10, 2015
Plot simple errorbar using pyplot
View gist:9046f81bcd964affc8db
import numpy as np
import matplotlib.pyplot as plt
# example data
x = np.arange(0.5, 5.5, 0.5)
print x
y = np.exp(-x)
print y
You can’t perform that action at this time.