Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>/home/thu/projects/slab/src/Slab/Command.hs</title>
<meta name="colorscheme" content="wildcharm"></meta>
<style>
* {font-family: monospace}
body {background-color: #ffffff; color: #000000; margin:0px; padding:0px; margin-top: 13.5px; margin-left: -0.5px;}
.String {color: #0000c0}
@noteed
noteed / indented-expr.hs
Created July 3, 2024 09:01
Megaparsec parser for indented multi-line expressions
-- Parse expressions layed out on multiple lines (as long as they're indented).
-- It works by using the standard @makeExprParser@ and passing it versions of,
-- say, the @lexeme'@ combinator that check the current indentation against an
-- initial one.
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad (guard)
import Control.Monad.Combinators.Expr
import Data.Void
import Text.Megaparsec
@noteed
noteed / content.slab
Last active July 4, 2024 15:29
Setting up a Nix binary cache
include layout-page.slab
let titl = "Setting up a Nix binary cache"
let date = "2024-06-05"
page{titl, date}
style.
pre, code {
max-width: 100%;
@noteed
noteed / README.md
Last active August 25, 2021 18:55
Playing with Inter
@noteed
noteed / classes.hs
Created August 22, 2021 22:01
Capabilities ?
data V4 = V4 deriving Show
data V6 = V6 deriving Show
class V4Getter getter where getIPV4 :: getter -> IO V4
class V6Getter getter where getIPV6 :: getter -> IO V6
class (V4Getter getter, V6Getter getter) => V4V6Getter getter
@noteed
noteed / README.md
Last active January 30, 2021 12:36
Learn Jira
@noteed
noteed / README.md
Last active October 10, 2020 15:38
Steam on NixOS

Steam on NixOS

A wiki page exists: https://nixos.wiki/wiki/Steam.

I started with simply nix-shell -p steam, which failed with a 404 while trying to download some .deb. I updated my nixos channel, then tried again, and got a shell.

Then I run the following and got a problem:

@noteed
noteed / Dockerfile
Last active October 8, 2020 13:41
Learn CadQuery
# Adapted from
# https://raw.githubusercontent.com/kalemena/docker-cadquery/master/Dockerfile.
FROM ubuntu:18.04
ENV LANG=C.UTF-8 LC_ALL=C.UTF-8
# Compiler tools
RUN apt-get update -y \
&& apt-get install -qqy \
wget bzip2 ca-certificates software-properties-common \
@noteed
noteed / 1.Dockerfile
Last active September 24, 2020 13:32
Two images
FROM alpine:3.12
ADD file-1.txt /
@noteed
noteed / README.md
Last active March 20, 2021 22:21
Pandoc, SQLite, and FTS

This is a Gist demonstrating how to populate a SQLite database with some content coming from a Markdown file, adding full-text search capability, and querying it with a small Scotty-based web server.

In particular, this uses

  • direnv and a shell.nix file to easily get a development environment,
  • pandoc --to markdown to remove any metadata block (an alternative is --to plain,
  • SQLite's readile function to insert the content of a file in the database,
  • SQLite's FTS feature,