Skip to content

Instantly share code, notes, and snippets.

Avatar

Olivier Wulveryck owulveryck

View GitHub Profile
@owulveryck
owulveryck / main.go
Last active Jul 2, 2021
Simple script to turn a webpage into an epub
View main.go
package main
import (
"log"
"net/http"
"net/url"
"os"
"path/filepath"
"strings"
@owulveryck
owulveryck / AAA sample.md
Last active Jun 15, 2021
Trivial server that validates data and send it to kafka
View AAA sample.md

Running the sample:

go run . definition.cue

Getting the OpenAPI

❯ curl http://localhost:8181/openapi returns:

{
@owulveryck
owulveryck / sample_test.go
Created Jun 15, 2021
CUE -> OpenAPI generation
View sample_test.go
package main
import (
"bytes"
"encoding/json"
"fmt"
"log"
"cuelang.org/go/cue"
"cuelang.org/go/cue/load"
@owulveryck
owulveryck / sample_test.go
Created Jun 14, 2021
Simple cloudevents creation from a cue value
View sample_test.go
package main
import (
"encoding/json"
"log"
"reflect"
"testing"
"time"
"cuelang.org/go/cue"
@owulveryck
owulveryck / sample.go
Last active Jun 14, 2021
Simple webservice to validate data with CUE
View sample.go
package sample
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"testing"
@owulveryck
owulveryck / Makefile
Last active May 26, 2021
convert all pictures from the jpg directory into webp
View Makefile
SOURCE_DIR := jpg
OUTPUT_DIR := webp
jpg_srcs := $(shell find $(SOURCE_DIR) -type f -name '*.jpg')
webp := $(patsubst $(SOURCE_DIR)/%.jpg, $(OUTPUT_DIR)/%.webp, $(jpg_srcs))
toWebo: $(webp)
$(OUTPUT_DIR)/%.webp : $(SOURCE_DIR)/%.jpg
magick $< -quality 50 -define webp:lossless=true $@
@owulveryck
owulveryck / dev.sh
Created May 17, 2021
shell wrapper to trigger my dev tools
View dev.sh
#!/bin/zsh
if [ ! "$TMUX" ]; then
tmux new-session $0 $@
exit
fi
tmux new-window -n "vim $@"
LASTWINDOW=$(tmux list-windows | sort -k 8 | tail -1 | sed 's/\([0-9]*\):.*/\1/')
@owulveryck
owulveryck / main.go
Created Apr 22, 2021
Reading the .line format from the reMarkable
View main.go
package main
import (
"encoding/binary"
"errors"
"fmt"
"image"
"io"
"log"
"os"
@owulveryck
owulveryck / script.sh
Created Apr 6, 2021
screenshot on remarkable
View script.sh
#!/bin/sh
(
cat << \EOF
dd if=/proc/$(pidof xochitl)/mem count=2628288 bs=1 skip=$((16#$(grep '/dev/fb0' /proc/$(pidof xochitl)/maps | sed 's/.*\-\([0-9a-f]*\) .*/\1/')))
EOF
) | ssh root@IP_OF_REMARKABLE | convert -depth 8 -size 1872x1404+0 gray:- shot.png
@owulveryck
owulveryck / plantuml.yml
Created Mar 30, 2021
GitHub action to generate plantuml files
View plantuml.yml
name: Generate PlantUML Diagrams
on:
push:
branches:
- main
jobs:
plantuml:
runs-on: ubuntu-latest
env:
UML_FILES: ".puml"