Target:
- UEFI boot
- EFI stub booting (no GRUB/etc.)
- LUKS encrypted root filesystem
- Standard Alpine system install
Assumptions:
| // Chi-like syntactic sugar layer on top of stdlib http.ServeMux. | |
| package main | |
| import ( | |
| "net/http" | |
| "slices" | |
| ) | |
| type ( | |
| middleware func(http.Handler) http.Handler |
| alexaandru@gmail.com namespaces="git" ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCx0x2FqQPAESrRfU8+TqqikuqB1F4OLDMkGdiZzsN19/59lLGPsZgQfejjHiujCWPRb0Tpz2Jv2mB6QcUVuK/gfiMbltwCdcDNCCa0I42xOgIHoYVatry7D8mZcy+t+e1TALrEUPCod4BEn8oLLnsGy6siDzv2hWINbIs2XLCvsOisa6xERgM1Joezo5+8IshSeP9felv6PqbfKEUWV0zfsoLbxJ0WAAM8T14OA/GIm12Dmg4fNWad70Bp1Yq/0W00vpZ9up+p8kMklZYlK6QHwrIw2gzVqsIL9x3FXgVw7KFRfV1Gp1W7V2S2sumzUW/BIztA0JOWqZnd0CMsSEyX |
| package main | |
| import ( | |
| "net/url" | |
| "fmt" | |
| "github.com/tehmoon/errors" | |
| "github.com/aws/aws-sdk-go/aws/session" | |
| "github.com/aws/aws-sdk-go/service/s3/s3manager" | |
| "github.com/aws/aws-sdk-go/service/s3" | |
| "io" |
| # Return full path to problem data file. | |
| dataFileFullPath <- function(fname) { | |
| paste("data", fname, sep="/") | |
| } | |
| # Returns solution for a given problem. | |
| computeSolutionFor <- function(fname) { | |
| # This is for the standard, python solver | |
| #sol <- system(paste('python solver.py', dataFileFullPath(fname)), intern=T) | |
| sol <- system(paste('./facility', dataFileFullPath(fname)), intern=T) |
Special thanks to https://scotch.io/tutorials/create-a-single-page-app-with-go-echo-and-vue for resparking my interest for frontend development. It's been a while... :)
This represents a proof of concept, minimal web stack. I used http://nicolasmerouze.com/build-web-framework-golang/ series of articles as a starting point and the goal was to keep the stack as minimal as possible while still being useful for practical purposes. And of course, use the standard library as much as possible and only integrate components compatible with it.
| # | |
| # This class creates a model of the Monty Hall problem. | |
| # It simulates arranging the set with prize/goats, both guest | |
| # and Monty picking a door and then the decision to switch | |
| # or not to switch (and of course, the outcome). | |
| # | |
| # Each instance of the class (MontyHall.new) runs a new | |
| # show. Sample usage code is at the bottom. | |
| # | |
| class MontyHall |
| library(RColorBrewer) | |
| # Return full path to problem data file. | |
| dataFileFullPath <- function(fname) { | |
| paste("data", fname, sep="/") | |
| } | |
| # Returns solution for a given problem. | |
| computeSolutionFor <- function(fname) { | |
| cacheFile <- paste("solutions", fname, sep="/") |