Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am alcol80 on github.
  • I am alcol80 (https://keybase.io/alcol80) on keybase.
  • I have a public key ASDhKHkpc0_G4Zq0emb-doW16hxhJ6IH4_8fC7VTJS-j2go

To claim this, I am signing this object:

@alcol80
alcol80 / game.smt2
Last active February 27, 2018 10:21
Riddle: one car in three boxes. Possible SMT-Lib solution
; There are 3 boxes, exactly one of which has a car. You can keep the car if you pick the correct box!
;
; On each box there is a statement, exactly one of which is true.
;
; Box 1: The car is in this box.
; Box 2: The car is not in this box.
; Box 3: The car is not in box 1.
;
; Possible answers:
; - Box 1
-- Given an infinite number of quarters (25 cents), dimes (10 cents),
-- nickels (5 cents) and pennies (1 cent), write code to calculate the
-- number of ways of representing n cents.
module Coins where
comb cents = [(q, d, n, p) | q <- rng 25 cents,
d <- rng 10 (cents - 25*q),
n <- rng 5 (cents - 25*q - 10*d),
p <- rng 1 (cents - 25*q - 10*d - 5*n),
-- Nell'atrio di una scuola ci sono 100 armadietti.
-- Di notte il custode li apre tutti.
-- Poi fa una seconda passata e ne chiude uno ogni due.
-- Poi fa una terza passata e ogni tre lucchetti, lo apre o chiude a seconda se sia chiuso o aperto.
-- Poi una quarta passata, uno ogni quattro.
-- Poi una quinta e così via.
-- Dopo la centesima passata, quanti sono i lucchetti chiusi e quanti quelli aperti?
module Main where
@alcol80
alcol80 / btrfs-nixos-install.sh
Last active October 22, 2023 12:25
nixos install (boot + btrfs root + btrfs docker)
gdisk /dev/sda # make 1 partition
mkfs.vfat -n BOOT /dev/sda1
mkfs.btrfs -L root /dev/sdb
mkfs.btrfs -L docker /dev/sdc
mount -t btrfs -o noatime,discard,ssd,autodefrag,compress=lzo,space_cache /dev/sdb /mnt/
btrfs subvolume create /mnt/nixos
umount /mnt/
mount -t btrfs -o noatime,discard,ssd,autodefrag,compress=lzo,space_cache,subvol=nixos /dev/sdb /mnt/
{ ... }:
{
services.xserver = {
enable = true;
layout = "us";
windowManager.xmonad = {
enable = true; # installs xmonad and makes it available
enableContribAndExtras = true; # makes xmonad-contrib and xmonad-extras available