Skip to content

Instantly share code, notes, and snippets.

View gutzbenj's full-sized avatar
🌈
think of your environment

Benjamin gutzbenj

🌈
think of your environment
View GitHub Profile
@welel
welel / click_dict_type.py
Created June 10, 2023 10:38
Custom dict type for the Python library click.
import click
class DictParamType(click.ParamType):
"""Represents the dictionary type of a CLI parameter.
Validates and converts values from the command line string or Python into
a Python dict.
- All key-value pairs must be separated by one semicolon.
- Key and value must be separated by one equal sign.
@liviaerxin
liviaerxin / README.md
Last active July 17, 2025 11:47
FastAPI and Uvicorn Logging #python #fastapi #uvicorn #logging

FastAPI and Uvicorn Logging

When running FastAPI app, all the logs in console are from Uvicorn and they do not have timestamp and other useful information. As Uvicorn applies python logging module, we can override Uvicorn logging formatter by applying a new logging configuration.

Meanwhile, it's able to unify the your endpoints logging with the Uvicorn logging by configuring all of them in the config file log_conf.yaml.

Before overriding:

uvicorn main:app --reload
@amotl
amotl / example_era5_planetary.py
Created February 27, 2023 21:36
Lazily access ECMWF's ERA5 data via xarray from Planetary Computer's SpatioTemporal Asset Catalog (STAC) API. The data is physically stored in Zarr format on Azure Blob Filesystem (ABFS).
"""
About
=====
Lazily access ECMWF's ERA5 data via xarray from Planetary Computer's
SpatioTemporal Asset Catalog (STAC) API. The data is physically stored in Zarr
format on Azure Blob Filesystem (ABFS).
Setup
=====
@ML-engineer
ML-engineer / duckdb_bq_storage_api.py
Created July 4, 2022 22:08
Read BQ table to DuckDB directly from storage read api
import duckdb
from google.cloud import bigquery
bqclient = bigquery.Client()
table = bigquery.TableReference.from_string(
"bigquery-public-data.utility_us.country_code_iso"
)
rows = bqclient.list_rows(table)
country_code_iso = rows.to_arrow(create_bqstorage_client=True)
cursor = duckdb.connect()
@nbenns
nbenns / k8s-alternative-mac
Created January 31, 2022 19:16
Install Podman and Kind on Mac to replace docker-desktop
brew install podman --head # you must use head due to issues with kind compatibility
# make sure docker desktop is deleted
sudo unlink /usr/local/bin/docker
sudo ln -s /usr/local/bin/podman /usr/local/bin/docker
podman machine init
podman machine start
podman machine ssh
@yokawasa
yokawasa / ghcr.md
Last active July 13, 2025 12:58
ghcr (GitHub Container Registry)

ghcr (GitHub Container Registry) quickstart

CLI

To push container images to ghcr, you need peronal access token (PAT) - see how to create PAT

  1. Get PAT (personal access token)

Personal Settings > Developer settings > Personal access tokens

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mulle-nat
mulle-nat / Cherry-Tastatur.keylayout
Created September 27, 2019 14:29
Cherry Stream 3.0 für Mac OS Keyboard Layout
<?xml version="1.1" encoding="UTF-8"?>
<!DOCTYPE keyboard SYSTEM "file://localhost/System/Library/DTDs/KeyboardLayout.dtd">
<keyboard group="0" id="4712" name="Cherry-Tastatur, Deutsch" maxout="1">
<layouts>
<layout first="0" last="17" mapSet="ANSI" modifiers="Modifiers"/>
<layout first="18" last="18" mapSet="JIS" modifiers="Modifiers"/>
<layout first="21" last="23" mapSet="JIS" modifiers="Modifiers"/>
<layout first="30" last="30" mapSet="JIS" modifiers="Modifiers"/>
<layout first="33" last="33" mapSet="JIS" modifiers="Modifiers"/>
<layout first="36" last="36" mapSet="JIS" modifiers="Modifiers"/>
@hydrosquall
hydrosquall / index.md
Last active January 8, 2022 19:35
Building Inclusive Code Review Culture
@cbandy
cbandy / .gcloudignore
Last active November 13, 2023 10:17
Ignore everything except allowed files in .gcloudignore
# Ignore everything
/[!.]*
/.?*
# Except the Cloud Function files we want to deploy
!/package.json
!/index.js
!/lib/**
#!include:.gitignore