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 / artifact.go
Created June 20, 2024 16:30
Memory-mapped artifact upload into Pulp in Go and oapi-gen Go HTTP client
import (
"bytes"
"context"
"crypto/sha256"
"encoding/hex"
"fmt"
"io"
"mime/multipart"
"os"
"path/filepath"
@lzap
lzap / Containerfile-fedora-aa64
Last active June 12, 2024 14:36
Fedora netbootc files POC
FROM quay.io/fedora/fedora-minimal:40 as builder
ARG name=Fedora
ARG version=40
ARG arch=aa64
RUN mkdir /b
WORKDIR /b
# Artifacts from kickstart repository.
RUN curl -RLO https://dl.fedoraproject.org/pub/fedora/linux/releases/${version}/Everything/$(uname -m)/os/.treeinfo
RUN curl -RLO https://dl.fedoraproject.org/pub/fedora/linux/releases/${version}/Everything/$(uname -m)/os/images/pxeboot/vmlinuz
@lzap
lzap / pulp-openapi.json
Created May 28, 2024 07:35
Pulp OpenAPI June 2024
This file has been truncated, but you can view the full file.
{
"openapi": "3.0.3",
"info": {
"title": "Pulp 3 API",
"version": "v3",
"description": "Fetch, Upload, Organize, and Distribute Software Packages",
"contact": {
"name": "Pulp Team",
"email": "pulp-list@redhat.com",
"url": "https://pulpproject.org"
@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
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 / 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)
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 / 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": [
@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 / 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]
}