Skip to content

Instantly share code, notes, and snippets.

View bluca's full-sized avatar

Luca Boccassi bluca

View GitHub Profile
@bluca
bluca / userctl
Last active August 30, 2023 11:06
bash completion for systemctl --user alias, save as '~/.local/share/bash-completion/completions/userctl'
# user(1) completion -*- shell-script -*-
# SPDX-License-Identifier: LGPL-2.1-or-later
__systemctl() {
local mode=$1; shift 1
systemctl $mode --full --legend=no --no-pager --plain "$@" 2>/dev/null
}
__systemd_properties() {
/usr/lib/systemd/systemd --dump-bus-properties
@bluca
bluca / libone.pc
Created October 28, 2021 20:28
circular pkgconfig deps
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib/x86_64-linux-gnu
includedir=${prefix}/include
Name: libone
Version: 1.0
Description: foo
Libs: -L${libdir} -lone
Cflags: -Done

Keybase proof

I hereby claim:

  • I am bluca on github.
  • I am bluca (https://keybase.io/bluca) on keybase.
  • I have a public key whose fingerprint is A9EA 9081 724F FAE0 484C 35A1 A81C EA22 BC8C 7E2E

To claim this, I am signing this object:

@bluca
bluca / gist:0158ec50638637749641c269439ee621
Created March 26, 2021 17:00
fast src:linux deb package amd64 build
diff --git a/debian/config/amd64/defines b/debian/config/amd64/defines
index b278f36223c7..d599f68dfe6a 100644
--- a/debian/config/amd64/defines
+++ b/debian/config/amd64/defines
@@ -1,12 +1,13 @@
[base]
featuresets:
none
- rt
+# rt
@bluca
bluca / gist:1fa56692456a022d411303a33267421d
Created March 26, 2021 16:18
linker script to add custom note to elf - LDFLAGS="-Wl,-T,$PWD/script"
SECTIONS
{
.note.package : ALIGN(4) {
BYTE(0x04) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of Owner including NUL */
BYTE(0x4a) BYTE(0x00) BYTE(0x00) BYTE(0x00) /* Length of Value including NUL */
BYTE(0x00) BYTE(0x33) BYTE(0xdd) BYTE(0x7a) /* Note ID */
BYTE(0x54) BYTE(0x42) BYTE(0x44) BYTE(0x00) /* Owner: 'TBD\x00' */
BYTE(0x7b) BYTE(0x22) BYTE(0x70) BYTE(0x61) /* Value: '{"packageType":"deb","package":"fsverity-utils","packageVersion":"1.3-1"}\x00\x00\x00' */
BYTE(0x63) BYTE(0x6b) BYTE(0x61) BYTE(0x67)
BYTE(0x65) BYTE(0x54) BYTE(0x79) BYTE(0x70)
@bluca
bluca / note.c
Created March 26, 2021 16:08
Get custom note out of core file
#include <dwarf.h>
#include <elfutils/libdwelf.h>
#include <elfutils/libdwfl.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
@bluca
bluca / repro.c
Created March 26, 2021 15:46
dwfl crash
#include <dwarf.h>
#include <elfutils/libdwelf.h>
#include <elfutils/libdwfl.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#include <errno.h>
@bluca
bluca / compat_report.xml
Created April 12, 2019 15:59
libbpf 4.19.x to 5.1.x ABI compat report
<?xml version="1.0" encoding="utf-8"?>
<reports>
<report kind="binary" version="1.2">
<test_info>
<library>bpf</library>
<version1>
<number>1</number>
<arch>x86_64</arch>
<gcc>8.3.0</gcc>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <zmq.h>
void freen(void *data, void *hint){
free(data);
}
diff --git a/app/Makefile b/app/Makefile
index f7f5e2f..f837f43 100644
--- a/app/Makefile
+++ b/app/Makefile
@@ -62,15 +62,15 @@ BUILD_TYPE := v17
endif
ifeq ($(BUILD_TYPE),v17)
-COMMON_PRE := $(RTE_SRCDIR)/../lib/common
-LUA_PRE := $(RTE_SRCDIR)/../lib/lua/src