Skip to content

Instantly share code, notes, and snippets.

@gusbicalho
gusbicalho / gulp.config.js
Created September 22, 2015 21:54
Arquivos de configuração para build
module.exports = function() {
var tsconfig = require('./tsconfig.json');
var temp = '.temp/';
var src = 'src/';
var config = {
/** Diretório de arquivos compilados para dev */
temp: temp,
/** Arquivos fonte */
src: src,
/**
@gusbicalho
gusbicalho / litbash.sh
Last active February 27, 2019 16:40
literate bash
#! /usr/bin/env bash
cat test.md | awk 'BEGIN { inBash = 0 } $0 == "```" { inBash = 0 } inBash { print $0 } $0 == "```bash" { inBash = "true" }' | bash
# sample use: cat test.md | ./litbash.sh
@gusbicalho
gusbicalho / goals.md
Last active March 8, 2019 13:03
Tiny Log project

Goals

Below are things we could implement, in descending priority.

Core

  • Each process should be part of a single cluster of processes
  • Each cluster should handle a single log
  • Processes should be lightweight
  • Adding and removing members from a cluster should be easy and foolproof
  • No need for a process to be able to change cluster membership; killing and starting a new one should be fine
@gusbicalho
gusbicalho / start-here-you-are-not-so-smart.md
Last active November 11, 2022 14:49
A roadmap of interesting books

START HERE: You are not so smart

I recomend reading at least two of the above.

If you feel like you know enough about how your mind is fucked-up miscalibrated, you can move on to the lists below. Each one has a few sublists. The order of the sublists does not matter. For each sublist, the first link is the one I see as a good starting point, but the order does not matter too much, either.

@gusbicalho
gusbicalho / TypeLevelSets.hs
Created May 24, 2019 17:49
Simple implementation of TypeLevelSets
{-# LANGUAGE
DataKinds, DeriveGeneric, FlexibleContexts, FlexibleInstances, FunctionalDependencies,
GADTs, MultiParamTypeClasses, ScopedTypeVariables, TypeFamilies, TypeOperators,
UndecidableInstances
#-}
module TypeLevelSets (
ToSet, Add, Delete, Union, Difference
) where
import GHC.TypeLits
(ns components-example
(:require [com.stuartsierra.component :as component]))
(defprotocol Counter
(get-c [this])
(inc-c! [this]))
(defrecord SimpleCounter [counter]
component/Lifecycle
(start [this]
@gusbicalho
gusbicalho / StateMachine.hs
Last active May 13, 2020 20:56
Some approaches to making a state machine in Haskell
module StateMachine where
import Data.Foldable (foldlM)
data Init = Init
deriving (Eq, Show)
data A = A Int
deriving (Eq, Show)
data B = B String
deriving (Eq, Show)
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE StandaloneKindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE QuantifiedConstraints #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}