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 / 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',
@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 / 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
)
{
"$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 / 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;
@mathieu-benoit
mathieu-benoit / check_releases.sh
Last active December 20, 2021 13:42
check_releases.sh
#!/bin/bash
sudo apt update -y
sudo apt upgrade -y
sudo apt autoremove -y
repo='kubernetes/kubernetes'
echo $repo '(v1.22.5, v1.21.8, v1.20.14, v1.19.16)'
curl -s https://api.github.com/repos/$repo/releases | jq -r '[.[] | select(.prerelease == false and (.tag_name | startswith("v1.22")))] | .[0].tag_name'
curl -s https://api.github.com/repos/$repo/releases | jq -r '[.[] | select(.prerelease == false and (.tag_name | startswith("v1.21")))] | .[0].tag_name'
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 / setup_new_ubuntu_env.sh
Last active January 23, 2024 16:58
setup_new_ubuntu_env.sh
#!/bin/bash
sudo apt update -y
sudo apt upgrade -y
# jq
echo "Installing jq..."
sudo apt install jq -y
# helm