Skip to content

Instantly share code, notes, and snippets.

View mpurdon's full-sized avatar

Matthew Purdon mpurdon

View GitHub Profile
#!/bin/bash
set -u
##############################################################################
# DEPRECATION NOTE
#
# This script is outdated. Use it at your own risk.
# First, it has a bug related to the option -o (basically, it does nothing).
# Second, there is a new github repo with a new version, with no known bugs
# and with improved features:
@vlad-bezden
vlad-bezden / twoSlicesDiffs.go
Created August 11, 2019 09:25
An example of how to find difference between two slices in Go. It uses map and empty struct (0 bytes) as a void to convert slice to map (kind of set).
/*
An example of how to find the difference between two slices.
This example uses empty struct (0 bytes) for map values.
*/
package main
import (
"fmt"
)
@mbbx6spp
mbbx6spp / .00readme.org
Last active May 26, 2024 22:53
A caching and persistent Nix shell with direnv

Cached and Persistent Nix shell with direnv integration

Problem being solved

  • the default direnv Nix integration from projects loads a Nix shell every new terminal or every time shell.nix and/or default.nix changes. On larger projects with a lot of Nix shell dependencies, that can cause the terminal to take more than 6 seconds to load, which significantly degrades the developer experience (DX).
  • when a developer garbage collects in their Nix store, often the Nix shell dependencies are deleted also which causes a slow start the next time the project’s Nix shell is requested, also degrading developer experience (DX).

Solution outline

  • on first Nix shell load, the Nix shell is evaluated fully such that direnv dumps the environment from the spawn Nix shell process
@troyfontaine
troyfontaine / 1-setup.md
Last active June 25, 2024 11:37
Signing your Git Commits on MacOS

Methods of Signing Git Commits on MacOS

Last updated March 13, 2024

This Gist explains how to sign commits using gpg in a step-by-step fashion. Previously, krypt.co was heavily mentioned, but I've only recently learned they were acquired by Akamai and no longer update their previous free products. Those mentions have been removed.

Additionally, 1Password now supports signing Git commits with SSH keys and makes it pretty easy-plus you can easily configure Git Tower to use it for both signing and ssh.

For using a GUI-based GIT tool such as Tower or Github Desktop, follow the steps here for signing your commits with GPG.

@dcode
dcode / GitHub Flavored Asciidoc (GFA).adoc
Last active June 23, 2024 21:12
Demo of some useful tips for using Asciidoc on GitHub

GitHub Flavored Asciidoc (GFA)