Skip to content

Instantly share code, notes, and snippets.

@molomby
molomby / keybase.md
Created March 22, 2018 03:21
Keybase proof

Keybase proof

I hereby claim:

  • I am molomby on github.
  • I am molomby (https://keybase.io/molomby) on keybase.
  • I have a public key ASC8MmXgjzR_szIFSsEsDFuZ2X1E7GY1XP0P0v-W9ioo4wo

To claim this, I am signing this object:

@molomby
molomby / appending-parent-dir-name-to-filenames.md
Last active March 27, 2019 06:39
Docs for appending the parent directory name to the name of files it contains

Create some test files. I've assumed your filenames have a single "." character:

mkdir foo
touch foo/one.txt foo/two.txt foo/three.txt

If you list the files (ll foo) you'll get something like:

@molomby
molomby / Keystone 5 - Secure Cookies and Reverse Proxies.md
Created March 31, 2020 05:52
Background and instructions for fixing cookie issues encountered when deploying Keystone 5 apps behind a reverse proxy (like nginx)

Keystone 5: Secure Cookies and Reverse Proxies

Can't sign in, eh?

TL;DR

When...

  • Keystone sessions are being used (eg. for authentication)
  • secureCookies Keystone config is true (the default when NODE_ENV is 'production')
@molomby
molomby / 210607 Git keys.md
Created June 7, 2021 04:04
Multiple Git SSH Key Pairs

Multiple Git SSH Key Pairs

This explains how to configure ssh to allow repos on multiple GitHub or BitBucket accounts to be developed on the same dev environment.

It assumes MacOS.

Basic Config

Usually, when using SSH (with git or otherwise), you'll have a single key pair for the machine you're on (eg. id_rsa). You might also define some default ssh options in your .ssh/config file.

@molomby
molomby / cuid.sql
Created June 22, 2021 03:40 — forked from srfrog/cuid.sql
CUIDs for PL/PgSQL
-- Collision-resistant ids optimized for horizontal scaling and performance, for PL/PgSQL.
-- Based on https://github.com/ericelliott/cuid
-- Version 1.0.0
-- Usage: SELECT cuid();
-- BEGIN CONFIG ---
-- Put a unique host ID (int) here per server instance.
-- Once set, this value should not be changed.
@molomby
molomby / create-email-alias.sh
Created February 13, 2022 00:48
Forward Email API: Wrapper Script for Creating Aliases
#!/usr/bin/env bash
# Usage:
# create-email-alias.sh $URL_OR_DESC [$SLUG]
# Example:
# create-email-alias.sh "https://www.darwinsailingclub.com.au" dsc
# Results in:
# Email dsc.g9ahxh@example.com -> me+dsc@example.net.au, comment: "https://www.darwinsailingclub.com.au"
# Environment variables can be supplied at run time or set in ~/.forward-email
@molomby
molomby / keystone.js
Created March 2, 2022 08:54
Example Keystone 6 App with a Shared Credentials List
import { config } from '@keystone-6/core';
import { statelessSessions } from '@keystone-6/core/session';
import { createAuth } from '@keystone-6/auth';
import { list, graphql } from '@keystone-6/core';
import { password, relationship, text, virtual } from '@keystone-6/core/fields';
const lists = {
User: list({
fields: {
name: text({ validation: { isRequired: true } }),
@molomby
molomby / github-latex-superscript-subscript-demo.md
Last active December 19, 2023 19:14
Superscript and Subscript in LaTeX for GitHub

Superscript and Subscript in LaTeX for GitHub

Experimenting GitHubs new LaTeX support to render superscript and subscript.

You can create mathematical expressions including superscript, eg:

$$e^{-\frac{t}{RC}}$$

But you can also put plaintext into superscript, inline $^{like\ this\ and\ ^{then\ go\ smaller}\ ^{if\ you\ want}}$. Subscript works the same but with _ instead of ^ and looks $_{like\ this}$.