Skip to content

Instantly share code, notes, and snippets.

@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.

@-moz-document domain("atlassian.net") {
html,
body {
background-color: #21252D !important;
}
html,
body,
body * {
border-color: #3C414C !important;
@-moz-document domain("oberon.virginia.xerpa.com.br") {
html {
-webkit-filter: invert(100%) !important;
}
body {
background: #222;
}
img,
iframe {
-webkit-filter: invert(100%) !important;
@thalesmg
thalesmg / Optics Cheatsheet.md
Created January 12, 2020 21:27 — forked from ChrisPenner/Optics Cheatsheet.md
Optics Cheatsheet
@thalesmg
thalesmg / dhall-lsp.el
Created January 24, 2020 22:58
Using Dhall LSP Server on Emacs
(add-to-list 'lsp-language-id-configuration '(dhall-mode . "dhall"))
(lsp-register-client
(make-lsp-client :new-connection (lsp-stdio-connection "dhall-lsp-server")
:major-modes '(dhall-mode)
:server-id 'dhall-lsp-server))
@thalesmg
thalesmg / docker-compose.yml
Last active February 2, 2020 22:58
elasticsearch docker compose
version: "3.7"
services:
elasticsearch: &base
image: elasticsearch:7.5.2
environment:
# - discovery.type=single-node
- node.name=elasticsearch
- discovery.seed_hosts=noh2
- cluster.initial_master_nodes=elasticsearch,noh2
- cluster.routing.allocation.disk.watermark.low=0.99
@thalesmg
thalesmg / .travis-ci.yml
Created February 8, 2020 14:15
Exemplo de como configurar o cachix no travis em background
# https://github.com/entropia/tip-toi-reveng/blob/2d35417e37788c629500b7c82cd82e2ff9c1e89b/.travis.yml
language: nix
nix: 2.2.1
jobs:
include:
- stage: Build
env: TARGET=linux-exe
- env: TARGET=windows-exe
@thalesmg
thalesmg / Readme.org
Created February 9, 2020 10:26
How to statically compile a Rust binary using MUSL
cargo new rust-static-nix
cd rust-static-nix
cargo build
# create/copy default.nix
nix-build
@thalesmg
thalesmg / readme.org
Created February 15, 2020 17:24
Recursively traverse a directory tree mapping config files for Nix Home Manager
ͳ nix eval '(let f = import ./recurseTree.nix; in f "")' | nixfmt
{
  xdg = {
    configFile = {
      "something/b/d/e" = { source = /tmp/nixtest/b/d/e; };
      "something/c" = { source = /tmp/nixtest/c; };
      "something/recurseTree.nix" = { source = /tmp/nixtest/recurseTree.nix; };
    };
  };
@thalesmg
thalesmg / taba.hs
Created February 22, 2020 13:31
There and back again (TABA)
-- https://doisinkidney.com/posts/2020-02-15-taba.html
zipRev :: [a] -> [b] -> [(a,b)]
zipRev xs ys = foldl f b ys xs
where
b _ = []
f k y (x:xs) = (x,y) : k xs
f k y [] = []
{-