Skip to content

Instantly share code, notes, and snippets.

View timvw's full-sized avatar

Tim Van Wassenhove timvw

View GitHub Profile
@timvw
timvw / port-user.sh
Created May 5, 2022 11:51
Describe which process is using a given TCP port (macos)
lsof -nP -i4TCP:$1
@timvw
timvw / Cargo.toml
Created May 3, 2022 20:58
datafusion-aws-glue-catalog (example)
[package]
name = "rust-playground"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
aws-config = "0.11.0"
aws-sdk-s3 = "0.11.0"
@timvw
timvw / deployment-controller-token
Last active January 21, 2022 10:20
Get token for k8s dashboard http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login
kubectl -n kube-system get secret -o json | \
jq -r '.items[] | select(.metadata.name | startswith("deployment-controller-token")) | .data.token' | \
base64 --decode | \
pbcopy
@timvw
timvw / ratelimited-cats.scala
Created November 16, 2021 17:02
Ratelimit with cats-effect
package be.icteam.sample
import cats.effect._
import cats.implicits._
import cats.effect.concurrent.Semaphore
import java.util.concurrent.Executors
import scala.concurrent.ExecutionContext
@timvw
timvw / master2main.sh
Created January 28, 2021 09:28
Deal with git repos where master has been renamed to main
git branch -m master main && \
git fetch origin && \
git branch -u origin/main main && \
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
@timvw
timvw / terraform.yml
Created January 20, 2021 05:54
github actions to plan/apply multiple terraform projects
name: "Terraform"
on:
push:
branches:
- master
pull_request:
jobs:
terraform:
#!/bin/bash
#set -x
partitions_between() {
local from=$1
local to=$2
local offset_in_seconds=$3
local fmt=$4
current=$from
@timvw
timvw / gist:65fdc3410acf3297d79d40b1094287e4
Created February 14, 2020 18:31
get-resources-in-all-regions.sh
aws ec2 describe-regions | \
jq -r '.Regions[] | .RegionName' | \
xargs -l aws resourcegroupstaggingapi get-resources --region | \
jq '.ResourceTagMappingList[] | .ResourceARN'
@timvw
timvw / cleanup.sh
Created February 5, 2020 09:54
Cleanup github repositories
# get token from https://github.com/settings/tokens (repo and delete_repo permissions)
export TOKEN=""
curl -H "Authorization: token $TOKEN" https://api.github.com/user/repos | \
jq '.[].full_name' | \
grep demo | \
gxargs -I '{}' curl -H "Authorization: token $TOKEN" -X DELETE https://api.github.com/repos/'{}'
@timvw
timvw / 1_cloudkarafka-exports.sh
Last active October 17, 2019 09:04
connect to cloudkarafka with vanilla kafka tools
#!/bin/bash
# Export variables if not set already
export CLOUDKARAFKA_BROKERS="${CLOUDKARAFKA_BROKERS:-ark-01.srvs.cloudkafka.com:9094,ark-02.srvs.cloudkafka.com:9094,ark-03.srvs.cloudkafka.com:9094}"
export CLOUDKARAFKA_USERNAME="${CLOUDKARAFKA_USERNAME:-herecomesyourusername}"
export CLOUDKARAFKA_PASSWORD="${CLOUDKARAFKA_PASSWORD:-herecomesyourpassword}"