Skip to content

Instantly share code, notes, and snippets.

View juliusl's full-sized avatar

Julius Liu juliusl

  • Microsoft
  • Redmond
View GitHub Profile
@juliusl
juliusl / curl-push-azure-storage-blob.sh
Created December 6, 2023 22:43 — forked from gregjhogan/curl-push-azure-storage-blob.sh
Push a file to a blob in an Azure storage account
curl -X PUT -T ./{file.dat} -H "x-ms-date: $(date -u)" -H "x-ms-blob-type: BlockBlob" "https://{storageaccount}.blob.core.windows.net/backups/{file.dat}?{sas-token}"
@juliusl
juliusl / deploy.yaml
Last active September 13, 2023 21:09
Enable Pre-Installed ACR Mirror
# Builds/Installs mirror from source
apiVersion: v1
kind: ConfigMap
metadata:
name: nsenter-actions
labels:
app: nsenter
data:
wasm: |
#!/usr/bin/env bash
@juliusl
juliusl / registry-login.sh
Last active June 23, 2023 01:29
acr-mirror login script
#!/bin/sh
set -e
# Script using curl to login to the mirror from the shell
host=$1
username=$2
password=$3
@juliusl
juliusl / aci-instructions.md
Last active August 28, 2023 20:51
Instructions for ACI

Quick start for acr-mirror

These are the following steps that are required to manually enable the mirror,

  • Install rpm package
  • Install overlaybd
  • Enable http auth
  • Configure mirror
  • Enable tcmu and overlaybd services
@juliusl
juliusl / deploy.yaml
Last active June 16, 2023 01:11
Deploy ACR Mirror via Daemonset
# Builds/Installs mirror from source
---
apiVersion: v1
kind: ConfigMap
metadata:
name: nsenter-actions
labels:
app: nsenter
data:
wasm: |
@juliusl
juliusl / match_suffix.rs
Created January 28, 2023 01:49
Trait to match suffix of types that impl AsRef<str>
mod util {
impl<T> MatchSuffix for T where T: AsRef<str> {}
/// Trait for checking if self matches a specific suffix,
///
pub trait MatchSuffix
where
Self: AsRef<str>,
{
@juliusl
juliusl / user-data.yml
Created January 13, 2023 19:48
User-Data
## template: jinja
#cloud-config
merge_how:
- name: list
settings: [append]
- name: dict
settings: [no_replace, recurse_list]
write_files:
# Create nydusd config
@juliusl
juliusl / cloud-init-hyperv.ps1
Created January 13, 2023 19:12
Cloud Init Hyper-V
$tempPath = [System.IO.Path]::GetTempPath() + [System.Guid]::NewGuid().ToString()
# ADK Download - https://www.microsoft.com/en-us/download/confirmation.aspx?id=39982
# You only need to install the deployment tools
$oscdimgPath = "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg\oscdimg.exe"
# Download qemu-img from here: http://www.cloudbase.it/qemu-img-windows/
$qemuImgPath = "E:\backbonev2\lib\bin\qemu-img-win-x64-2_3_0\qemu-img.exe"
# Update this to the release of Ubuntu that you want
@juliusl
juliusl / NameValidator.cs
Created July 20, 2022 01:45
Self-Contained NameValidator port
/// <summary>
/// Provides helpers to validate resource names across the Microsoft Azure Storage Services.
/// </summary>
public static class NameValidator
{
/// <summary>
/// Checks if a container name is valid.
/// </summary>
/// <param name="containerName">A string representing the container name to validate.</param>
public static void ValidateContainerName(string containerName)
sudo sh -c "echo 'deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/x${NAME}_${VERSION_ID}/ /' > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list"
wget -nv https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable/x${NAME}_${VERSION_ID}/Release.key -O Release.key
sudo apt-key add - < Release.key
sudo apt-get update -qq
sudo apt-get -qq -y install podman
sudo mkdir -p /etc/containers
echo -e "[registries.search]\nregistries = ['docker.io', 'quay.io']" | sudo tee /etc/containers/registries.conf