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
#! /usr/bin/rspec
require_relative '../src/modules/IscsiLioData'
describe Yast::IscsiLioDataClass do
before :each do
@iscsilib = Yast::IscsiLioDataClass.new
@iscsilib.main()
@test_class = @iscsilib
#!/usr/bin/env ruby
BINDINGS_DIR = "../ruby-bindings"
rubylib = "#{BINDINGS_DIR}/src/ruby"
BASE_DIR = "../yast2"
BASE_LIBS = ["runlevel", "systemd", "network"]
y2dir = BASE_LIBS.map {|d| "#{BASE_DIR}/library/#{d}/src"}.join ":"
exec "Y2DIR=#{y2dir} RUBYLIB=#{rubylib} #{ARGV.join ' '}"
#! /usr/bin/perl
# http://en.opensuse.org/User:Mvidner
=head1 NAME
y2logpids - grep a YaST log file for process id changes and measure the time differences
=head1 SYNOPSIS
y2logpids -h|--help
#! /usr/bin/env ruby
require "yast"
include Yast
include Yast::UIShortcuts
if Yast.ui_component == ""
Yast.ui_component = ARGV[0] || "ncurses"
end
Builtins.y2milestone("UI component: %1", Yast.ui_component)
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR SuSE Linux Products GmbH, Nuernberg
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2015-06-02 14:53+0200\n"
"PO-Revision-Date: 2015-06-02 14:53+0200\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
@mvidner
mvidner / call_whitespace.rb
Created June 9, 2015 09:39
ruby whitespace is significant
def upcase_all(strings)
strings.map(&:upcase)
end
puts upcase_all (["You", "can", "use", "YOU"]).uniq
puts upcase_all(["You", "can", "use", "YOU"]).uniq
/* scroll down to see an explanation in insane-tty.md */
/* gcc -Wall -o insane-tty insane-tty.c */
#include <stdlib.h>
#include <sys/ioctl.h>
#include <termios.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#!/usr/bin/ruby
# https://lists.luon.net/pipermail/ruby-dbus-devel/2015-November/000500.html
require 'dbus'
def dbus_get_service_prefix path
bus = DBus::SystemBus.instance
service = bus.service path.join('.')
service.introspect # othewise cannot walk dbus namespace
root = service.root
prefix = root
From 1cb40243b120b86057688d64d88a23384d234a91 Mon Sep 17 00:00:00 2001
From: Martin Vidner <mvidner@suse.cz>
Date: Thu, 17 Dec 2015 14:20:27 +0100
Subject: [PATCH] Factored out pipe juggling more readably.
---
lib/cheetah.rb | 45 ++++++++++++++++++++++++++-------------------
1 file changed, 26 insertions(+), 19 deletions(-)
diff --git a/lib/cheetah.rb b/lib/cheetah.rb