Skip to content

Instantly share code, notes, and snippets.

View erikmd's full-sized avatar
🐓
I get many notifications; might not see your @mention: email me also if need be!

Erik Martin-Dorel erikmd

🐓
I get many notifications; might not see your @mention: email me also if need be!
View GitHub Profile
@jmsdnns
jmsdnns / tf_file_type.ml
Last active March 7, 2025 14:04
pattern matching on terraform json variations
(* val type_ : Yojson.Safe.t -> [ `Plan | `State | `Unknown ] *)
let type_ json =
let module Plan = struct
type t = {
terraform_version : string;
planned_values : Yojson.Safe.t;
}
[@@deriving of_yojson { strict = false }]
end in
@erikmd
erikmd / ocaml.md
Last active November 15, 2024 20:52

References on OCaml

@polytypic
polytypic / article.md
Last active March 19, 2025 02:10
A pattern for using GADTs to subset cases

A pattern for using GADTs to subset cases

Consider the following straightforward mutable queue implementation using two stacks:

type 'a adt_queue = {
  mutable head : 'a head;
  mutable tail : 'a tail;
}
@erikmd
erikmd / recap-magit-forge.org
Created August 13, 2023 13:40
Installation and use of magit+forge in GNU Emacs

Magit/Forge and GitHub

@erikmd
erikmd / server.py
Created February 15, 2023 09:06 — forked from mdonkers/server.py
Simple Python 3 HTTP server for logging all GET and POST requests
#!/usr/bin/env python3
"""
License: MIT License
Copyright (c) 2023 Miel Donkers
Very simple HTTP server in python for logging requests
Usage::
./server.py [<port>]
"""
from http.server import BaseHTTPRequestHandler, HTTPServer
@erikmd
erikmd / Deploy using ssh and docker-compose.md
Last active March 28, 2025 03:01 — forked from jochy/Deploy using ssh and docker-compose.md
[Ubuntu] Deploy a docker-compose from Github Actions using SSH

1. Create SSH keypair

In order to deploy using SSH, we need a SSH keypair. Please use an algorithm strong enough and also supported by GHA and your remote host.

You can use the command below to generate a keypair:

ssh-keygen -t ed25519 -C gha@vm-YourLogin -f ~/.ssh/id_gha

For this use case, don't use a passphrase (just type Return to select an empty passphrase).

@jochy
jochy / Deploy using ssh and docker-compose.md
Last active July 23, 2024 15:03
[Ubuntu] Deploy a docker-compose from Github Actions using SSH

1. Create SSH keypair

In order to deploy using SSH, we need a SSH keypair. Please use an algorithm strong enough and also supported by GHA and your remote host.

You can use the command below to generate a keypair:

ssh-keygen -t ed25519 -C gha@vm-YourLogin -f ~/.ssh/id_gha

For this use case, don't use a passphrase (just type Return to select an empty passphrase).

@erikmd
erikmd / gitconfig.md
Last active September 10, 2024 23:03
@erikmd's recommended Git configuration

Recommended Git configuration

Run these standard commands anytime you setup git on a new workstation.

Mandatory

git config --global user.name "Prénom Nom"
git config --global user.email "[email protected]"
@erikmd
erikmd / README.md
Last active August 20, 2021 14:13
Resources for Emacs-Lisp Dev

Resources for elisp dev

How to improve emacs features discoverability & elisp debugging UX

We assume you already configured MELPA and use-package.

Otherwise, see e.g. this ~/.emacs template.

Then, add the following elisp snippet in your ~/.emacs, in order to install:

@erikmd
erikmd / README.md
Last active September 8, 2024 12:50
How to setup some GIt prompt in Bash or Zsh

Howto: Setup a Git prompt for Bash or Zsh

Disclaimer

This mini-tutorial describes a dangerous step (dowload a third-party bash script and execute/source it).

In a similar case, be always careful to:

  • only do this from trusted sources (here, from a released tag in https://github.com/git/git)
  • and inspect the script beforehand! (i.e., always avoid any blind curl … | bash command)