Skip to content

Instantly share code, notes, and snippets.

View pfichtner's full-sized avatar

Peter Fichtner pfichtner

View GitHub Profile
@pfichtner
pfichtner / Log2018-11-02-19-52-57-582.xml
Created December 2, 2018 10:20
Eclipse Fluorite log of our TDD demystified session resulting in https://github.com/hellman-and-hero/TDD-demystified
This file has been truncated, but you can view the full file.
<Events startTimestamp="1541184777582" logVersion="0.11.0.201505271204" osName="Linux" osVersion="4.15.0-38-generic" lineSeparator="\n" numMonitors="1" monitorBounds="[0, 0, 1920, 1080]">
<Command __id="0" _type="ShellBoundsCommand" bounds="[0, 0, 1926, 1060]" timestamp="17" />
<Command __id="1" _type="FileOpenCommand" docASTNodeCount="1" docActiveCodeLength="1744" docExpressionCount="0" docLength="1744" projectName="fizzbuzz" timestamp="103267">
<filePath><![CDATA[/home/nonroot/ase-workspace/fizzbuzz/pom.xml]]></filePath>
<snapshot><![CDATA[<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>fizzbuzz</groupId>
<artifactId>fizzbuzz</artifactId>
@pfichtner
pfichtner / watchdir_and_autocommit.sh
Last active December 2, 2018 10:29
Watch a directory, autocommit on change and run maven build in branch
#!/bin/sh
run_tests() {
DIRECTORY=$1
TAG=$2
BASE=`mktemp -d` && \
git clone $DIRECTORY $BASE && \
cd $BASE && \
git checkout -b $TAG $TAG && \
@pfichtner
pfichtner / Vagrantfile
Last active February 10, 2020 23:21
digital rebar using vagrant
$script = <<-SCRIPT
cat <<EOF | docker exec -i digitalrebar-provision drpcli subnets create -
{
"Name": "vboxnet0",
"Subnet": "192.168.178.0/24",
"ActiveStart": "192.168.178.100",
"ActiveEnd": "192.168.178.254",
"ActiveLeaseTime": 60,
"Enabled": true,
"ReservedLeaseTime": 7200,
@pfichtner
pfichtner / create-razor-microkernel.sh
Created April 25, 2018 18:06
create the razor microkernel using a docker container
git clone https://github.com/puppetlabs/razor-el-mk.git
docker run -i --privileged -e http_proxy=$http_proxy -e https_proxy=$https_proxy -v $PWD:/opt --rm centos /bin/sh <<EOF
cd /opt/razor-el-mk/
yum -y install git ruby livecd-tools
gem update --system && gem install rake bundler
setenforce 0
bundle install --path .bundle/gems/
bundle exec rake build
./build-livecd
./build-livecd-root
@pfichtner
pfichtner / Legacy.java
Last active February 16, 2018 19:34
Java 8: Tree Stream of parent tree nodes
package java8tree;
import java8tree.data.FooBar;
import java8tree.data.TreeNode;
public class Legacy {
public FooBar findFooBar(TreeNode selection) {
FooBar foobar = null;
if (istFooBar(selection.getParentPath())) {
@pfichtner
pfichtner / txp.sh
Last active June 24, 2017 13:36
Converting TXP to binary and vice versa using shell utilities only
#! /bin/sh
txpToBin() {
# filter "1 or 3 or ,"
# insert linebreak after every second ","
# remove comma
# append "3" if missing (this can only match the last line)
# translate 13->0 and 31->1
# join all lines to one string
echo $TXP | sed 's/[^1,3,\,]*//g' | sed -e's/\(\([^,]*,\)\{1\}[^,]*\),/\1\n/g' | tr -d ',' | sed ':a;/.\{2\}/!{s/$/3/;ba}' | sed 's/13/0/g;s/31/1/g' | sed ':a;N;$!ba;s/\n//g'
@pfichtner
pfichtner / tinytx.vagrantfile
Created June 5, 2017 23:06
A Vagrantfile for an Arduino IDE supporting arduino-tiny (https://nathan.chantrell.net/tinytx)
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<EOF
apt install -y arduino
usermod -aG dialout vagrant
wget 'https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/arduino-tiny/arduino-tiny-0150-0020.zip' -O arduino-tiny.zip
unzip arduino-tiny.zip
rm arduino-tiny.zip
#!/bin/bash
# copied from https://help.ubuntu.com/community/MakeALiveCD/DVD/BootableFlashFromHarddiskInstall
export WORK=$HOME/work
export CD=$HOME/cd
export FORMAT=squashfs
export FS_DIR=casper
sudo mkdir -p ${CD}/${FS_DIR} ${CD}/boot/grub ${WORK}/rootfs
@pfichtner
pfichtner / autoinstall-preseed.cfg
Last active September 30, 2020 19:50
ubuntu-netconsole
# based on http://schneidr.de/2012/05/preseed-fuer-ubuntu-10-04-fuer-12-04-aktualisieren/
# Sprache des Servers auf Englisch, Tastaturlayout auf Deutsch setzen
d-i debian-installer/language string en
d-i debian-installer/country string DE
d-i debian-installer/locale string en_US
d-i console-setup/ask_detect boolean false
d-i keyboard-configuration/layoutcode string de
# Mirror settings.
@pfichtner
pfichtner / checkShutdown
Last active October 19, 2015 09:00
mythbackend scripts
#! /bin/sh
# (file must be present on master and slave(s))
OK_TO_SHUTDOWN=0
DO_NOT_SHUTDOWN=1
DISABLE_AUTO_SHUTDOWN=3
xpathQuery() {
xpath -q -e "$2" "$1" | awk -F "[<>]" '{print $3}'
}