Skip to content

Instantly share code, notes, and snippets.

Martin Vidner mvidner

  • SUSE
  • Prague, CZ, EU
Block or report user

Report or block mvidner

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View lazy_enumerator.rb
#!/usr/bin/ruby
# https://bugzilla.suse.com/show_bug.cgi?id=1132650
# https://github.com/yast/yast-packager/pull/434
def file_properties(filename)
print "."
File.lstat(filename)
end
View emacs-regexp-escaping.md

Emacs has an ususual way of escaping special characters in regular expressions, which I keep forgetting, so here's a summary

Literal Special Emacs bare Emacs escaped
* \*
* 0 or more *
+ \+
+ 1 or more +
? \?
View bidi-problems.md

Problems with Bidirectional (BiDi) Text

If the whole paragraph contains only right-to-left text, it poses no problem. Problems are much likelier to occur if we mix the text directions.

Here I want to write down my knowledge so that the simple parts are easily accessible to beginners, and terms are defined for reference when sorting and solving bugs

TODO: show example fixes to the problems (and note that they may look wrong,

@mvidner
mvidner / 0-mistranslated-bidi-brackets.md
Last active Mar 19, 2019
Mistranslated BiDi Brackets
View 0-mistranslated-bidi-brackets.md

My team got a bug report (bsc#1127563) about misplaced brackets in Arabic translation:

comparison of Arabic and English screen contents

Looking at the first problematic line, "Total System Memory", notice that the Arabic translation has both square brackets in the right-hand version. Let's check the corresponding translations file.

screenshot of the PO file as displayed by GitHub

At the first sight we see a matching left+right bracket, but that is misleading, since they are not in the correct place. The GitHub rendering of that line is confused by the `m

View inst_kickoff.rb.diff
diff --git a/src/clients/inst_kickoff.rb b/src/clients/inst_kickoff.rb
index 581f3554..ba4a2ff4 100644
--- a/src/clients/inst_kickoff.rb
+++ b/src/clients/inst_kickoff.rb
@@ -78,11 +78,11 @@ module Yast
# make some directories
SCR.Execute(
path(".target.mkdir"),
- Ops.add(Installation.destdir, "/etc")
+ Installation.destdir + "/etc"
View ui_recorder.rb
# A crude YaST UI recoder and player
#
# Usage:
# Y2UI_RECORD=/tmp/y2host.yaml LANG=en_US.UTF-8 \
# ruby -r ./ui_recorder.rb /usr/lib/YaST2/bin/y2start host qt
# less /tmp/y2host.yaml
# Y2UI_PLAY=/tmp/y2host.yaml LANG=en_US.UTF-8 \
# ruby -r ./ui_recorder.rb /usr/lib/YaST2/bin/y2start host qt
require "set"
View find_minimal_failure
#!/usr/bin/ruby
CACHE = "find_minimal_failure.cache".freeze
def usage
puts <<TXT
Usage: find_minimal_failure COMMAND [OPTIONS --] ARGUMENTS...
Finds the minimal ordered subsequence of ARGUMENTS that still
makes the command fail.
This is useful in place of "rspec --bisect"
when your extension library crashes without producing an exception.
View autoyast_cdata_config_type.md

This is a clarifying update to the AutoYaST documentation, applicable to all versions.

Resources and Properties

A resource element either contains multiple and distinct property and resource elements, or multiple instances of the same resource element, or it is empty. The permissible content of a resource element is

View Gemfile.lock
GEM
remote: http://rubygems.org/
specs:
activemodel (4.2.10)
activesupport (= 4.2.10)
builder (~> 3.1)
activesupport (4.2.10)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
@mvidner
mvidner / cheetah-y2log.rb
Last active Nov 30, 2017
Cheetah using the YaST log
View cheetah-y2log.rb
#!/usr/bin/ruby
require "cheetah"
require "yast"
Cheetah.run("ls", "-la", "/var/lib/empty", logger: Yast::Y2Logger.instance)
# another way: "log" becomes a shortcut for Yast::Y2Logger.instance
include Yast::Logger
begin
You can’t perform that action at this time.