Skip to content

Instantly share code, notes, and snippets.

@thalesmg
thalesmg / use-password-store-with-forge.org
Created January 28, 2025 16:59 — forked from timstott/use-password-store-with-forge.org
Use password-store (aka pass) with forge and github-review

Use password-store (aka pass) with forge and github-review

We can use pass as an emacs auth-source backend to access credentials.

Add auth-source-pass (included with emacs 26) to your emacs config:

(require 'auth-source-pass)
(auth-source-pass-enable)

This prepends password-store to the variable auth-sources.

@thalesmg
thalesmg / erlang-java-interop-demo.sh
Created June 28, 2023 12:44 — forked from eriksoe/erlang-java-interop-demo.sh
An Erlang-Java Interop Demo - executable summary
#!/bin/bash -x
#######################################################################
#
# Demo of Erlang IDL, as applied to property testing of Java code.
# We'll need Triq.
git clone git://github.com/krestenkrab/triq.git
(cd triq && ./rebar compile)
ERL_ROOT=`erl -noshell -eval 'io:format("~s\n", [code:root_dir()]), init:stop().'`
@thalesmg
thalesmg / print.hrl
Created December 17, 2021 19:42 — forked from uldza/print.hrl
Erlang pretty printing with ANSI console colors
%%%-------------------------------------------------------------------
%%% @author Ahmad Baitalmal
%%% @copyright (C) 2017, Ahmad Baitalmal
%%% Permission is hereby granted, free of charge, to any person obtaining
%%% a copy of this software and associated documentation files
%%% (the “Software”), to deal in the Software without restriction,
%%% including without limitation the rights to use, copy, modify, merge,
%%% publish, distribute, sublicense, and/or sell copies of the Software,
%%% and to permit persons to whom the Software is furnished to do so,
%%% subject to the following conditions:
@thalesmg
thalesmg / ssh_jump.py
Created December 2, 2021 18:21 — forked from tintoy/ssh_jump.py
SSH via jump-hosts using Paramiko
#!/usr/bin/env python3
import os
import paramiko
ssh_key_filename = os.getenv('HOME') + '/.ssh/id_rsa'
jumpbox_public_addr = '168.128.52.199'
jumpbox_private_addr = '10.0.5.10'
target_addr = '10.0.5.20'
@thalesmg
thalesmg / shell.nix
Created July 21, 2021 20:18
elixir 1.12 e erlang 24 phoenix derivation
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
elixir_1_12 = { mkDerivation }:
mkDerivation rec {
version = "1.12.0";
sha256 = "00dc3szjn2k552jp7n1c98kjab6wac9d49v2gr43pf3yzcyv8mk1";
minimumOTPVersion = "24";
@thalesmg
thalesmg / world-building-with-tom-harding.md
Created February 7, 2021 21:14 — forked from sjsyrek/world-building-with-tom-harding.md
World-Building in Haskell with Tom Harding
@thalesmg
thalesmg / gist:f759f79c32efeaff655582904885cb2c
Created November 2, 2020 22:22 — forked from sebfisch/gist:2235780
Laymans explanation of delimited continuations with examples of using them for exception handling and nondeterministic programming.

Delimited Continuations

Delimited continuations manipulate the control flow of programs. Similar to control structures like conditionals or loops they allow to deviate from a sequential flow of control.

We use exception handling as another example for control flow manipulation and later show how to implement it using delimited continuations. Finally, we show that nondeterminism can also be expressed using delimited continuations.

Exception Handling

@thalesmg
thalesmg / Optics Cheatsheet.md
Created January 12, 2020 21:27 — forked from ChrisPenner/Optics Cheatsheet.md
Optics Cheatsheet
@thalesmg
thalesmg / Intro.md
Created November 16, 2019 19:17 — forked from chrisdone/Intro.md
Statically checked overloaded strings

Statically checked overloaded strings

This gist demonstrates a trick I came up with which is defining IsString for Q (TExp a), where a is lift-able. This allows you to write $$("...") and have the string parsed at compile-time.

This offers a light-weight way to enforce compile-time constraints. It's basically OverloadedStrings with static checks.

This trick works already in existing (old) GHCs.

@thalesmg
thalesmg / reflect.py
Created September 4, 2018 18:53 — forked from 1kastner/reflect.py
A simple echo server to inspect http web requests
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from http.server import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):