Skip to content

Instantly share code, notes, and snippets.

@fdmysterious
fdmysterious / Justfile-for-docker.md
Last active November 27, 2024 02:07
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
@Intyre
Intyre / Wahoo_Elemnt.md
Last active April 25, 2025 13:53
Wahoo Elemnt - Tips, tricks and custom images
@mosquito
mosquito / README.md
Last active April 13, 2025 18:03
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@acdha
acdha / paramiko-using-ssh-config.py
Created July 23, 2013 17:16
Connecting with paramiko using the user's OpenSSH config
client = paramiko.SSHClient()
client._policy = paramiko.WarningPolicy()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh_config = paramiko.SSHConfig()
user_config_file = os.path.expanduser("~/.ssh/config")
if os.path.exists(user_config_file):
with open(user_config_file) as f:
ssh_config.parse(f)
@amalloy
amalloy / joly-4clojure-solution101.clj
Created August 31, 2011 17:54 — forked from jamesoly/joly-4clojure-solution101.clj
Memoized version of 4clojure problem 101
(def levdist
(let [lev (atom nil)
impl
(fn [s t]
(let [lev @lev]
(cond
(empty? s) (count t)
(empty? t) (count s)
:else (let [ns (rest s)
nt (rest t)]
@bmabey
bmabey / memoize_fn.clj
Created August 10, 2011 05:00
memoized anonymous functions in clojure
; inspired from http://stackoverflow.com/questions/3906831/how-do-i-generate-memoized-recursive-functions-in-clojure
(defmacro memoize-fn
"Produces a memoized anonymous function that can recursively call itself."
[fn-name & fn-args]
`(with-local-vars
[~fn-name (memoize
(fn ~@fn-args))]
(.bindRoot ~fn-name @~fn-name)
@~fn-name))