Skip to content

Instantly share code, notes, and snippets.

View timvw's full-sized avatar

Tim Van Wassenhove timvw

View GitHub Profile
timvw / gist:a71c222b93c11e7d0d2b0f0b02220ea6
Last active May 15, 2024 09:33
python importlib for modules with keyword in path
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
models = importlib.import_module("api.lambda.models")
timvw / gist:4419f55e4b52a719655b0ea8ce5cbd2e
Created May 14, 2024 08:38
raise openai.RateLimitError
import httpx
request = httpx.request("GET", "")
response = httpx.Response(429, request=request)
err = openai.RateLimitError(
"you are making too many requests...", response=response, body=None
raise err
timvw /
Created May 13, 2024 07:54
Generate python openapi client
docker run \
-v $PWD:/local \
openapitools/openapi-generator-cli generate \
-i /local/myapplication/stacks/apis/my_api.yaml \
-g python \
-o /local/target/openapi/python
timvw / gist:d1c59acb70e0357b8ef34022ef4864fa
Created May 9, 2024 20:45
Remove password from pdf (preview bug)
LC_ALL=C sed -i '' -e 's/\/EncryptMetadata false/\/EncryptMetadata true/g' ~/Desktop/kbvb_wedstrijdblad_tornooien___formulier_v.1.3.pdf
timvw / .profile
Created April 30, 2024 07:58
Shell function to load a dotenv file
dotenv() {
readonly env_file=${1:?"The env_file must be specified."}
set -o allexport
source ${env_file}
set +o allexport
timvw / mysql.txt
Created April 30, 2024 07:44
We've installed your MySQL database without a root password. To secure it run:
MySQL is configured to only allow connections from localhost by default
To connect run:
mysql -u root
To start mysql now and restart at login:
brew services start mysql
==> postgresql@16
This formula has created a default database cluster with:
initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@16
For more details, read:
postgresql@16 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.
If you need to have postgresql@16 first in your PATH, run:
timvw /
Created April 18, 2024 06:10
Update k8s on ubuntu
curl -fsSL | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update
sudo apt-get upgrade
sudo snap refresh microk8s --channel=1.29/stable
timvw / .env
Created February 27, 2024 09:30
Directory quickstart (using direnv)
timvw /
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}
NAME = '${var.external_volume_bucket_name}'
STORAGE_BASE_URL = 's3://${var.external_volume_bucket_name}'
STORAGE_AWS_ROLE_ARN = '${var.snowflake_iam_role_arn}'