Skip to content

Instantly share code, notes, and snippets.

View mvidner's full-sized avatar

Martin Vidner mvidner

  • SUSE
  • Prague, CZ, EU
View GitHub Profile
@mvidner
mvidner / signal-postmortem
Created April 14, 2023 09:58
signal-postmortem: a helper for YaST that is run when it is being killed by a signal
#!/bin/sh
exec >> /var/log/YaST2/signal 2>&1
# pstree -pluna; but let's use the long options for clarity
pstree --show-pids --long --uid-changes --numeric-sort --arguments
sleep 10

D-Bus Crash Course: Part 1

Goal for this part: learn enough to call a method.

How to read this:

☡ A Knuth-style Dangerous Bend sign ☡ precedes parts that should be skipped at first.

What is D-Bus?

#!/usr/bin/env ruby
# frozen_string_literal: true
require "dbus"
# Complex property
class Test < DBus::Object
dbus_interface "net.vidner.Scratch" do
dbus_attr_reader :progress, "(stttt)"
end
@mvidner
mvidner / control.xml
Last active September 27, 2021 01:35
<?xml version="1.0"?>
<productDefines xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns">
<!--
Work around for the text domain
textdomain="control"
-->
<textdomain>control</textdomain>
@mvidner
mvidner / ignition-password
Created June 9, 2021 07:44
Automate the Ignition password setting step from https://en.opensuse.org/Portal:MicroOS/Ignition
#!/bin/sh
# Automate the password setting step from
# https://en.opensuse.org/Portal:MicroOS/Ignition
#
# 1. Ask for a password interactively.
# 2. Make an ignition.iso for setting root's password to that.
# An existing ignition.iso will be overwritten.
#
# Required commands
# openssl

Massif Basics

Valgrind is an instrumentation framework that runs a program by simulating every instruction. It has several tools. Memcheck is the original one, used for detecting memory errors. Massif is a memory profiler.

(The output it produces, example: https://gist.github.com/mvidner/4e8ed01c7dabb648a50e0dd5f0fdcc62 )

The basic invocation of Massif is simple, valgrind --tool=massif my_program its_arguments, so for YaST

--------------------------------------------------------------------------------
Command: /usr/lib/YaST2/bin/y2start installation --arg initial qt
Massif arguments: --massif-out-file=/var/log/YaST2/massif-%p.out
ms_print arguments: massif-4596.out
--------------------------------------------------------------------------------
MB
373.0^ ###
| #
<span style="font-family:Wingdings">J</span>
@mvidner
mvidner / gist:eeb88c01a9a03f52974e009fa0ba4ce7
Created October 13, 2020 08:25
This is just blank vertical space
.
.
.
.
.
.
.
.
.
$ cd yast/yast-ycp-ui-bindings/examples/screenshots-tui
$ grep . *txt
Alignment1-1.txt: YaST2 - ./../../Alignment1.rb @ ohmu
Alignment1-1.txt: ┌─────────────────────────────────────────────────────────────────────┐
Alignment1-1.txt: │[This is a very long button - it reserves extra space for the label.]│
Alignment1-1.txt: │[ Stretchable button ]Label│
Alignment1-1.txt: └─────────────────────────────────────────────────────────────────────┘
AutoShortcut1-1.txt: YaST2 - ./../../AutoShortcut1.rb @ ohmu
AutoShortcut1-1.txt: ┌────────────────────────┐
AutoShortcut1-1.txt: │┌Software Selection────┐│