Skip to content

Instantly share code, notes, and snippets.

@kekru
kekru / Oracle on localhost via Vagrant.md
Last active October 21, 2023 17:19
Run Oracle XE DB on localhost via Virtual Machine, Vagrant, Docker

This is how to easily setup an Oracle XE DB in a Virtual Machine that is accessible via localhost:1521. So you don't have to install Oracle XE locally, but inside a VM.
We use VirtualBox, Vagrant and Docker for that.

First install VirtualBox https://www.virtualbox.org/wiki/Downloads
and Vagrant https://www.vagrantup.com/downloads.html

Run vagrant version to check that vagrant is correctly installed.

Save the Vagrantfile from this gist to a local directory.

@kekru
kekru / register Hibernate EventListener in Spring.md
Created September 22, 2016 16:09
Register a Hibernate Envers EventListener in Spring Boot (Hibernate 4, Hibernate 5)

Hibernate 4 introduced a new Audit API for event listening.
org.hibernate.envers.event.AuditEventListener was replaced by org.hibernate.event.spi.*, for example org.hibernate.event.spi.PostDeleteEventListener.

First create your custom listener. Example: You want do disable auditing for delete operations.

import org.hibernate.envers.event.spi.EnversPostDeleteEventListenerImpl;
import org.hibernate.event.spi.PostDeleteEvent;

public class MyAuditListener extends EnversPostDeleteEventListenerImpl {

Docker useful commands

Stop and remove all running containers:
docker stop $(docker ps -aq) && docker rm $(docker ps -aq)

Remove all stopped containers:
docker rm $(docker ps -aq)

Remove untagged/dangling/<none> images
docker rmi $(docker images -q -f dangling=true)

@kekru
kekru / Linux VPN FH-Dortmund.md
Created October 17, 2016 17:26
Connect to FH Dortmund VPN on Ubuntu

Verbindung mit dem VPN der FH Dortmund aufbauen unter Ubuntu

sudo apt-get install -y openconnect iptables expect
sudo openconnect vpngate.fh-dortmund.de
@kekru
kekru / Start Docker in VM with a simple command.md
Created November 3, 2016 11:47
Start Docker in VM with a simple command

Start a VM with Docker with a simple command

This is how to easily setup a VM with Docker and Docker Remote API enabled.
We use VirtualBox, Vagrant and Docker for that.

First install VirtualBox https://www.virtualbox.org/wiki/Downloads
and Vagrant https://www.vagrantup.com/downloads.html

Run vagrant version to check that vagrant is correctly installed.

Save the Vagrantfile from this gist to a local directory.

@kekru
kekru / Docker connect to remote server.md
Last active October 17, 2024 11:55
Connect to another host with your docker client, without modifying your local Docker installation

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

@kekru
kekru / Vagrant create local box.md
Last active July 19, 2023 05:58
Vagrant: Create local box

Create box

This is how to install something in a VM and export it as a Vagrant box and use it locally.

First copy the Vagrantfile from below and change the box to the box you want as a base.

Run vagrant up to create the Virtual Machine and vagrant ssh to login.
On Windows you might have to put ssh.exe to your %PATH%. If you have installed git, you can use C:\Program Files\Git\usr\bin You can also login via Putty on host: "localhost", Port "2222", login: "vagrant", password: "vagrant".

# LICENSE CDDL 1.0 + GPL 2.0
#
# Copyright (c) 1982-2016 Oracle and/or its affiliates. All rights reserved.
#
# ORACLE DOCKERFILES PROJECT
# --------------------------
# This is the Dockerfile for Oracle Database 11g Release 2 Express Edition
#
# REQUIRED FILES TO BUILD THIS IMAGE
# ----------------------------------
@kekru
kekru / Remote API via daemon.json.md
Last active January 11, 2024 18:20
Enable Docker Remote API via daemon.json