Skip to content

Instantly share code, notes, and snippets.

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

@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
@destan
destan / ParseRSAKeys.java
Last active July 9, 2024 08:22
Parse RSA public and private key pair from string in Java
import java.io.IOException;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
@bartojs
bartojs / jnr-gist.clj
Last active May 16, 2020 03:14
Call libC using jnr-ffi in clojure
boot -d com.github.jnr/jnr-ffi repl
=> (import jnr.ffi.LibraryLoader)
=> (definterface LibC (^int puts [^String s]))
=> (def libname (if (.contains (.toLowerCase (System/getProperty "os.name")) "windows") "msvcrt" "c"))
=> (def libc (.load (LibraryLoader/create LibC) libname))