Skip to content

Instantly share code, notes, and snippets.

View danuw's full-sized avatar

Dan Benitah danuw

View GitHub Profile
@danuw
danuw / 0-aio-env.sh
Last active June 3, 2024 00:14
AIO setup script for IoT Operations (in progress)
# Edit before running
echo "Setting up environment variables"
export SUBSCRIPTION_ID=...
export LOCATION="westeurope"
export RESOURCE_GROUP=we-aio-rg
export CLUSTER_NAME=we-aio-arck # https://learn.microsoft.com/en-us/azure/cloud-adoption-framework/ready/azure-best-practices/resource-abbreviations#compute-and-web
export KEYVAULT_NAME=we-aio-kv
#export KEYVAULT_NAME_RG=we-uciotop-rg
@danuw
danuw / azure-regions.sh
Last active June 29, 2024 23:34
az cli commands to extract azure regions and their locations
# copy paste in terminal - this excludes locations that have no coordinates - usually called Logical regions (like USA, Europe, Asia etc...)
#az account list-locations --query '[?metadata.latitude != null].{RegionName:name,Longitude:metadata.longitude,Latitude:metadata.latitude}' > azure-regions2.json
#For the Carbon Aware SDK, use to match current format
az account list-locations --query '[?metadata.latitude != null].{Name:name,Longitude:metadata.longitude,Latitude:metadata.latitude}' | jq 'reduce .[] as $item ({}; .[$item.Name] = $item)' > azure-regions2.json
@danuw
danuw / Program.cs
Created October 13, 2022 18:38
List project dependencies (not recursive yet)
using System.Xml;
// Set up a set of projects using https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-add-reference
var projectPath = "../Project1/Project1.csproj";
Console.WriteLine($"List of Project dependencies for {projectPath}");
var listOfProjectsChecked = new List<string>();
var listOfDependencies = new List<string>();
@danuw
danuw / start-ngrok-tcp.sh
Last active January 19, 2021 19:12
use ngrok to connect via ssh to remote machine et get notified of new address via IFTTT
#!/bin/sh
## based on post by bobmarksie at https://stackoverflow.com/questions/27162552/ngrok-running-in-background
# Set local port defaulted to 22
LOCAL_PORT=22
IFTTT_KEY="<key goes here>" # make sure to update with key from your webhook in IFTTT
echo "Start ngrok in background on port $LOCAL_PORT"
nohup ./ngrok tcp ${LOCAL_PORT} &>/dev/null &
@danuw
danuw / curl.md
Created January 16, 2021 23:15 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@danuw
danuw / ngrokService.sh
Created September 29, 2020 15:52 — forked from mendesbarreto/ngrokService.sh
Script to start Ngrok at raspberry every boot
#! /bin/sh
# /etc/init.d/ngrok
case "$1" in
start)
echo "Ngrok service is starting"
screen ./ngrok start -all -config /home/pi/.ngrok2/ngrok.yml
echo "Ngrok service was started"
;;
stop)
@danuw
danuw / listresourcegroups.txt
Last active July 31, 2020 16:16
Azure Cli to list all resource groups across subscriptions
for i in `az account list -o tsv | awk '{print$3}'`; do echo "switching to subscription $i" ;az account set --subscription $i; az group list -o table; done > output.txt
for i in `az account list -o tsv | awk '{print$3}'`; do echo "switching to $i subscription" ;az account set --subscription $i; az resource list -o table; done > output.txt