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
This file has been truncated, but you can view the full file.
diff -ur result/add-on/src/include/add-on/add-on-workflow.rb result-bck/add-on/src/include/add-on/add-on-workflow.rb
--- result/add-on/src/include/add-on/add-on-workflow.rb 2013-06-28 13:55:14.924000000 +0200
+++ result-bck/add-on/src/include/add-on/add-on-workflow.rb 2013-06-28 12:36:25.828000000 +0200
@@ -948,8 +948,13 @@
PushButton(Id(:packager), _("Run &Software Manager..."))
)
),
- _("<p>All add-on products installed on your system are displayed.</p>") + _(
- "<p>Click <b>Add</b> to add a new add-on product, or <b>Delete</b> to remove an add-on which is in use.</p>"
--- /usr/lib/YaST2/servers_non_y2/ag_tty.orig 2013-07-02 12:06:35.250848656 +0200
+++ /usr/lib/YaST2/servers_non_y2/ag_tty 2013-07-02 12:07:19.303495394 +0200
@@ -145,7 +145,7 @@
{
if ($path eq ".")
{
- ReadString($term, $prompt);
+ ycp::Return ( [ "I am a byteblock" ], 0 );
}
elsif ($path eq ".nohistory")
@mvidner
mvidner / gist:6451197
Last active December 22, 2015 09:19
Ruby: .method vs ::constant
mvidner@mrakoplas:~$ irb
irb(main):001:0> require 'yast'
<internal:prelude>:18: warning: already initialized constant MUTEX_FOR_THREAD_EXCLUSIVE
=> true
irb(main):003:0> Yast.import "Label"
=> nil
irb(main):006:0> Yast::Label.AddButton
=> "&Add"
irb(main):007:0> Yast::Label::AddButton
TypeError: #<Yast::LabelClass:0x00000002742000 @my_textdomain="base"> is not a class/module
// https://github.com/libyui/libyui/issues/61
// g++ -std=c++11 $(pkg-config --cflags --libs libyui) -o a.out libyui-61-deletechildren.cc
#include "YUI.h"
#include "YWidgetFactory.h"
#include "YDialog.h"
#include "YLayoutBox.h"
#include "YSpacing.h"
#include "YLabel.h"
#include "YPushButton.h"
@mvidner
mvidner / diff-mst.rb
Created December 6, 2013 15:39
Assist in finding a minimal spanning tree of diffs among 4 files
#!/usr/bin/env ruby
filenames = ARGV
# hardcoded for 4 vertices
def all_pairs(v)
[
[v[0], v[1]],
[v[0], v[2]],
[v[0], v[3]],
@mvidner
mvidner / test-ui.rb
Created December 6, 2013 15:49
non interactive test that yast does not crash when we update some parts of libyui
module Yast
class TestUIClient < Client
def main
Yast.import "Wizard"
Wizard.CreateDialog
Wizard.CloseDialog
true
end
#!/usr/bin/env ruby
# Usage: rake -P | rake-prereqs-dot | dotty -
# Convert the output of `rake -P/--prereqs`
# ("Display the tasks and dependencies, then exit.")
# to a graphviz graph
# Sample input
# -8<-
@mvidner
mvidner / sendkeys
Last active August 2, 2023 21:47
Translate a string to "sendkey" commands for QEMU.
#!/usr/bin/env ruby
# Translate a string to "sendkey" commands for QEMU.
# Martin Vidner, MIT License
# https://en.wikibooks.org/wiki/QEMU/Monitor#sendkey_keys
# sendkey keys
#
# You can emulate keyboard events through sendkey command. The syntax is: sendkey keys. To get a list of keys, type sendkey [tab]. Examples:
#
# sendkey a
@mvidner
mvidner / anaselli-layout.ycp
Created February 26, 2014 09:42
replicate some C++ layout http://pastebin.com/7qJM2KN7 with YCP
// replicate some C++ layout http://pastebin.com/7qJM2KN7
// with YCP
{
UI::OpenDialog(
`VBox(
`HBox(
`HWeight(2,
`Frame(
"F1",
`HBox(
#!/usr/bin/env rspec
ENV["Y2DIR"] = File.expand_path("../../src", __FILE__)
require "yast"
require "pp"
def clone(auto_client)
Yast::WFM.CallFunction(auto_client, ['Read'])
Yast::WFM.CallFunction(auto_client, ['SetModified'])