Skip to content

Instantly share code, notes, and snippets.

View mathieu-benoit's full-sized avatar
🚲
learn it all

Mathieu Benoit mathieu-benoit

🚲
learn it all
View GitHub Profile
@mathieu-benoit
mathieu-benoit / Restore-WebApp-Backup-On-Slot.ps1
Last active April 17, 2017 22:52
Restore-WebApp-Backup-On-Slot
Param(
[string] [Parameter(Mandatory=$true)] $SubscriptionId,
[string] [Parameter(Mandatory=$true)] $ResourceGroupName,
[string] [Parameter(Mandatory=$true)] $WebAppName,
[string] [Parameter(Mandatory=$true)] $SlotName,
[string] [Parameter(Mandatory=$true)] $StorageAccountName,
[string] [Parameter(Mandatory=$true)] $ContainerName,
[string] [Parameter(Mandatory=$true)] $BlobFileName
)
@mathieu-benoit
mathieu-benoit / Function - MICR Code Reader.cs
Last active September 29, 2017 19:39
Function - MICR Code Reader
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
using System;
using System.Drawing;
using System.IO;
using System.Net;
using System.Net.Http;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
@mathieu-benoit
mathieu-benoit / Bash
Last active May 18, 2018 15:23
Copy Azure VM Managed Images
#This script has been inspired by this resource: https://michaelcollier.wordpress.com/2017/05/03/copy-managed-images/
#But maybe this new Private Preview feature will help in the future? https://azure.microsoft.com/en-us/blog/shared-image-gallery-now-in-limited-public-preview/
#Source:
SourceSubscriptionId=?
RG=mylinuxvm
VM=mylinuxvm
LOC=canadaeast
SNAP=mylinuxmsnapshot
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Azure.WebJobs.Host;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
{
"$connections": {
"value": {
"blogger": {
"connectionId": "/subscriptions/071eb531-0874-4eaf-823d-0a2d0d711d56/resourceGroups/MyMonthlyBlogArticle/providers/Microsoft.Web/connections/blogger",
"connectionName": "blogger",
"id": "/subscriptions/071eb531-0874-4eaf-823d-0a2d0d711d56/providers/Microsoft.Web/locations/eastus/managedApis/blogger"
},
"linkedin": {
"connectionId": "/subscriptions/071eb531-0874-4eaf-823d-0a2d0d711d56/resourceGroups/MyMonthlyBlogArticle/providers/Microsoft.Web/connections/linkedin",
@mathieu-benoit
mathieu-benoit / Deploy-Default-Sitecore-8-2-1-XM.ps1
Last active August 27, 2018 18:51
Powershell to deploy the default Sitecore XM ARM Template on Azure
# PowerShell script to deploy Sitecore 8.2.1 XM default ARM Template.
# Located here: https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore%208.2.1/xm
Param(
[string] [Parameter(Mandatory=$true)] $SubscriptionId,
[string] [Parameter(Mandatory=$true)] $ResourceGroupName,
[string] $ResourceGroupLocation = "East US",
[string] $TemplateFile = "https://raw.githubusercontent.com/Sitecore/Sitecore-Azure-Quickstart-Templates/master/Sitecore%208.2.1/xm/azuredeploy.json",
[string] [Parameter(Mandatory=$true)] $LicenseFile,
[string] $CdMsDeployPackageUrl = 'TO_REPLACE',
steps:
- bash: |
docker build \
-f $(system.defaultWorkingDirectory)/$(projectName)/Dockerfile \
-t $(registryServerName)/$(imageName):$(build.buildId) \
$(system.defaultWorkingDirectory)/$(projectName)
failOnStderr: true
displayName: 'docker build'
- bash: |
echo $(registryPassword) | docker login \
@mathieu-benoit
mathieu-benoit / Clone-WebApp-On-Slot.ps1
Created April 17, 2017 22:26
Clone-WebApp-On-Slot
#Currently there is an issue with New-AzureRmWebAppSlot so this snippet doesn't work.
#Issue entered here: https://github.com/Azure/azure-powershell/issues/3779
#Stay tuned!
Param(
[string] [Parameter(Mandatory=$true)] $SubscriptionId,
[string] [Parameter(Mandatory=$true)] $ResourceGroupName,
[string] [Parameter(Mandatory=$true)] $AppServicePlan,
[string] [Parameter(Mandatory=$true)] $WebAppName,
[string] [Parameter(Mandatory=$true)] $SlotName
@mathieu-benoit
mathieu-benoit / Dockerfile
Last active March 7, 2021 01:17
"Hello, World!" in python
# Use the official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.7-slim
# Allow statements and log messages to immediately appear in the Knative logs
ENV PYTHONUNBUFFERED True
# Copy local code to the container image.
WORKDIR /app
COPY . ./
clusterName=crfa-external
gcloud container clusters create $clusterName \
--zone=$zone \
--addons=HttpLoadBalancing,CloudRun \
--machine-type=n1-standard-2 \
--num-nodes=3 \
--enable-stackdriver-kubernetes
gcloud container clusters get-credentials $clusterName \
--zone $zone