Skip to content

Instantly share code, notes, and snippets.

View hermannolafs's full-sized avatar
☸️

Hermann Ólafsson hermannolafs

☸️
View GitHub Profile
@hermannolafs
hermannolafs / az.ssh.vm.pf.sh
Created January 31, 2024 10:34
az ssh vm port forward
az ssh vm --ip 1.2.3.4 -- "-L 3000:127.0.0.1:3000"
@hermannolafs
hermannolafs / configuration.nix
Last active June 20, 2024 23:52
Nixos Gnome RDP Remote Desktop
{
# minimized for clarity.
# Some of these might not be needed. After some trial and error
# I got this working with these configs.
# I do not have the patience to rn an elimination test.
services.gnome.gnome-remote-desktop.enable = true;
# Enable the X11 windowing system.
services.xserver.enable = true;
@hermannolafs
hermannolafs / kubectl-unset.sh
Created March 30, 2023 08:19
Unset kubernetes context/config/clusters/users/current-context
kubectl config unset clusters && kubectl config unset contexts && kubectl config unset users && kubectl config unset current-context
@hermannolafs
hermannolafs / jme.sh
Last active February 20, 2024 08:38
Random JMEs path bullshit
owner="meow"
# Search for VMs by tag and output ID in a list
az vm list --query "[?tags.owner=='${owner}'].id" --output tsv
# Get children of mgmt group
az account management-group show --name "internal" --expand --query "children[].name"
az aks list --subscription opaopaopa --query "[].{Cluster:name, Power:powerState.code, Status:provisioningState}" --output table
@hermannolafs
hermannolafs / bastion_nsg.tf
Created October 4, 2022 09:41
Azure Bastion Network Security Groups NSG
resource "azurerm_subnet_network_security_group_association" "bastion-to-vm" {
subnet_id = azurerm_subnet.this.id
network_security_group_id = azurerm_network_security_group.bastion_to_pipelines.id
}
resource "azurerm_network_security_group" "bastion_to_pipelines" {
name = "vm-nsg"
location = azurerm_resource_group.this.location
resource_group_name = azurerm_resource_group.this.name
apiVersion: v1
kind: Pod
metadata:
name: azcli-delete-me
spec:
containers:
- name: azcli
image: mcr.microsoft.com/azure-cli
# Just spin & wait forever
command: [ "/bin/bash", "-c", "--" ]
@hermannolafs
hermannolafs / k8s-simpserver.yaml
Created November 30, 2021 16:26
Simple HTTP server config for K8s, meant for basic network stuff.
apiVersion: v1
kind: Pod
metadata:
name: simpserver
spec:
containers:
- name: simpserver
image: python:3.10
command: ["python3"]
args: ["-m", "http.server", "8080"]
@hermannolafs
hermannolafs / azure-pipelines.yml
Created February 12, 2021 12:11
Azure Pipelines Golang Test with test resulsts and code coverage artifacts
- job: jobRunTestsuites
container: golang:1.15-buster
displayName: "Run Testsuites"
steps:
- task: Bash@3
displayName: "Go | Test and handle test cov"
inputs:
targetType: inline
workingDirectory: "$(System.DefaultWorkingDirectory)"
script: |