Skip to content

Instantly share code, notes, and snippets.

@rollwagen
rollwagen / awsauth
Created October 28, 2022 08:44
Bash script switching accounts in an AWS orginazation
#!/bin/bash
START_URL="https://d-0123456789.awsapps.com/start#/"
REGION="eu-central-1"
HASH="$(echo -n "$START_URL" | sha1sum | cut -d' ' -f1)"
CACHE_FILENAME="$HASH.json"
SSO_TOKEN=$(jq -r '.accessToken' < ~/.aws/sso/cache/"$CACHE_FILENAME")
@rollwagen
rollwagen / lambdaruntimequery.go
Last active September 19, 2022 09:53
Golang 'script' to query lambda runtimes across AWS accounts
package main
import (
"context"
"encoding/json"
"errors"
"flag"
"fmt"
"os"
"strings"
@rollwagen
rollwagen / lambdaruntimequery.py
Last active May 30, 2022 17:04
Python script to query lambda runtimes across AWS accounts
# -*- coding: utf-8 -*-
"""
Python cli tool to query lambda runtimes for all lambda functions in
all AWS accounts in an (SSO-) AWS Organization
Requirements / pre-requisites:
- `pip install boto3 mypy-boto3 mypy-boto3-sts mypy-boto3-sso mypy-boto3-lambda boto3-stubs[essential,sso,lambda,sts]`
@rollwagen
rollwagen / keybase.md
Last active February 13, 2022 13:43
keybase.io/rollwagen

Keybase proof

I hereby claim:

  • I am rollwagen on github.
  • I am rollwagen (https://keybase.io/rollwagen) on keybase.
  • I have a public key ASDtWgTkfepNwxe0lhdz4HNefIc67eS_gcl1N71axhZQRgo

To claim this, I am signing this object:

Dynamo DB Data Models and Modelling

It’s a bad idea to model your data in DynamoDB the same way you model your data in a relational database. The entire point of using a NoSQL datastore is to get some benefit you couldn’t get with a relational database. If you model the data in the same way, you not only won’t get that benefit but you will also end up with a solution that’s worse than using the relational database!

from Alex DeBrie: The DynamoDB book

@rollwagen
rollwagen / aws_cloudformation_validation.md
Last active October 4, 2021 12:51
aws_cloudformation_validation

aws cloudformation "validation"

consider the following sample cloudformation yaml file y.yaml

Resources:
  S3SampleBucketinstacks3bucketF253E29D:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: "Test_S3SampleBucketinstacks3bucketF253E29D"
      BucketVersioningConfiguration: Enabled
@rollwagen
rollwagen / archlinux_arm_on_esxi_fling.md
Last active August 20, 2023 20:24
Arch Linux ARM on ESXi Fling (on Raspberry Pi 4)

arch linux arm on esxi fling (on raspberry pi 4)

  • create / Register VM -> Linux / Other 4.x or Later (64bit) -> ...

    • CD/DVD Drive: use a Linux ISO that can boot into a recue shell e.g 'debian-10.9.0-arm64-netinst.iso'; make sure "Connect at power on" is selected
    • VM Options / Boot options: Firmware "EFI" (should be the default anyways)
  • power On VM -> should see GNU GRUB welcome screen (from debian ISO/cdrom) -> Advanced Options -> Rescue mode

    • go through menu selections (language, keyborad, etc) until you have a shell ('Execute a shell in the intaller environment')
  • partition the disk; see also ArchLinux Wiki Partition the disk

@rollwagen
rollwagen / lsof_netstat_on_macos.md
Last active February 8, 2024 17:06
lsof / netstat on macos

lsof / netstat on macos

lsof - list open files

  • display (list) all open TCP+UDP ports and grep for listening ones
    • sudo lsof -i -P | grep LISTEN
      COMMAND     PID           USER   FD   TYPE             DEVICE SIZE/OFF   NODE NAME
      launchd       1           root   11u  IPv6 0x26dd73cb700390df      0t0    TCP *:22 (LISTEN)
      ....
@rollwagen
rollwagen / vagrant_libvirt_macos.md
Last active May 24, 2021 09:56
Vagrant on macos with libvirt

Vagrant using libvirt on macos

Pre-reqs

   brew install qemu gcc libvirt
   brew services start libvirt
   vagrant plugin install vagrant-libvirt
@rollwagen
rollwagen / synack.md
Last active May 7, 2021 15:03
SYN-ACK with scapy
  • Listening...
python -m http.server
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/) ...
  • Scapy
    • Crafting and sending single TCP SYN packet
from scapy.all import *