Skip to content

Instantly share code, notes, and snippets.

View petiepooo's full-sized avatar
🏠
Working from home

Pete petiepooo

🏠
Working from home
  • Central Virginia
View GitHub Profile
@milesrichardson
milesrichardson / inherit_environment_variables_from_pid_1.md
Created January 21, 2023 07:35
inherit environment variables from PID 1

You can inherit the environment variables from PID 1 by iterating over the list of null-terminated strings in /proc/1/environ, parsing the first characters up to the first = as the variable name, setting the remaining value as that variable, and exporting it.

The Code Snippet

This works with multiline environment variables, and environment variables with arbitrary values, like strings, including = or JSON blobs.

Paste this in your current terminal session to inherit the environment variables from PID 1:

@jaytaylor
jaytaylor / delete-from-v2-docker-registry.md
Last active April 19, 2024 18:12
One liner for deleting images from a v2 docker registry

One liner for deleting images from a v2 docker registry

Just plug in your own values for registry and repo/image name.

registry='localhost:5000'
name='my-image'
curl -v -sSL -X DELETE "http://${registry}/v2/${name}/manifests/$(
    curl -sSL -I \
        -H "Accept: application/vnd.docker.distribution.manifest.v2+json" \