Skip to content

Instantly share code, notes, and snippets.

View StefanHeimberg's full-sized avatar

Stefan Heimberg StefanHeimberg

View GitHub Profile
@StefanHeimberg
StefanHeimberg / persistence.xml
Last active September 1, 2015 20:36 — forked from mortezaadi/persistence.xml
persistence xml configurations for major databases and jpa providers
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
version="1.0">
<!-- derby -->
@StefanHeimberg
StefanHeimberg / entity-rules.xml
Last active October 13, 2015 14:59
JQAssistant Rules für Entities
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/analysis/rules/schema/v1.0">
<!-- http://neo4j.com/developer/cypher/ -->
<constraint id="entity-rules:FieldAccess">
<requiresConcept refId="jpa2:Entity" />
<description>All JPA Entities without Field Access</description>
<cypher><![CDATA[
MATCH
(e:Jpa:Entity)-[:DECLARES]->(m:Method),
@StefanHeimberg
StefanHeimberg / happy_git_on_osx.md
Created November 11, 2015 07:32 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@StefanHeimberg
StefanHeimberg / CDIUtil.java
Last active September 2, 2018 21:39
java ee 6 lookup utilities
package com.github.stefanheimberg.example.support;
import javax.enterprise.context.spi.CreationalContext;
import javax.enterprise.inject.spi.Bean;
import javax.enterprise.inject.spi.BeanManager;
public final class CDIUtil {
public static <T> T lookupByName(final String name) {
final BeanManager bm = getBeanManager();
// https://rmannibucau.wordpress.com/2015/03/10/cdi-and-startup/
@ApplicationScoped
public class ProvisioningDataForApplicationLifecycle {
private final Map<String, User> users = new HashMap<>(); // + getter
public void init(@Observes @Initialized(ApplicationScoped.class) Object init) {
users.put("cdi", new User("cdi", "1.1"));
users.put("deltaspike", new User("deltaspike", "1.3"));
}
@StefanHeimberg
StefanHeimberg / genymotionwithplay.txt
Created February 23, 2016 18:36 — forked from wbroek/genymotionwithplay.txt
Genymotion with Google Play Services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
Google Apps for Android 4.4.4 (https://www.androidfilehost.com/?fid=23501681358544845 - gapps-kk-20140606-signed.zip)
Google Apps for Android 4.3 (https://www.androidfilehost.com/?fid=23060877490000124 - gapps-jb-20130813-signed.zip)
https://help.github.com/articles/changing-author-info/
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
@StefanHeimberg
StefanHeimberg / API.md
Created September 15, 2017 20:54 — forked from iros/API.md
Documenting your REST API

Title

<Additional information about your API call. Try to use verbs that match both request type (fetching vs modifying) and plurality (one vs multiple).>

  • URL

    <The URL Structure (path only, no root url)>

  • Method:

@StefanHeimberg
StefanHeimberg / docker-compose-tick.yml
Created March 14, 2018 09:58 — forked from cdelaitre/docker-compose-tick.yml
Monitor Docker Swarm with the InfluxData TICK Stack
version: '3'
services:
# FRONT
chronograf:
# Full tag list: https://hub.docker.com/r/library/chronograf/tags/
image: chronograf
deploy:
replicas: 1
placement:
constraints:
@StefanHeimberg
StefanHeimberg / generate_version_txt.sh
Last active September 18, 2021 22:08
Script to generate semver version.txt from maven and git. Can be used in CI such as Bamboo or Jenkins
#!/usr/bin/env bash
# author: Stefan Heimberg <kontakt@stefanheimberg.ch>
# download url: https://gist.github.com/StefanHeimberg/c19d7665e8df087845c036fe8b88c4f2
# version: 0.7
# usage:
# for maven based projects:
# - ./generate_version_txt.sh
# - ./generate_version_txt.sh <BUILD_NR_FROM_CI>