Skip to content

Instantly share code, notes, and snippets.

@joostmeijles
joostmeijles / gist:9046f81bcd964affc8db
Created November 10, 2015 19:24
Plot simple errorbar using pyplot
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
@joostmeijles
joostmeijles / 0_reuse_code.js
Created March 15, 2016 08:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
$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
# 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>"
@joostmeijles
joostmeijles / RemoveDockerImages.md
Last active October 8, 2019 09:57
Remove Docker images

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 $_}
# 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