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
def file_properties(filename)
print "."

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 +
? \?

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 /
Last active Mar 19, 2019
Mistranslated BiDi Brackets

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
- 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
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.

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
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 / cheetah-y2log.rb
Last active Nov 30, 2017
Cheetah using the YaST log
View cheetah-y2log.rb
require "cheetah"
require "yast""ls", "-la", "/var/lib/empty", logger: Yast::Y2Logger.instance)
# another way: "log" becomes a shortcut for Yast::Y2Logger.instance
include Yast::Logger
You can’t perform that action at this time.