Skip to content

Instantly share code, notes, and snippets.

View stokito's full-sized avatar
Self-hosting become easier 🤗

Sergey Ponomarev stokito

Self-hosting become easier 🤗
View GitHub Profile
Multicast DNS Daemon
umdns

//This is early stage documentation, but at least attempts to cover some basic usage, and bring umdns usage out of the dark.//

mDNS, also known as Bonjour or zero-configuration networking (ZeroConf) or DNS Service Discovery (DNS-SD), enables automatic discovery of computers, devices, and services on IP networks. It is an internet standard documented in RFC6762.

The packages:pkgdata:umdns package provides a compact implementation of this standard, well integrated with the OpenWrt system environment. In particular, almost all interaction with the daemon is via docs:guide-developer:ubus.

@stokito
stokito / deterministic-archives.md
Last active January 29, 2025 23:12
Deterministic reproducible zip and tar.gz archives

This is very important for reproducible builds that is a basics for secure delivery.

And archive preserves a user and group (usually only their ids uid/gid) and time of last modification mtime. The time is almost always not important so you can set standard static reproducible date 1 Feb 1080.

@stokito
stokito / reamde.md
Last active January 16, 2025 11:11
golang json invalid character 'Â'

Разбор json в Го выдал ошибку invalid character 'Â' поскольку был NBSP пробел который появился при копировании из доков. Найдите его тут:

{
   "user": {
  }
}
@stokito
stokito / README.md
Created December 7, 2024 22:04
Golang смотреть ассемблер в Go

The go build -gcflags -S internal/utils/str.go 2> test.s worked i.e. the stdout was empty and the stderr needs to be redirected 2> test.s. Use the mcedit test.s to see asm.

I'll try the https://github.com/loov/lensm

go install --tags nox11 loov.dev/lensm@main
sudo apt install libwayland-dev libvulkan-dev libegl-dev libxkbcommon-dev libxfixes-dev
go install --tags nox11 loov.dev/lensm@main
lensm -watch -filter Fibonacci lensm
```
@stokito
stokito / copy.go
Created December 6, 2024 13:02
Golang скопировать папку в Go
func CopyDir(srcDir string, dstDir string) error {
err := os.CopyFS(dstDir, os.DirFS(srcDir))
return err
}
@stokito
stokito / gist:5b30d1fb8641bdeefa93f6ec613fa72b
Last active September 18, 2024 04:54
debian lintian problems fixes:
**maintainer-script-needs-depends-on-adduser**
You postinst script creates a user by using the adduser command that technically may not be installed yet in the system
**Fix:**
Add to the `debian/control`:
Pre-Depends: adduser
@stokito
stokito / deb-init.sh
Last active September 15, 2024 20:14
Initialize debian folder for deb package
debmake -u 1.0.0 -n
# remove useless files
rm -fr ./debian/tests/ ./debian/upstream/ ./debian/README.Debian ./debian/watch
# now edit all the files inside of the debian folder
# from the debian/control in the Build-Depends remove the gcj
debuild # build a package
@stokito
stokito / sign.sh
Created June 8, 2024 22:18
GnuTLS sign and verification
certtool --generate-privkey --key-type=ed25519 --outfile privkey.pem
certtool --generate-self-signed --load-privkey privkey.pem --outfile cert.pem
certtool --p7-detached-sign --load-certificate cert.pem --load-privkey privkey.pem --infile msg.txt --outfile msg.txt.p7s
certtool --p7-info --infile msg.txt.p7s
certtool --p7-verify --load-certificate cert.pem --infile msg.txt.p7s --load-data msg.txt
@stokito
stokito / go_cond_example.go
Created May 31, 2024 14:40
Golang sync.Cond example
package main
import (
"context"
"sync"
"time"
)
func main() {
serverReadyCond := sync.NewCond(&sync.Mutex{})
@stokito
stokito / sqs.http
Created April 4, 2024 10:57
localstack awslocal send sqs message with POST
### SQS send
POST http://sqs.us-east-1.localhost.localstack.cloud:4566/000000000000/example-topic?Action=SendMessage
Content-Type: multipart/form-data; boundary=WebAppBoundary
Accept: application/json
--WebAppBoundary
Content-Disposition: form-data; name="MessageBody"
Content-Type: application/json
{