Skip to content

Instantly share code, notes, and snippets.

View Blaisorblade's full-sized avatar

Paolo G. Giarrusso Blaisorblade

View GitHub Profile
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 7, 2025 13:47
set -e, -u, -o, -x pipefail explanation
// All of these compile in Dotty
// https://scastie.scala-lang.org/pLOvDSM8QNy7yNfvOhZ6xQ
class I0(i: Int) {
def this() = this()
}
object I1 {
val t : Int = 10
def this(I1: Int) = { this() }
@milessabin
milessabin / functork.scala
Created May 11, 2018 16:16
shapeless-style derivation of a FunctorK (aka HFunctor) instance for an arbitrary product F-algebra
import scala.language.{ higherKinds, implicitConversions }
object Defns {
type Id[T] = T
type ApplyTo[T] = { type λ[F[_]] = F[T] }
type Const1[T] = { type λ[F[_]] = T }
// Natural transform
trait ~>[F[_], G[_]] {
def apply[T](ft: F[T]): G[T]
package tracehash
final case class Cover(suffixLength: Int, fragmentLength: Int, coverSize: Int)
object `package` {
def stackTraceHash(ex: Throwable): String = {
val stackTrace = principalStackTrace(
Slice.of(ex.getStackTrace),
ex.isInstanceOf[StackOverflowError])
@Chobbes
Chobbes / retract-same-position.el
Created February 17, 2018 19:18
Proof-rectract-buffer Maintaining position
(defun retract-same-position ()
"Call proof-retract-buffer, but retain position"
(interactive)
(push-mark)
(proof-retract-buffer)
(pop-mark))
@gallais
gallais / Impredicative.v
Created February 14, 2018 16:51
Using Impredicativity to beat the positivity checker
Inductive T :=
| Var : nat -> T
| App : T -> T -> T.
Inductive S e : Prop :=
| def: forall R, (forall i, R i -> S i) ->
(forall e', R e' -> S (App e e')) -> S e.
Definition def' :
forall e, (forall e', S e' -> S (App e e')) -> S e.
@Icelandjack
Icelandjack / ExtensibleIsomorphisms.markdown
Last active January 8, 2018 16:56
Encoding Overlapping, Extensible Isomorphisms

Principled Meta Programming for Scala

This note outlines a principled way to meta-programming in Scala. It tries to combine the best ideas from LMS and Scala macros in a minimalistic design.

  • LMS: Types matter. Inputs, outputs and transformations should all be statically typed.

  • Macros: Quotations are ultimately more easy to deal with than implicit-based type-lifting

  • LMS: Some of the most interesting and powerful applications of meta-programming

@troyfontaine
troyfontaine / 1-setup.md
Last active April 7, 2025 14:24
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.

@gallais
gallais / swapVar.agda
Last active May 12, 2017 13:42
swapping variables
module Subst1 where
open import Term
infixl 20 _-_
_-_ : {σ : Ty} → (Γ : Con) → Var Γ σ → Con
ε - ()
(Γ , σ) - vz = Γ
(Γ , τ) - vs x = (Γ - x) , τ