Skip to content

Instantly share code, notes, and snippets.

View vojtechtrefny's full-sized avatar

Vojtech Trefny vojtechtrefny

  • Red Hat
  • Brno, Czech Republic
View GitHub Profile
#include <blockdev/blockdev.h>
#include <blockdev/lvm.h>
#include <glib.h>
#include <stdio.h>
#include <unistd.h>
#define VGNAME "mergetest"
#define SNAPNAME "lvol0_snap"
void _log (gint level, const gchar *msg) {
# "Guess the Number" game from https://wiki.python.org/moin/SimplePrograms
# with some extra PEP 8 violations
import random
guesses_made = 0
name = input('Hello! What is your name?\n')
number = random.randint(1, 20)
@vojtechtrefny
vojtechtrefny / cockpit-tests.txt
Last active April 3, 2017 06:33
Running Cockpit tests with custom version of Udisks
# clone the cockpit repo
git clone https://github.com/cockpit-project/cockpit
# install requirements
sudo dnf install nodejs npm
sudo dnf install curl expect \
libvirt libvirt-client libvirt-daemon libvirt-python \
python python-libguestfs python-lxml qemu qemu-kvm \
rpm-build rsync xz
npm install sizzle phantomjs-prebuilt
using Gtk;
using Gdk;
public class MyButton : Gtk.RadioButton {
static construct {
set_css_name ("mybutton");
}
}
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk, Gdk
class MyButton(Gtk.RadioButton):
def __init__(self, *args):
self.set_css_name("mybutton")
Gtk.RadioButton.__init__(self, *args)
from gi.repository import Gtk, Gdk
class ExampleWindow(Gtk.Window):
def __init__(self):
Gtk.Window.__init__(self, title="Example")
self.set_default_size(150, 100)
self.set_border_width(6)
from gi.repository import Gtk, Gdk
class DialogExample(Gtk.Dialog):
def __init__(self, parent):
Gtk.Dialog.__init__(self, "My Dialog", parent, 0,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK))
self.set_default_size(150, 100)
import blivet
import pydot
b = blivet.Blivet()
b.reset()
graph = pydot.Dot(graph_type='graph')
for device in b.devices:
for parent in device.parents: