Skip to content

Instantly share code, notes, and snippets.

@frenata
frenata / Justfile-for-docker.md
Created November 27, 2024 02:07 — forked from fdmysterious/Justfile-for-docker.md
Justfile for docker

Justfile for docker

This gist shows how to use the just command runner for a docker based project. The trick is to give the ability to call the recipes inside or outside the container, making it compatible for example with pipelines, or Devcontainers.

image_name := env_var_or_default("IMAGE_NAME", "buildenv:componentTesting")

# https://stackoverflow.com/questions/23513045/how-to-check-if-a-process-is-running-inside-docker-container
@frenata
frenata / evil.py
Created December 12, 2024 15:19
abuse python decorators + default mutable args
import functools
import datetime as dt
def capture():
def decorator(func):
@functools.wraps(func)
def wrapper(*args, ctx=[], **kwargs):
if len(ctx) > 0:
print(f"this function was last called at {ctx[-1][0]}")
ctx.append((dt.datetime.now(), args, kwargs))
## put this file in ~
[working-directory: '/Users/frenata/src/nix-darwin-config']
rebuild:
darwin-rebuild switch --flake .#roar