< ^ txt
Thu Feb 1 09:37:47 EST 2018
Slept from eleven to seven without waking.
High of thirty-eight and partly cloudy, but temperatures fall throughout the day.
Work:
- Docker notes
Done.
https://paulgorman.org/technical/docker.txt
- Work on MECS
Done.
- 3:30 PM call with Bullseye and AT&T regarding fiber
Done.
https://www.tucny.com/telephony/asterisk-rpms
https://fedoraproject.org/wiki/How_to_create_an_RPM_package
Adding storage of recent log entries in MECS, I played with Go's circular list type:
// cirlist plays with Go's circular list container.
package main
import (
"container/ring"
"fmt"
)
func main() {
r := ring.New(3)
for i := 0; i < 10; i++ {
r = r.Next()
r.Value = i
fmt.Println(r.Value)
}
fmt.Println("---")
for i := 0; i < r.Len(); i++ {
r = r.Next()
fmt.Println(r.Value)
}
}
Twenty-minute walk at lunch.
Sunny and not too cold. Windy.
The complexity of Docker put me off it for a long time, but it might be OK.
It's certainly more robust than systemd-nspawn.
Much more of a real competitor to LXC (though, I admit, the battle seems lost for LXC).
Home:
- Play with ring containers in Go
Done.
Raspberry Pi variants:
http://www.friendlyarm.com/index.php?route=product/category&path=69
> Boustrophedon is a Greek word meaning “in the manner of an ox,” and scripts written in it move like an ox plowing a field, reversing direction with each line.
https://hub.docker.com/_/busybox/
The fact that Busybox includes runit could be quite useful in a Docker container.
[EDIT: the following is significantly improved in tomorrow's entry.]
// ringlog uses Go's ring container to keep the latest log entries.
package main
// Multiple runs will show that the ringLogger goroutine does not guarantee
// the exact order of entries. In a non-trivial use, make the ring size
// large enough to catch all the interesting recent entries.
import (
"container/ring"
"fmt"
"log"
)
var errCount int = -1
var errCh chan error = make(chan error, 3)
var errRing = ring.New(5)
func getTestError() error {
errCount++
return fmt.Errorf("test error %v", errCount)
}
func ringLogger() {
for e := range errCh {
log.Println(e)
errRing.Value = e
errRing = errRing.Next()
}
close(errCh)
}
func main() {
go ringLogger()
for i := 0; i < 10; i++ {
err := getTestError()
if err != nil {
errCh <- err
}
// Uncomment (and import "time") to see how output regularizes:
// time.Sleep(time.Millisecond * 100)
}
for i := 0; i < errRing.Len(); i++ {
fmt.Println("Reprint of", errRing.Value)
errRing = errRing.Next()
}
}
Lunch: coffee, falafel bowl
Dinner: pizza
< ^ txt