Skip to content

Instantly share code, notes, and snippets.

@zajdee
zajdee / Digital-Green-Certificate-Dump.py
Last active November 5, 2021 19:15
A simple tool to dump the European Union's COVID passports (Digital Green Certificates)
#!/usr/bin/env python3
# install dependencies:
# pip install base45 cbor2 (cwt - not used here)
import sys
import zlib
from base45 import b45decode
from cbor2 import loads
@mgraeber-rc
mgraeber-rc / SimulateInternetZoneTest.ps1
Created May 28, 2021 16:57
Example highlighting why attackers likely choose ISO/IMG as a delivery mechanism - it evades SmartScreen because Mark-of-the-Web (MOTW) cannot be applied to non NTFS volumes
Add-Type -OutputAssembly hello.exe -TypeDefinition @'
using System;
public class Hello {
public static void Main(string[] Args) {
System.Console.WriteLine("Hello, world!");
System.Console.Read();
}
}
'@
# Source: https://gist.github.com/181614ae807a0cb961271b11bbd18d63
######################################
# Github Actions review and tutorial #
# https://youtu.be/eZcAvTb0rbA #
######################################
# Referenced videos:
# - GitHub CLI - How to use manage repositories more efficiently: https://youtu.be/BII6ZY2Rnlc
# - Continuous integration, delivery, deployment, and testing explained: https://youtu.be/0ivcSjpUzl4
@zulhfreelancer
zulhfreelancer / kubectl-apply-stdin.md
Last active June 10, 2025 15:24
How to run "kubectl apply -f" with inline YAML as stdin?
$ kubectl apply -f - <<EOF
<-- insert YAML content here -->
EOF

OR

$ cat file.yaml | kubectl apply -f -
@rjmholt
rjmholt / powershellAPI.md
Last active May 22, 2025 07:12
Using the PowerShell API

Using the PowerShell .NET API

There are a number cases where it's desirable to call PowerShell from another .NET language, particularly from C#. The two main classes of scenario here are:

  • Running PowerShell code or reusing PowerShell commands from a cmdlet or module.
  • Using PowerShell from a standalone .NET application, usually by hosting a fresh instance of PowerShell

Both use cases have a largely similar usage pattern,

# Source: https://gist.github.com/07b0b4642b5694d0239ee7c1629173ce
#######################################################
# Kustomize #
# How to simplify Kubernetes configuration management #
# https://youtu.be/Twtbg6LFnAg #
#######################################################
#########
# Setup #
@JustinGrote
JustinGrote / Watch-AzLog.ps1
Last active June 2, 2023 08:31
Be Notified when something changes in Azure
using namespace Microsoft.Azure.Commands.Insights.OutputClasses
$ErrorActionPreference = 'Stop'
[PSEventDataNoDetails]$lastEvent = Get-AzActivityLog -MaxRecord 1 -StartTime (Get-Date).AddDays(-89) -WarningAction SilentlyContinue
if (-not $lastEvent) {throw [NotImplementedException]'You have an empty activity log!'}
while ($true) {
Write-Verbose "Waiting for new events..."
while (-not $newEvent) {
Write-Verbose "No new event detected after $($lastEvent.EventTimestamp.ToLocalTime()), waiting for changes..."
@wllmsash
wllmsash / assigning-static-ip-addresses-in-wsl2.md
Last active August 28, 2025 20:50
Assigning Static IP Addresses in WSL2

Assigning Static IP Addresses in WSL2

WSL2 uses Hyper-V for networking. The WSL2 network settings are ephemeral and configured on demand when any WSL2 instance is first started in a Windows session. The configuration is reset on each Windows restart and the IP addresses change each time. The Windows host creates a hidden switch named "WSL" and a network adapter named "WSL" (appears as "vEthernet (WSL)" in the "Network Connections" panel). The Ubuntu instance creates a corresponding network interface named "eth0".

Assigning static IP addresses to the network interfaces on the Windows host or the WSL2 Ubuntu instance enables support for the following scenarios:

@swinton
swinton / README.md
Created December 3, 2020 22:24
Using GitHub's Git data API

Using GitHub's Git data API by Example

  1. Create a blob
  2. Create a tree
  3. Create a commit
  4. Create (or update) a ref

Create a blob

package main
import (
"bytes"
"fmt"
"log"
"github.com/google/gopacket"
"github.com/google/gopacket/pcap"
)