Skip to content

Instantly share code, notes, and snippets.

💙
Coding Go

Peter Hellberg peterhellberg

💙
Coding Go
Block or report user

Report or block peterhellberg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@peterhellberg
peterhellberg / gfx-color-emulation-gbc.go
Created Sep 13, 2019
LCD Color Emulation for Game Boy Color using gfx, based on https://byuu.net/video/color-emulation
View gfx-color-emulation-gbc.go
package main
import (
"bytes"
"image"
"image/color"
"github.com/peterhellberg/gfx"
)
@peterhellberg
peterhellberg / gfx-sudoku.go
Created Sep 13, 2019
Sudoku board drawn by gfx
View gfx-sudoku.go
package main
import (
"math/rand"
"github.com/peterhellberg/gfx"
)
func main() {
board := gfx.NewPaletted(9, 9, gfx.Palette15PDX)
View generate-screenshots.go
package main
import (
"encoding/json"
"os"
"strings"
"github.com/gocolly/colly"
)
@peterhellberg
peterhellberg / gui-d2.go
Created May 13, 2019
D2 menu using gui/gfx
View gui-d2.go
This file has been truncated, but you can view the full file.
package main
import (
"bytes"
"image"
"image/draw"
"github.com/peterhellberg/gfx"
"github.com/peterhellberg/gui"
@peterhellberg
peterhellberg / gui-experiment.go
Last active May 12, 2019
GUI experiment with two routines drawing parts of the window (foo draws the upper half, bar the bottom half)
View gui-experiment.go
package main
import (
"image"
"image/draw"
"github.com/peterhellberg/gfx"
"github.com/peterhellberg/gui"
)
@peterhellberg
peterhellberg / gui-xor.go
Last active May 12, 2019
XOR image drawn by gfx, and displayed using gui
View gui-xor.go
package main
import (
"image"
"image/draw"
"github.com/peterhellberg/gfx"
"github.com/peterhellberg/gui"
)
View gfx-ASCII-color-ramp.go
package main
import "github.com/peterhellberg/gfx"
const w, h = 16, 16
const ramp = " .:-=+*#%@"
func main() {
m := gfx.NewGray(gfx.IR(0, 0, w, h))
@peterhellberg
peterhellberg / cgo-balenaOS-rpi3.Dockerfile
Last active Mar 22, 2019
Dockerfile for CGO app under balenaOS on RPi3
View cgo-balenaOS-rpi3.Dockerfile
FROM balenalib/raspberrypi3-alpine-golang as builder
WORKDIR /go/src/rpi-server
COPY . ./
RUN apk add musl-dev linux-headers
RUN go install -a -tags netgo -ldflags '-extldflags "-static"'
FROM resin/scratch
COPY --from=builder /go/bin/rpi-server /rpi-server
COPY --from=builder /etc/ssl/certs/ /etc/ssl/certs
CMD ["/rpi-server"]
@peterhellberg
peterhellberg / gfx-lendo.go
Last active Mar 14, 2019
The Lendo L repeated with signed distance functions using gfx.
View gfx-lendo.go
package main
import "github.com/peterhellberg/gfx"
func main() {
dst := gfx.NewImage(2560, 1440, PaletteLendo.Color(0))
gfx.EachImageVec(dst, gfx.ZV, func(u gfx.Vec) {
sd := gfx.SignedDistance{gfx.IM.Moved(gfx.V(50, -10)).Project(u)}
View s3270.go
package s3270
import (
"fmt"
"log"
"os/exec"
"strings"
"time"
)
You can’t perform that action at this time.