Skip to content

Instantly share code, notes, and snippets.

View dkapitan's full-sized avatar

Daniel Kapitan dkapitan

View GitHub Profile
uv_poetry_install () {
uv venv
uv pip install --no-deps -r <(POETRY_WARNINGS_EXPORT=false poetry export --without-hashes --with dev -f requirements.txt)
poetry install --only-root
}
@dkapitan
dkapitan / app.yaml
Created July 3, 2024 19:13
Deploy Shiny for Python on Google App Engine
runtime: python
env: flex
instance_class: F2
runtime_config:
operating_system: "ubuntu22"
runtime_version: "3.12"
# name of app
service: some-name
@dkapitan
dkapitan / sql-workbench.ipynb
Created June 25, 2024 14:34
notebook with duckdb + jupysql + polars
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dkapitan
dkapitan / query_pdok.py
Created June 17, 2024 11:03
Python script for Google Sheets Neptyne plugin to find lat-lon with pdok
import re
import requests
import urllib
PDOK = "https://api.pdok.nl/bzk/locatieserver/search/v3_1/free"
def query_pdok(query):
query_params = {
@dkapitan
dkapitan / redact_patient.py
Created June 14, 2024 19:00
Simple redacting of FHIR patient resource in ndjson
import ndjson
def redact(patient: dict) -> dict:
for key in ["name", "telecom"]:
patient.pop(key, None)
return patient
with open("patient.ndjson") as f:
@dkapitan
dkapitan / roonserver.md
Last active June 17, 2024 06:16
Runing Debian 12 as a server

Objectives

  • Get to know Debian with very minimal install to run RoonServer
  • Use Debian as Linux Docker Engine platform for dev/test

Debian 12 setup

  • Download Debian live standard (no desktop manager, link)
  • add user to sudo
  • su root
@dkapitan
dkapitan / awesome-python-rust.md
Last active November 21, 2023 08:36
awesome-python-rust

Upcoming Python libraries with a Rust runtime that are useful for the composable data stack:

  • greptime: an open-source, cloud-native, distributed time-series database with PromQL/SQL/Python supported
  • tokenizers: fast state-of-the-art tokenizers from Huggingface optimized for research and production
  • pixi: package management tool for developers, build on top of the conda packaging ecosystem
  • polars: lightning-fast DataFrame library for Rust and Python
  • pydantic: most widely used data validation library for Python, implemented in Rust since v2
  • robyn: fast, innovator friendly, and community driven Python-Rust web framework
  • RustPython: RustPython is a Python interpreter written in Rust. RustPython can be embedded into Rust programs to use Python as a scripting language for your application
@dkapitan
dkapitan / requirements.txt
Last active October 31, 2023 13:55
Base pyenv with jupyterlab
black
ipywidgets
isort
jedi-language-server
jupyterlab
jupyterlab_pygments
jupyterlab_rise
pygments
@dkapitan
dkapitan / add-kernel.sh
Created October 24, 2023 10:30
Add poetry .venv as Jupyter kernel
poetry run python -m ipykernel install --user --name pymedphys
@dkapitan
dkapitan / quarto-theme.scss
Last active August 6, 2023 08:51
Mozilla design
// Google Fonts
@import url(http://fonts.googleapis.com/css?family=Zilla+Slab|Zilla+Slab+Highlight|Inter|Fira+Code:400italic,700italic,400,700);
// Font Variables
$zilla-slab: "Zilla Slab", serif;
$zilla-slab-highlight: "Zilla Slab Highlight", serif;
$inter: "Inter", sans-serif;
$fira-code: "Fira Code";
// Colours