Skip to content

Instantly share code, notes, and snippets.

View mobmad's full-sized avatar

Mads Mobæk mobmad

View GitHub Profile
@mobmad
mobmad / OSX Terminal open in new tab
Created September 21, 2010 09:31
open a new terminal tab with the same path and (optionally) pass params to the new tab
# Inspired from http://elsethenif.wordpress.com/2009/06/11/open-a-new-tab-on-terminal-with-the-same-path-on-mac-os-x/
# Put this in your ~/.bash_profile
# Added functinality to pass commands to the new tab
# Examples:
# Open a new tab in terminal with the same path:
# nt
# Open a new tab with the same path, and pass command "script/server":
# nt script/server
# Open a new tab with the same path, list all files and navigate one directory up:
# nt ls "cd .."
@mobmad
mobmad / pom.xml
Last active December 20, 2015 20:49
Java junit hamcrest mockito
<?xml version="1.0" encoding="UTF-8"?>
<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>bootcamp-kurs</groupId>
<artifactId>bootcamp-kurs</artifactId>
<version>1.0-SNAPSHOT</version>
@mobmad
mobmad / gist:7ad4adac06e26a0b854a
Last active August 29, 2015 14:17
Forward/enable environment variables from docker (-e) to be visible even after changing user from root with "su -"

Dockerfile

FROM centos:6
RUN useradd appuser
CMD env|grep JAVA_OPTIONS|awk -F= '{print "export "$1"=\""$2"\""}'>/etc/profile.d/00_java-env.sh;bash

Usage

  1. docker build -t javaenv .
  2. docker run -it -e JAVA_OPTIONS="-DjvmProperty1=1 -DjvmProperty2=2" javaenv
@mobmad
mobmad / gist:433ba54e9cb97d6d7771
Created March 24, 2015 21:37
Create self-signed certificate for wiremock and configure a java client under test for HTTPS

1. Generate self-signed certificate

keytool -genkey -alias wiremock -keyalg RSA -keysize 1024 \
    -validity 365 -keypass password -keystore identity.jks -storepass password

Important: keypass must equal storepass, or else you'll receive java.io.IOException: !JsseListener: java.security.UnrecoverableKeyException: Cannot recover key

2. Start wiremock with the new keystore and HTTPS enabled