Skip to content

Instantly share code, notes, and snippets.

@coltonbh
coltonbh / docker-swarm-gpu.md
Last active March 19, 2025 11:21
Docker Swarm GPU Support

GPU Support For Docker Swarm

Docker compose has nice support for GPUs, K8s has moved their cluster-wide GPU scheduler from experimental to stable status. Docker swarm has yet to support the device option used in docker compose so the mechanisms for supporting GPUs on swarm are a bit more open-ended.

Basic documentation

Lambda Island Open Source is hiring remotely a part-time maintainer to help us manage our open source efforts. This includes over a dozen projects like the Kaocha test runner, deep-diff, Regal, lambdaisland/uri, and Glögi.

This is not about doing major feature work, instead it's about everything else, all the other things that go into running a successful open source project.

Note that this is in a sense a "public" position, you will be visible in the

@eev2
eev2 / create-scratch-buffer.el
Last active February 14, 2025 21:02
Create a new scratch buffer in emacs
(defun create-scratch-buffer (&optional nomode)
"Create a new scratch buffer and switch to it. If the region is active, then
paste the contents of the region in the new buffer. The new buffer inherits
the mode of the original buffer unless nomode is set.
Return the buffer."
(interactive "P")
(let (bufname (mjmode major-mode) (paste (and (region-active-p) (prog1 (buffer-substring (mark t) (point)) (deactivate-mark)))))
(if (and (not nomode) (boundp 'ess-dialect) ess-dialect)
(setq mjmode (intern-soft (concat ess-dialect "-mode"))))
(setq bufname (generate-new-buffer-name "*scratch*"))
@holyjak
holyjak / blog.scss
Last active November 20, 2023 15:35
Cryogen customization: autolink headings etc.
#post a.anchor, #custom-page a.anchor {
float: left;
padding-right: 4px;
margin-left: -20px;
}
@teamblack-ci
teamblack-ci / 00-update-vault.sh
Last active July 13, 2024 09:44
Let's Encrypt certificate management using Certbot and Vault
#!/bin/sh
#
# Perform certificate updates in Vault.
set -eo pipefail
if ! vault token lookup > /dev/null; then
echo "Login to Vault first."
exit 1
fi
@lnostdal
lnostdal / fast_local_mutation.clj
Last active July 13, 2024 16:58
Clojure: Performance of with-local-vars vs. atom vs. volatile vs. unsynchronized-mutable field
;; Performance of with-local-vars vs. atom vs. volatile vs. unsynchronized-mutable field.
(definterface IOObject
(setVal [new-val])
(getVal [])
(oswap [f])
(oswap [f x])
(oswap [f x y])
(oswap [f x y z]))
@stellingsimon
stellingsimon / AuditingConnection.java
Last active September 9, 2023 08:50
Recording row-level auditing information from an application's user session context in a Postgres DB (9.5+)
package example.postgres.audit;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Savepoint;
@ThomasVitale
ThomasVitale / Main.java
Last active June 11, 2023 08:54
Keycloak Admin REST API for Java
import com.sun.org.apache.regexp.internal.RE;
import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;
import org.keycloak.admin.client.Keycloak;
import org.keycloak.admin.client.KeycloakBuilder;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.admin.client.resource.UsersResource;
import org.keycloak.representations.idm.CredentialRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import java.util.Arrays;
@innovia
innovia / kubernetes_add_service_account_kubeconfig.sh
Last active January 29, 2024 23:00
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@pesterhazy
pesterhazy / reagent-ref-functions.clj
Last active January 19, 2023 11:31
Using ref functions with reagent
;; React supports "refs" as a way for a component to get a
;; handle to its children. Classically, refs were string-based.
;; Recent versions of React support callback attributes as a
;; more elegant variant of accessing DOM notes or components.
;;
;; This example uses a Form-3 component as per
;; https://github.com/Day8/re-frame/wiki/Creating-Reagent-Components
;;
;; For callback refs, see React's documentation
;; https://facebook.github.io/react/docs/more-about-refs.html