Skip to content

Instantly share code, notes, and snippets.

View maruel's full-sized avatar
🐢
Deleting PiB of data.

M-A maruel

🐢
Deleting PiB of data.
View GitHub Profile
import "fmt"
func main() {
fmt.Printf("Hello World..\n");
}
// next returns the next paths that can be used to make progress.
// Look at top, left, right, down, skipping 'from' and returns all the possibilities.
func (c *Canvas) next(at, from image.Point) []image.Point {
}
@maruel
maruel / gist:6d2002195c1199b8a1f1c0039eff0a55
Created November 1, 2016 13:43
halloween 2016 dlibox animations
#### IDLE
## Tree: Orange stars
{
"C": "#ff9000",
"_type": "NightStars"
}
@maruel
maruel / gist:f417e65b13ff9e99015c9191bfa33660
Created December 12, 2016 01:33
Christmas lights simple
{
"Curve": "ease-out",
"Patterns": [
{
"Child": {
"Frame": "L00001f1f1f1f",
"_type": "Repeated"
},
"MovePerHour": 21600,
"_type": "Rotate"
@maruel
maruel / Instructions
Created January 2, 2017 03:38
systemd files to enable SPI on startup on a C.H.I.P.
- Create the two files enable_spi.service and enable_spi.timer in /etc/systemd/system/
- Run the following:
sudo systemctl daemon-reload
sudo systemctl enable enable_spi.timer
sudo systemctl start enable_spi
/dev/spidev32766.0 should now be visible.
@maruel
maruel / gist:544cb4266a1c844383c2972900e42ff9
Created August 2, 2017 23:43
Raw and brotli+gzip compressed files
maruel@periph-io /var/lib/docker/web/periph.io/www $ stat -c "%6s %n" $(find ./ -type f -name "*.html*" | sort)
69 ./apps/examples/index.html
55 ./apps/examples/index.html.br
85 ./apps/examples/index.html.gz
78 ./apps/index.html
59 ./apps/index.html.br
92 ./apps/index.html.gz
23291 ./device/apa102/index.html
5622 ./device/apa102/index.html.br
6559 ./device/apa102/index.html.gz
@maruel
maruel / pwm.go
Created December 10, 2017 03:18
Creates two PWMs with different duty cycless using periph.io
package main
import (
"log"
"os"
"os/signal"
"time"
"periph.io/x/periph"
"periph.io/x/periph/conn/gpio"
@maruel
maruel / Results on go 1.10.1 amd64
Created April 11, 2018 14:54
Benchmarking functions
$ go test -bench=.
goos: linux
goarch: amd64
pkg: foo
BenchmarkAnonymousFunction-32 2000000000 0.86 ns/op
BenchmarkClosure-32 1000000000 2.26 ns/op
BenchmarkNormalFunction-32 2000000000 0.78 ns/op
BenchmarkNormalFunctionNotInline-32 500000000 2.34 ns/op
BenchmarkReturnedFunction-32 1000000000 2.36 ns/op
PASS
@maruel
maruel / Results on go 1.10.1 Raspberry Pi 3
Last active April 11, 2018 14:58
Benchmarking Go functions
$ go test -bench=m.
goos: linux
goarch: arm
BenchmarkAnonymousFunction-4 100000000 10.0 ns/op
BenchmarkClosure-4 100000000 15.3 ns/op
BenchmarkNormalFunction-4 100000000 10.0 ns/op
BenchmarkNormalFunctionNotInline-4 30000000 51.9 ns/op
BenchmarkReturnedFunction-4 30000000 57.6 ns/op
BenchmarkReturnedFunctionRepeated-4 20000000 78.5 ns/op
PASS
@maruel
maruel / gist:2d47f0ad858ad196f69f60e21eab35d0
Created April 28, 2018 18:34
periph.io beaglebone green
$ go install ./periph-info ./headers-list && headers-list && periph-info
I2C: 4 pins
Pos Name Func
1 GROUND
2 V3_3
3 GPIO12 In/Low
4 GPIO13 In/Low
J1: 6 pins
Pos Name Func