Skip to content

Instantly share code, notes, and snippets.

View lzap's full-sized avatar
🇪🇺
I break software for living.

Lukáš Zapletal lzap

🇪🇺
I break software for living.
View GitHub Profile
@lzap
lzap / hwaddr.go
Created July 26, 2023 14:56
Sortable HardwareAddr Golang
type HwAddrSlice []net.HardwareAddr
func (s HwAddrSlice) Len() int {
return len(s)
}
func (s HwAddrSlice) Swap(i, j int) {
s[i], s[j] = s[j], s[i]
}
@lzap
lzap / bench.diff
Created April 27, 2023 17:10
Updated benchmark results for sqlite3 for article https://blog.jetbrains.com/go/2023/04/27/comparing-db-packages/
diff --git a/go-db-comparison/benchmarks/benchmark.go b/go-db-comparison/benchmarks/benchmark.go
index b6dc9f9..17e4955 100644
--- a/go-db-comparison/benchmarks/benchmark.go
+++ b/go-db-comparison/benchmarks/benchmark.go
@@ -6,30 +6,34 @@ import (
"log"
"time"
- "gorm.io/driver/mysql"
"gorm.io/gorm"
@lzap
lzap / foreman.ks
Created January 22, 2024 09:56
Foreman bootable container test
%pre
skopeo login foreman-nuc2.example.com -u lzap -p changeme --tls-verify=false
skopeo copy docker://foreman-nuc2.example.com/demo-lzap-fedora-bootc:eln oci:/var/tmp/container --tls-verify=false
%end
text
ostreecontainer --url=/var/tmp/container --transport=oci --no-signature-verification
user --name lzap --password $6$ptTfOsCpq5XA2qs6$FXMtwoMCQ4EJ698PXqJHuu/LS34WsomG2v1Cy5SzDtges40IaL4N.K2/7We6ertVDlA5tYhYofhNLAbfArGdH1 --iscrypted --groups wheel
sshkey --username lzap "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEhnn80ZywmjeBFFOGm+cm+5HUwm62qTVnjKlOdYFLHN lzap+ssh_redhat.com"
@lzap
lzap / benchmark.go
Created April 29, 2023 11:18
Fixed benchmark and results from the https://blog.jetbrains.com/go/2023/04/27/comparing-db-packages/ blog post
package main
import (
"context"
"database/sql"
"fmt"
"log"
"time"
"gorm.io/gorm"
@lzap
lzap / example.json
Created February 28, 2024 15:32
Netboot OCI example
{
"schemaVersion": 2,
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"artifactType": "application/vnd.unknown.artifact.v1",
"config": {
"mediaType": "application/vnd.oci.empty.v1+json",
"digest": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"size": 0
},
"layers": [
Starting: /home/lzap/go/bin/dlv dap --listen=127.0.0.1:39597 --log-dest=3 from /home/lzap/work/edge-api/cmd/migrate
DAP server listening at: 127.0.0.1:39597
Configuration Values:
Migration started ...
Opening database host=localhost user=postgres dbname=edge port=5432
SELECT version()
Postgres information: 'PostgreSQL 15.6 on x86_64-redhat-linux-gnu, compiled by gcc (GCC) 13.2.1 20231205 (Red Hat 13.2.1-6), 64-bit'
SELECT count(*) FROM pg_indexes WHERE tablename = 'third_party_repos' AND indexname = 'idx_third_party_repos_name' AND schemaname = CURRENT_SCHEMA()
Model index ThirdPartyRepo "idx_third_party_repos_name" exists deleting ...
DROP INDEX "idx_third_party_repos_name"
@lzap
lzap / composer-stats.py
Created April 22, 2024 08:48
Calculate image builder composer job duration
#!/usr/bin/python
import os
import json
import datetime
import statistics
results = []
dir = "/var/lib/osbuild-composer/jobs/"
for fn in os.listdir(dir):
f = os.path.join(dir, fn)
SELinux is preventing daemon-init from execute access on the file /usr/bin/udevadm.
SELinux is preventing daemon-init from execute access on the file /usr/sbin/lvm.
SELinux is preventing daemon-init from execute_no_trans access on the file /usr/bin/udevadm.
SELinux is preventing daemon-init from execute_no_trans access on the file /usr/sbin/lvm.
SELinux is preventing daemon-init from using the execmem access on a process.
SELinux is preventing lvchange from getattr access on the chr_file /dev/input/mice.
SELinux is preventing lvchange from using the sys_admin capability.
SELinux is preventing lvchange from write access on the directory lvm.
SELinux is preventing lvcreate from add_name access on the directory .lvm_virt.home.lan_13466_252087827.
SELinux is preventing lvcreate from add_name access on the directory .lvm_virt.home.lan_13916_735239927.
@lzap
lzap / mkksiso.ks
Created April 30, 2024 13:55
Satellite and mkksiso
%pre
cat /sys/class/net/*/address | grep -v 00:00:00:00:00:00 | awk '{print "X-RHN-Provisioning-MAC-" NR ": "unused $0}' > /tmp/pre_headers
curl -H @/tmp/pre_headers -k https://satellite/unattended/provision > /tmp/pre_kickstart
%end
%include /tmp_prekickstart