Skip to content

Instantly share code, notes, and snippets.

View ChristophShyper's full-sized avatar
🏠
Working from home

Krzysztof Szyper ChristophShyper

🏠
Working from home
View GitHub Profile
@ChristophShyper
ChristophShyper / aws_get_public_ips.py
Last active November 22, 2023 17:07
Script returning all public IPs associated with ENI in whole AWS Organization
View aws_get_public_ips.py
#!/usr/bin/env python3
import boto3
import botocore.exceptions
"""
Script for counting current usage of public IPv4 across all accounts and regions.
Showing average spent starting January 2024
More info https://aws.amazon.com/blogs/aws/new-aws-public-ipv4-address-charge-public-ip-insights/
@ChristophShyper
ChristophShyper / NikCollection.cfg
Last active June 23, 2022 20:38
NIK Collection config file with horrific update prompt disabled
View NikCollection.cfg
<configuration>
<group name="Instrumentation">
<key name="AllowSending" type="bool" value="0"/>
<key name="ShowInstrumentationScreen" type="bool" value="0"/>
</group>
<group name="Update">
<key name="Version" type="string" value="4.3.4"/>
</group>
<group name="Activation">
@ChristophShyper
ChristophShyper / UBC125XLT-Polish-Aviation.txt
Last active January 3, 2023 21:30
UBC125XLT - Scan125 Scanner Data File - Polish aviation - more at https://shyper.pro/ubc125xlt.html
View UBC125XLT-Polish-Aviation.txt
! Scan125 Scanner Data File - #scan125# - #full#
! Scan125 Control Program © Nick Bailey 2013-2020 V3.3.0.0 http://www.nick-bailey.co.uk
! Comments added To this file will be removed!
! PLEASE Do Not EDIT Or MESS With THIS FILE
MDL=UBC125XLT
VER=!Version 1.01.00
VOL=12
SQL=3
CNT=8
BLT=AF
@ChristophShyper
ChristophShyper / Account_details.md
Last active February 17, 2021 12:28
Filter AWS accounts for Terraform
View Account_details.md

Reading and fitlering AWS accounts' attributes with Terraform

To fix hashicorp/terraform-provider-aws#17656 I created a simple script using external data source for Terraform.

Using it I'm able, for example, to list all ACTIVE accounts with IDs or emails.

Usage

local {
  accounts_emails = split(",", data.external.accounts.result.Outputs)
@ChristophShyper
ChristophShyper / Timeouts.md
Last active July 19, 2020 21:12
Terraform timeouts
View Timeouts.md

Terraform timeouts

Resource

Will be executed only on trigger change

resource "null_resource" "first" {
}

resource "null_resource" "sleep" {
 provisioner "local-exec" {
@ChristophShyper
ChristophShyper / Metadata_DynamoDB.md
Last active February 17, 2021 12:24
Pass metadata between Terraform modules using DynamoDB. Only scalar values are possible. Maps or sets will cause issues. Much faster than remote state.
View Metadata_DynamoDB.md

Save metadata in DynamoDB

resource "aws_dynamodb_table_item" "organization" {
  table_name = "my-dyn-db-table"
  hash_key = "KeyName"
  item = jsonencode({
    KeyName = {
      S = "organization"
    }
    Outputs = {
@ChristophShyper
ChristophShyper / Metadata_S3.md
Last active November 13, 2020 17:51
Pass metadata between Terraform modules using S3. Much faster than remote state.
View Metadata_S3.md

Save outputs from a resource to a YAML file:

# Module Alpha
# https://www.terraform.io/docs/providers/aws/r/s3_bucket_object.html
resource "aws_s3_bucket_object" "outputs" {
  bucket = local.metadata_bucket
  key    = "${local.key_path}/organization.yml"
  content = yamlencode({
    "organization_arn" : aws_organizations_organization.default.arn
 "organization_id" : aws_organizations_organization.default.id
@ChristophShyper
ChristophShyper / interesting_repos.md
Last active February 8, 2023 04:14
List of some repos I find interesting
View interesting_repos.md
Repo Description Link
alphagov/aws-auth AWS authentication wrapper to handle MFA and roles https://github.com/alphagov/aws-auth
beezz/elastalert-lambda Lambda handler for Yelp's ElastAlert https://github.com/beezz/elastalert-lambda
blueimp/aws-lambda Collection of functions for AWS Lambda https://github.com/blueimp/aws-lambda
cloudposse/tfmask Terraform utility to mask select output from terraform plan and terraform apply https://github.com/cloudposse/tfmask
cytopia/awesome-ci Awesome Continuous Integration - Lot's of tools for git, file and static source code analysis. https://github.com/cytopia/awesome-ci
cytopia/docker-terraform-docs Alpine-based multistage-build version of terraform-docs and terraform-docs-replace in multiple versions to be used for CI and other reproducible automations https://github.com/cytopia/docker-terraform-docs
cytopia/docker-terragrunt Alpine-based multistage-build version of Terragrunt and Terr
@ChristophShyper
ChristophShyper / check_ip_and_cidr.ipynb
Last active May 26, 2020 10:24
Google Colab notebook getting external IP plus CIDR and network name from Whois. Great for figuring out CIDR blocks to whitelist for databases access by Colab.
View check_ip_and_cidr.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ChristophShyper
ChristophShyper / keybase.md
Last active March 12, 2020 09:06
My Keybase proof on GitHub
View keybase.md

Keybase proof

I hereby claim:

  • I am ChristophShyper on github.
  • I am biotyk (https://keybase.io/biotyk) on keybase.
  • I have a public key whose fingerprint is 7B58 8495 C657 E51B 054B 2085 C9A1 2AA4 E28D AFF1

To claim this, I am signing this object: