Skip to content

Instantly share code, notes, and snippets.

View wader's full-sized avatar
🦫

Mattias Wadman wader

🦫
View GitHub Profile
@wader
wader / main.go
Created October 6, 2024 08:54
caddy main
package main
import (
caddycmd "github.com/caddyserver/caddy/v2/cmd"
// plug in Caddy modules here
_ "github.com/caddyserver/caddy/v2/modules/standard"
)
func main() {
FROM ubuntu:noble
RUN apt-get update
RUN apt install -y build-essential \
pkg-config \
autoconf \
libtool \
wget \
sqlite3 libsqlite3-dev \
git
RUN wget "https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-1.7.1.tar.gz" &&\
FROM ubuntu:noble
RUN apt-get update
RUN apt-get install -y build-essential pkg-config sqlite3 libsqlite3-dev libjq-dev git
RUN git clone https://github.com/Florents-Tselai/liteJQ.git
RUN cd liteJQ && make && make test
package network
import (
"encoding/json"
"os"
"path/filepath"
"strconv"
"sync"
"time"
@wader
wader / player
Last active November 10, 2023 12:08
jupyter notebook bash kernel audio and video player helper script
#!/bin/sh
# Usage in cell to autoplay and loop:
# ffmpeg ... && ./player -al test.mp4
# -a for autoplay
# -l for loop
# -m for mute
# -w <width> for video player width
# -h <height> for video player height
TAGS="controls"
{
"descriptions": [
[
6,
"header",
"GIF89a"
],
[
2,
"width",
$ fq -o line_bytes=16 -o force=true -d mp4 dd format/mp4/testdata/emsg.mp4
│00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f│0123456789abcdef│.{}: format/mp4/testdata/emsg.mp4 (mp4)
│ │ │ boxes[0:1]:
│ │ │ [0]{}: box
0x000│00 00 01 a1 │.... │ size: 417
0x000│ 65 6d 73 67 │ emsg │ type: "emsg" (Event message)
0x000│ 00 │ . │ version: 0
0x000│ 00 00 00 │ ... │ flags: 0
0x000│ 68 74 74 70│ http│ scheme_id_uri: "http://youtube.com/streaming/metadata/segment/1..."
0x010│3a 2f 2f 79 6f 75 74 75 62 65 2e 63 6f 6d 2f 73│://youtube.com/s│
diff --color -r -u 83b858f83b658bd34eca5d8ad4d145f673ae7e5e.orig/src/network/dns_parse.c 83b858f83b658bd34eca5d8ad4d145f673ae7e5e/src/network/dns_parse.c
--- 83b858f83b658bd34eca5d8ad4d145f673ae7e5e.orig/src/network/dns_parse.c 2023-07-18 00:03:38
+++ 83b858f83b658bd34eca5d8ad4d145f673ae7e5e/src/network/dns_parse.c 2023-10-05 13:26:20
@@ -12,7 +12,6 @@
p = r+12;
qdcount = r[4]*256 + r[5];
ancount = r[6]*256 + r[7];
- if (qdcount+ancount > 64) return -1;
while (qdcount--) {
while (p-r < rlen && *p-1U < 127) p++;
// usage:
// cat BK7231T_TuyaConfig_obk8D7EC082.bin | go run tyuaconfig.go > out
package main
import (
"crypto/aes"
"crypto/cipher"
"io"
"log"
@wader
wader / diff.jq
Created August 29, 2023 14:06
json diff with jq
# Usage:
# jq -n -L . 'include "diff"; diff({hello:1}; {hello:2, world: 3})'
# {
# "hello": {
# "a": 1,
# "b": 2
# },
# "world": {
# "b": 3
# }