Skip to content

Instantly share code, notes, and snippets.

View schuster-rainer's full-sized avatar

Rainer Schuster schuster-rainer

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@schuster-rainer
schuster-rainer / sample.py
Created January 28, 2016 11:03
Execute PIPED command in behave acceptance test
from behave import *
from os.path import join
from subprocess import Popen
import os
@when(u'the requirements are generated for documentation')
def step_impl(context):
cmd = " ".join(["my_fictional_command",
"input1",
context.requirements_filename,
@schuster-rainer
schuster-rainer / sample.feature
Last active January 28, 2016 10:57
Execute command from behave acceptance test
Feature: Tracing
Scenario Outline: Generating a two column CSV
When I execute: my_fictional_command input1.xml input2.xml --header=COL1;COL2
Then the generated csv with <COL1> should map to <COL2>
Examples: COL1 maps to COL2
| REQ_ID| RELATED_ID |
| COL1| COL2 |
| A | 1 |
@schuster-rainer
schuster-rainer / jinja_magic.py
Created November 13, 2015 13:53
IPython jinja cell magic
from IPython import display
from IPython.core.magic import register_cell_magic, Magics, magics_class, cell_magic
import jinja2
@magics_class
class JinjaMagics(Magics):
'''Magics class containing the jinja2 magic and state'''
def __init__(self, shell):
@schuster-rainer
schuster-rainer / hello_debug_ipdb.clj
Created October 30, 2012 22:08
debuggin with ipdb in clojure-py
(ns hello-debug)
(require '[ipdb :as pdb])
(pdb/set_trace)
(def greet "hello world!")
(println greet)
@schuster-rainer
schuster-rainer / wpf_load_xaml.clj
Created July 10, 2012 14:36
Run a WPF Window loaded from a xaml file in ClojureCLR and modify it at the REPL
;reference wpf assemblys
(import '(System.Reflection Assembly))
(Assembly/LoadWithPartialName "PresentationFramework")
(Assembly/LoadWithPartialName "PresentationCore")
(Assembly/LoadWithPartialName "WindowsBase")
(Assembly/LoadWithPartialName "System.Xml")
(ns wpf
(:import (System.Windows Application Window))
(:import (System.Windows.Threading Dispatcher DispatcherPriority))
@schuster-rainer
schuster-rainer / readme
Created June 7, 2012 20:46
python test discovery from commandline and visual studio 2010
# Projekt Structure
- project_root
|
+ doc/
+ src/
+ tests/
+ run_tests.bat
@schuster-rainer
schuster-rainer / create_public_method_proxy.py
Created March 30, 2012 14:58
create a proxy class from the baseclass with methods publish by the method projector
import inspect
import logging
def interrogate(item):
"""Print useful information about item."""
if hasattr(item, '__name__'):
logging.debug( "NAME: " + item.__name__)
if hasattr(item, '__class__'):
logging.debug("CLASS: " + item.__class__.__name__)
logging.debug("ID: {0}".format(id(item)))
@schuster-rainer
schuster-rainer / copy_files_newer_than.sh
Created March 26, 2012 10:42
Copy files that are newer than "date" from "source" to "target"
# $0 = date of format 201203220650
# $1 = source
# $2 = target
touch -t $0 .probe
find $1 -type f -newer .probe -exec cp {} $2 \;
@schuster-rainer
schuster-rainer / load-gtk.fsx
Created February 24, 2012 10:27
Script to reference GTK# assemblies and create an fsi event loop for dispatching the commands
// Script from Tomas Petricek
// http://stackoverflow.com/questions/4174852/how-to-force-f-interactive-to-reference-gtk-by-default
[<AutoOpen>]
module GtkSharp
// Load some common Gtk# assemblies (from /usr/lib/mono/2.0/../gtk-sharp-2.0)
#r "../gtk-sharp-2.0/gtk-sharp.dll"
#r "../gtk-sharp-2.0/gdk-sharp.dll"
#r "../gtk-sharp-2.0/glib-sharp.dll"