Skip to content

Instantly share code, notes, and snippets.

@Intyre
Intyre / Wahoo_Elemnt.md
Last active June 25, 2024 14:44
Wahoo Elemnt - Tips, tricks and custom images
@mosquito
mosquito / README.md
Last active July 24, 2024 14:40
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/docker-compose@.service. 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))