From Bas van Dijk:
To understand these things I would recommend using nix-repl:
$ nix-repl Welcome to Nix version 1.11.2. Type :? for help.
-- Functions to create and draw histograms with PostgreSQL. | |
-- | |
-- psql# WITH email_lengths AS ( | |
-- -# SELECT length(email) AS length | |
-- -# FROM auth_user | |
-- -# LIMIT 100 | |
-- -# ) | |
-- -# SELECT * FROM show_histogram((SELECT histogram(length, 0, 32, 6) FROM email_lengths)) | |
-- bucket | range | count | bar | cumbar | cumsum | cumpct | |
-- --------+-------------------------------------+-------+--------------------------------+--------------------------------+--------+------------------------ |
begin; | |
-- Load in uuid-ossp extension for uuid_generate_v1mc | |
create schema "uuid-ossp"; | |
create extension "uuid-ossp" with schema "uuid-ossp"; | |
-- Create roles | |
create role alice; | |
create role bob; |
-- from https://gist.github.com/ruslantalpa/b2f10eb1b5f6dd0fc1c154e071a1c91b | |
\set API_SCHEMA_NAME test | |
with tables as ( | |
-- Return a list of entities in the database (tables/views/materialized views) | |
select | |
n.nspname as table_schema, | |
relname as table_name, | |
case |
-- Usage with nix: | |
-- nix-shell -p "haskellPackages.ghcWithPackages (pkgs: with pkgs; [ optparse-applicative random ])" --run "runhaskell Main User Minimax" | |
-- Then input the numbers (1-9) that represent the position of the mark | |
-- | |
-- runhaskell Main User Random (first play User) | |
-- runhaskell Main Minimax User (second play User) | |
-- Using MiniMax can take a while | |
-- | |
module Main where |
# Minimal example of getting a PostgREST API running from scratch for | |
# testing purposes. It uses docker to launch a postgres database and | |
# a postgrest api server. | |
# This should not be used to deploy a production system but to | |
# understand how postgrest works. In particular there is no security | |
# implemented, see the docs for more. | |
# https://postgrest.org/en/v4.4/ |
%.hex: %.asm | |
avra -fI $< | |
rm *.eep.hex *.obj *.cof | |
all: $(patsubst %.asm,%.hex,$(wildcard *.asm)) | |
upload: ${program}.hex | |
avrdude -c arduino -p m328p -P /dev/arduino-uno -b 115200 -U flash:w:$< | |
monitor: |
The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.
However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on