Skip to content

Instantly share code, notes, and snippets.

@JimPaine
JimPaine / dotnet-dct-dockerfile
Created November 19, 2021 12:18
Docker file for building a .NET 6 app using Docker Content Trust due to dotnet-sdk image not being signed.
FROM debian:bullseye-slim AS build-env
RUN apt-get update && apt-get install -y wget
RUN wget https://packages.microsoft.com/config/debian/11/packages-microsoft-prod.deb -O packages-microsoft-prod.deb \
&& dpkg -i packages-microsoft-prod.deb \
&& rm packages-microsoft-prod.deb
RUN apt-get update && apt-get install -y apt-transport-https dotnet-sdk-6.0
WORKDIR /app
@JimPaine
JimPaine / linux-aad.sh
Created September 3, 2019 05:38
Linux AAD Integration
resourceGroup=linuxaad
location=westeurope
vmName=linuxaad
az group create --name $resourceGroup --location $location
az vm create \
--resource-group $resourceGroup \
--name $vmName \
--image UbuntuLTS \
@JimPaine
JimPaine / profile.json
Last active June 24, 2019 14:19
Windows Terminal profile settings
{
"globals" :
{
"alwaysShowTabs" : true,
"defaultProfile" : "{2c4de342-38b7-51cf-b940-2309a097f518}",
"initialCols" : 120,
"initialRows" : 30,
"keybindings" :
[
{
@JimPaine
JimPaine / AzureMaps.tf
Created December 10, 2018 07:40
Provision Azure maps with Terraform Azure template deployment, outputs the primary key for use within other terraform resources.
resource "azurerm_template_deployment" "demo" {
name = "maparm"
resource_group_name = "${azurerm_resource_group.demo.name}"
template_body = <<DEPLOY
{
"$schema": "http://schema.management.azure.com/schemas/2014-04-01-preview/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"name": {
@JimPaine
JimPaine / SasTokenHelper.cs
Created August 13, 2018 14:15
Helper class to generate the Authorization header when working with Shared Access Signatures and Azure Services
namespace SasTokenHelper
{
public static class SasTokenGenerator
{
public static void GenerateSasAuthorizationHeader(this HttpRequestHeaders headers, string resourceUri, DateTime expiry, string keyName, string privateKey)
{
string encodeUri = HttpUtility.UrlEncode(resourceUri);
int timeout = CalculateEpoch(expiry);
string sasToken = GenerateSasToken(encodeUri, timeout, privateKey);
@JimPaine
JimPaine / rpi-sensehat.py
Created August 3, 2018 13:43
python used to pull details from rpi sensehat and send them into Azure via a ServiceBus
import uuid
import datetime
import random
import json
from azure.servicebus import ServiceBusService
from sense_hat import SenseHat
sense = SenseHat()
sbs = ServiceBusService(service_namespace='', shared_access_key_name='', shared_access_key_value='')