This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Shows how to get auth token for VSTS (Azure Devops) from Azure CLI. | |
# | |
# Extracted from various github projects: Azure CLI and Azure SDK for Go | |
# See: https://github.com/Azure/azure-sdk-for-go/blob/ca5ebc8601ba1af17b289bb42161b7afb496423f/eng/common/scripts/Helpers/DevOps-WorkItem-Helpers.ps1#L17 | |
# VSTS / Azure Devops resource identifier is: "499b84ac-1321-427f-aa17-267ca6975798" | |
organisation="your_org" | |
project="your_project" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# This creates a deployment where each pod has two containers: | |
# - Docker Server: the actual docker engine. | |
# - Docker Client: simple Ubuntu instance with docker cli so we can | |
# test the docker things. In practice this would be some CI agent | |
# like Azure Devops agent or Jenkins or anything at all. | |
# | |
# After this deployment is created, wait for a bit for docker CLI to be installed | |
# in the client container. Then shell into it and use docker commands like docker build etc | |
# to test that things actually work. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a hack to obtain azurerm_user_assigned_identity data item from | |
# the cluster.identity object. | |
# | |
# The reason we need this is depending on the kind of identity (SystemAssigned, | |
# UserAssigned) we have different fields in that object. In particular if we | |
# have UserAssigned identity, the value of principal_id will be empty, and | |
# we need to assign roles to it like Network Contributor. | |
# | |
# To use: | |
# # Grab the cluster data item |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Problem: tags in Azure are an objects like this: | |
// {tag_name: tag_value, tag_name2: tag_value2} | |
// | |
// What we want is to list these as table with name,value columns. | |
// The way I found is to convert the tag objects into arrays by | |
// simple text replace and then we can tag and value by index and | |
// can project them as columns. :) | |
Resources | |
| project tags | |
| extend tags = tostring(tags) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to use dockerised version Azure CLI (or anything else) | |
# in a totally transparent way. This solves several challenges: | |
# - Persistent login. Don't want to login every time. | |
# - Container startup time. It can be noticable. | |
# - Access to host's disk. | |
# - Run without ever using "docker" command. | |
# | |
# WINDOWS NOTE: | |
# - You *will* run into volume mapping issues on Windows, sadly. | |
# - Either remove any args with '-v` and 'v` and then everything |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env pwsh | |
# Very very small demo of Powerhell and how to use | |
# Azure CLI from within it. | |
# These should be required for all scripts. | |
# The first says to stop at any failure, almost same as bash 'set -e' | |
# except it does not apply to external commands unfortunately. | |
# The second one is to make sure informational messages are written. | |
# See: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_preference_variables?view=powershell-7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"unsafe" | |
) | |
// A demo of things you can do with strings and []byte slices | |
// in a dangerous and exciting ways. I got here by having to verify | |
// if two given strings point to the same storage in memory. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"fmt" | |
"unsafe" | |
) | |
// dirtyCast converts from []Foo to []Bar without copy. | |
func dirtyCast(foos []Foo) []Bar { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
# Sample configuration for metric generation. | |
# This is used to create random but repeatable | |
# set of metrics to populate Prometheus TSDB | |
# for further benchmarks etc. | |
# | |
# WORK IN PROGRESS | |
# TODO: | |
# - where do we configure the sample interval? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -eu | |
# Noddy script to encrypt/decrypt files using openssl private (ssh) key. | |
# Works with files and stdin. | |
# Results are stdout. | |
# | |
# Requirements: | |
# - openssl | |
# - ssh private key: ~/.ssh/id_rsa |
NewerOlder