Skip to content

Instantly share code, notes, and snippets.

View timvw's full-sized avatar

Tim Van Wassenhove timvw

View GitHub Profile
@timvw
timvw / main.tf
Created February 1, 2024 20:37
Build infra for creating iceberg tables in snowflake with the terraform provider
resource "snowflake_unsafe_execute" "volume" {
execute = <<EOT
CREATE OR REPLACE EXTERNAL VOLUME ${var.external_volume_name}
STORAGE_LOCATIONS =
(
(
NAME = '${var.external_volume_bucket_name}'
STORAGE_PROVIDER = 'S3'
STORAGE_BASE_URL = 's3://${var.external_volume_bucket_name}'
STORAGE_AWS_ROLE_ARN = '${var.snowflake_iam_role_arn}'
@jeremyyeo
jeremyyeo / README.md
Last active June 15, 2023 17:44
A pattern for moving dbt vars from dbt_project.yml to macros #dbt

A pattern for moving dbt vars from dbt_project.yml to macros

dbt doesn't currently support var declarations outside of the dbt_project.yml file - see relevant issue. This means that multiple users that use vars may run into conflicts or issues as they are all updating the dbt_project.yml file at the same time.

This is a temporary workaround while the core team works on enabling the above functionality.

  1. Setup the dbt_project.yml file:
# dbt_project.yml
#!/bin/bash
# Props to https://gist.github.com/kaleksandrov/3cfee92845a403da995e7e44ba771183 from whom I took the code inside
# the conditional.
THIS_SCRIPT_INVOCATION=$0
# The return status of this function will be 0 if globalprotect is running, 1 if not running because grep returns 0
# if it finds a match and 1 if not.
# We basically grep for globalprotect but exclude all the matches we don't want
@dhermes
dhermes / README.md
Last active January 30, 2024 21:45
Understanding Cross-Account ECR Options

Understanding Cross-Account ECR Options

Executive Summary

  • Common to split environments into multiple AWS accounts; e.g. sandbox:111111111111 and prod:222222222222
  • Common to have multiple Kubernetes clusters in a given account; e.g. dev and sandbox clusters in sandbox:111111111111 and beta and prod clusters in prod:222222222222
  • Centralize ECR images in a dedicated registry (one registry per AWS region);

Fibers

Fibers are an abstraction over sequential computation, similar to threads but at a higher level. There are two ways to think about this model: by example, and abstractly from first principles. We'll start with the example.

(credit here is very much due to Fabio Labella, who's incredible Scala World talk describes these ideas far better than I can)

Callback Sequentialization

Consider the following three functions

@raymondbutcher
raymondbutcher / ssm-sshuttle.md
Last active March 17, 2024 20:33
How to use sshuttle with AWS SSM session agent
@riggaroo
riggaroo / create_release_branch.yml
Last active December 5, 2023 10:21
Github Action workflow for creating release branch, updating versionName and versionCode, copying strings.xml to another repo, submitting PRs as per GitFlow.
name: Create Release Branch
on:
workflow_dispatch:
inputs:
versionName:
description: 'Name of version (ie 5.5.0)'
required: true
versionCode:
description: 'Version number (50500)'
required: true
@LauLaman
LauLaman / how_to_use_vakantieveilingen_auto_bidding_script.md
Last active April 28, 2023 18:15
vakantieveilingen.nl auto bidding script

This script will wait untill the last 2 sec of a vakantieveilingen.nl auction and place a bid as soon as you ar no longer the highest bidder. This while keeping the max value in to account. It will check the bidding every 0,2 sec.

  1. Open a auction on vakantieveilingen.nl
  2. Change the maxBid to the value you want to maximum spend. (whole euro's only)
  3. Open the developer console in your browser (how do i do this?)
  4. Paste the code in the console and hit enter
@georgmao
georgmao / samSecrets.js
Created February 15, 2020 02:20
Sample SAM template using various ways to store secrets
Resources:
ApiFunction:
Type: AWS::Serverless::Function
Properties:
Environment:
Variables:
# this is a standard lambda env var
user: "This is a regular env var"
# this is a var loaded from SSM
case class SessionInfo(sessionStartTimestampMs: Long,
sessionEndTimestampMs: Long,
numEvents: Int) {
/** Duration of the session, between the first and last events + session gap */
def durationMs: Long = sessionEndTimestampMs - sessionStartTimestampMs
}
case class SessionUpdate(id: String,
sessionStartTimestampSecs: Long,