Skip to content

Instantly share code, notes, and snippets.

View toddysm's full-sized avatar

Toddy Mladenov toddysm

View GitHub Profile
@toddysm
toddysm / dockerhub-registry-auth.rest
Last active January 30, 2024 05:26
Docker Hub Registry Authentication REST Requests
@toddysm
toddysm / manual-authentication-with-acr.txt
Last active June 19, 2023 01:11
Authenticating with Azure Container Registry (ACR)
# As per the instructions at https://github.com/Azure/acr/blob/main/docs/AAD-OAuth.md
# Prep: Set env variables
registry="<USE_YOUR_REGISTRY_HERE>"
tenant="<USE_YOUR_TENANT_HERE>"
subscription="<USE_YOUR_SUBSCRIPTION_HERE>"
scope="registry:catalog:*"
# Step 1: Get AAD access token
aad_access_token=`az account get-access-token --subscription $subscription --query "accessToken" --output tsv`
echo $aad_access_token
# Step 2: Get a refresh token for ACR
@toddysm
toddysm / creating-self-signed-certificates.txt
Last active January 17, 2022 23:39
creating-self-signed-certificates
# Generate fake signing key and request
openssl req -utf8 -nameopt multiline,utf8 -config real-cert-data.conf -new -sha256 -newkey rsa:4096 -nodes -keyout real-key.pem -days 730 -out real-req.pem
# Check the fake signing key and request
openssl req -text -nameopt lname,sep_multiline,utf8 -in real-req.pem -noout
# or
openssl req -text -nameopt lname,utf8 -in real-req.pem -noout | grep Subject:
# Self-sign the fake certificate request
openssl x509 -req -nameopt lname,utf8 -days 730 -in real-req.pem -signkey real-key.pem -out real-cert.crt
@toddysm
toddysm / l4-docker-registry.gist.json
Created May 11, 2021 01:55
Hierarchical Azure IoT Edge - Layer 4 Modules (OSS Registry + API Proxy)
{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"modules": {
"registry": {
"settings": {
"image": "registry:latest",
"createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5000/tcp\":[{\"HostPort\":\"5000\"}]}}}"
},
@toddysm
toddysm / nginx.conf
Created May 11, 2021 01:47
Azure IoT Edge API Proxy Configuration
events { }
http {
proxy_buffers 32 160k;
proxy_buffer_size 160k;
proxy_read_timeout 3600;
error_log /dev/stdout info;
access_log /dev/stdout;
@toddysm
toddysm / l4-connected-registry.gist.api-proxy.conn-str.json
Created May 11, 2021 01:42
Hierarchical Azure IoT Edge - Layer 4 Modules (ACR Connected Registry with Connection String and API Proxy)
{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"modules": {
"connectedRegistry": {
"settings": {
"image": "10.16.7.4/acr/connected-registry:0.2.0",
"createOptions": "{\"HostConfig\":{\"Binds\":[\"/home/azureuser/connected-registry:/var/acr/data\",\"/usr/local/share/ca-certificates:/usr/local/share/ca-certificates\",\"/etc/ssl/certs:/etc/ssl/certs\"]}}"
},
@toddysm
toddysm / gist:502c9615e6215fd612c3fd4a579db661
Created April 16, 2021 03:43
Hierarchical Azure IoT Edge - Layer 5 Modules (ACR Connected Registry with Environment Variables Configuration)
{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"modules": {
"connectedRegistry": {
"settings": {
"image": "mcr.microsoft.com/acr/connected-registry:0.2.0",
"createOptions": "{\"HostConfig\":{\"Binds\":[\"/home/azureuser/connected-registry:/var/acr/data\"],\"PortBindings\":{\"8080/tcp\":[{\"HostPort\":\"8080\"}]}}}"
},
@toddysm
toddysm / gist:3aec198a24cb9579299ba5728e174cd0
Created April 16, 2021 01:28
Hierarchical Azure IoT Edge - Layer 5 Modules (OSS Registry + API Proxy)
{
"modulesContent": {
"$edgeAgent": {
"properties.desired": {
"modules": {
"registry": {
"settings": {
"image": "registry:latest",
"createOptions": "{\"HostConfig\":{\"PortBindings\":{\"5000/tcp\":[{\"HostPort\":\"5000\"}]}}}"
},
@toddysm
toddysm / fix.sh
Created May 25, 2020 01:46 — forked from alexalouit/fix.sh
fix Logstash error "logstash load error: ffi/ffi -- java.lang.NullPointerException: null" on Raspbian
#!/bin/bash
# based on https://github.com/mew2057/CAST/blob/6c7f7d514b7af3c512635ec145aa829c535467dc/csm_big_data/config-scripts/logstashFixupScript.sh
# see: https://github.com/elastic/logstash/issues/10755
apt-get update
apt-get install -f zip unzip
STARTDIR=$(pwd)
JARDIR="/usr/share/logstash/logstash-core/lib/jars"
@toddysm
toddysm / win-backbutton-style.html
Created March 25, 2013 17:12
Sample Windows 8 Page Control demonstrating how to style the back button.
<!DOCTYPE html>
<html>
<meta charset="utf-8" />
<title>homePage</title>
<!-- WinJS references -->
<link href="//Microsoft.WinJS.1.0/css/ui-light.css" rel="stylesheet" />
<script src="//Microsoft.WinJS.1.0/js/base.js"></script>
<script src="//Microsoft.WinJS.1.0/js/ui.js"></script>