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
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
mvidner / gist:e37e4ce292b50b4e533a414ba315a778
Created Oct 26, 2017
How to make a CustomWidget disappear but not destroying it?
View gist:e37e4ce292b50b4e533a414ba315a778
#We have such a Tab, wich has a TargetsTableWidget(A customWidget has a table and buttons),
#TargetsTableWidget would be listed after class TargetsTab
class TargetsTab < ::CWM::Tab
def initialize
@target_table_widget =
self.initial = false
def contents
View multipribeh.rb
# coding: utf-8
def vyber(* možnosti)
hrdina = vyber("hobit", "trpaslík", "skřet", "člověk", "elf",
"zlobr", "dobr", "půlčík", "čtvrtčík")
čaroděj = vyber("čaroděj", "létající delfín", "druid", "guru")
mvidner /
Created Mar 24, 2017
A USB controlled fly
(sleep 5; echo 1700; sleep 2; echo 1500; sleep 1.1; echo 0) | socat - /dev/ttyUSB0,b115200,rawer
View ReplacePointWithStringId.rb
# encoding: utf-8
module Yast
class ReplacePoint1Client < Client
def main
Yast.import "UI"
ReplacePoint(Id("rp"), Label("This is a label with a string Id")),
PushButton(Id(:change), "Change")
#!/usr/bin/env python2
# Send a BEEP command via USB to a Lego Mindstorms EV3 brick
import sys
import usb.core #
def ev3_write(command):
# To send commands, we need an Endpoint.
View Test-YTree-selection.cpp
* Copyright (c) 2014 Angelo Naselli <>
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:

Vega is the second brightest star in the northern celestial hemisphere. Its name comes from the Arabic name "wāqi‘" (an-nasr al-wāqi‘), meaning "falling" (falling eagle). In the Arabic script, it is واقع (النسر الواقع).

Note how the parenthesized phrase ends up in the middle of the sentence, even though it should go at the end like this:

In the Arabic script, it is WAQE (ALNASR ALWAQE).

(Must include screenshots, because all renderers have their own incompatible sets of bugs)

View chardump.rb
# coding: utf-8
def char_as_4hex(c)
format("%04x", c.ord)
REPLACEMENT = "\ufffd" # �
FSI = "\u2068" # First Strong Isolate
PDI = "\u2069" # Pop Directional Isolate
View update-yast-pot.rb
require "fileutils"
require "pathname"
include FileUtils
"warning: PO file header fuzzy",
"warning: older versions of msgfmt will give an error on this",
You can’t perform that action at this time.