Skip to content

Instantly share code, notes, and snippets.

View teg's full-sized avatar

Tom Gundersen teg

  • Red Hat
  • London, UK
View GitHub Profile
@teg
teg / qcow2-aarch64-image-info.json
Created December 12, 2019 20:24
image-info for qcow2 aarch64 fedora-30
{
"boot-environment": {
"GRUB2_BOOT_FS_UUID": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"GRUB2_ROOT_FS_UUID": "76a22bf4-f153-4541-b6c7-0332c0dfaeac",
"kernelopts": "root=UUID=76a22bf4-f153-4541-b6c7-0332c0dfaeac ro biosdevname=0 net.ifnames=0"
},
"bootloader": "unknown",
"bootmenu": [
{
"grub_arg": "--unrestricted",
@teg
teg / qcow2-aarch64.json
Created December 12, 2019 20:18
go run ./cmd/osbuild-^Cpeline/ -distro fedora-30 -output-format qcow2 -arch aarch64
{
"build": {
"pipeline": {
"stages": [
{
"name": "org.osbuild.dnf",
"options": {
"repos": [
{
"metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-30&arch=aarch64",
@teg
teg / aarch64.json
Created December 11, 2019 22:55
$ go run ./cmd/osbuild-pipeline -output-format qcow2 -arch aarch64 -distro fedora-30 | jq .
{
"build": {
"pipeline": {
"stages": [
{
"name": "org.osbuild.dnf",
"options": {
"repos": [
{
"metalink": "https://mirrors.fedoraproject.org/metalink?repo=fedora-30&arch=aarch64",
@teg
teg / aws-ec2.go
Created October 10, 2019 22:37
Amazon EC2 image uploader
package main
import (
"flag"
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
@teg
teg / aws.go
Created October 10, 2019 16:15
command line client for starting aws instances
package main
import (
"flag"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
)
[teg@teg-x270 fake-lvm]$ truncate image.raw --size 10M
[teg@teg-x270 fake-lvm]$ sudo losetup -f image.raw
[sudo] password for teg:
[teg@teg-x270 fake-lvm]$ sudo vgcreate VG0 /dev/loop0
Physical volume "/dev/loop0" successfully created.
Volume group "VG0" successfully created
[teg@teg-x270 fake-lvm]$ sudo lvcreate --size 4M VG0
Logical volume "lvol0" created.
[teg@teg-x270 fake-lvm]$ sudo ./fake-lvm.py /dev/loop0 VG0 lvol0
{
@teg
teg / policy-type.patch
Created April 10, 2019 10:18
Provide the policy type statically
diff --git a/src/bus/policy.c b/src/bus/policy.c
index 91bea60..3286d07 100644
--- a/src/bus/policy.c
+++ b/src/bus/policy.c
@@ -538,8 +538,7 @@ int policy_registry_import(PolicyRegistry *registry, CDVar *v) {
bool apparmor;
int r;
- /* XXX: provide the type */
- c_dvar_read(v, "<(", NULL);
@teg
teg / no-console-user.patch
Created April 9, 2019 14:22
Avoid resolving console users, if possible
commit 5866527f2df681baf82f74a60b961f26a32c38ed
Author: Tom Gundersen <teg@jklm.no>
Date: Tue Apr 9 15:47:09 2019 +0200
launch/policy/at_console: only resolve the console users when necessary
If at all possible we want to skip our at_console compatibility logic.
The at_console users may not exist on the machine, making resolution
unneccesarily slow. In practice this logic is no longer used on
up-to-date machines, so let's not pay the price in the common case.
@teg
teg / gist:3801d32133746aa101696f5dd032e4ac
Created January 27, 2019 19:08
n-dhcp4/client: event node cleanup
commit f5d5aa0f652439d8136af9c030e3b059895e298e (HEAD -> master)
Author: Tom Gundersen <teg@jklm.no>
Date: Sun Jan 27 20:04:55 2019 +0100
client/event/node: unref lease objects on free
So far we did not look at the payload of the event node...
Signed-off-by: Tom Gundersen <teg@jklm.no>
@teg
teg / nice.patch
Created November 23, 2018 16:24
Run dbus-broker with higher priority
From 05a855de46fb5603c889cab338e0d3e5ba0c3fae Mon Sep 17 00:00:00 2001
From: Tom Gundersen <teg@jklm.no>
Date: Fri, 23 Nov 2018 17:15:36 +0100
Subject: [PATCH] units/system: run with higher scheduling priority
A busy bus would potentially be a bottleneck on a busy system, and
in particular one may suffer the problem of priority inversion. This
in no way solves the fundamental problem, but it may mitigate the
most obvious case of two high-priority processes communicating over
the bus, which in turn becomes a bottle-neck because it is scheduled