Skip to content

Instantly share code, notes, and snippets.

View childnode's full-sized avatar

Marcel Trautwein childnode

View GitHub Profile
@childnode
childnode / cmpany.bash.func.sh
Created November 11, 2016 15:06
cmp any but not cOmpany :D ... just pipe a list of files to it and it compares any to any ... using: cmp of course
function cmpany { i=(); while read x; do for j in ${i[@]}; do echo "$j vs. $x"; cmp $j $x; done; i+=("$x"); done; }
currentBranch="$(git branch -q --no-column --no-color | grep '^*' | awk '{print $2}')";
for branch in $(git branch -q --no-column --no-color | sed -e 's/^*/ /'); do
git rebase origin/${branch} ${branch} --onto origin/${branch};
done
git co ${currentBranch}
unset currentBranch
@childnode
childnode / hasSize.regex
Last active August 31, 2016 11:27
JUnit to JUnit hamcrest - assertThat(sth, hasSize(expectedSize)) using org.hamcrest.MatcherAssert.assertThat and org.hamcrest.Matchers.hasSize
s
|
assertNotNull\((?:\s*([^,;$]+))\s*\)
|
assertThat\($1, notNullValue\(\)\)
|
## deletes all "fork/*" branches on remote
git push fork -f $(for i in $(git branch -r | grep "fork/"); do echo :$(echo $i | sed -e 's/fork\///'); done)
@childnode
childnode / build_jar_manifest.gradle
Created August 16, 2016 05:13
gradle jar MANIFEST.mf
// see https://github.com/bmuschko/gradle-docker-plugin/blob/master/build.gradle
jar {
manifest {
attributes 'Implementation-Title': 'Gradle Docker plugin',
'Implementation-Version': version,
'Built-By': System.getProperty('user.name'),
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion
}
@childnode
childnode / idea_javaFixAndVcsAutoSetup.gradle
Created August 16, 2016 05:07
idea gradle project setup for additional sourceSets
// fixing setup of what idea does not automatically - see https://github.com/bmuschko/gradle-docker-plugin/blob/master/build.gradle
idea.project {
jdkName = '1.8'
languageLevel = compatibilityVersion
ipr.withXml { provider ->
def node = provider.asNode()
// Use GIT
def vcsConfig = node.component.find { it.'@name' == 'VcsDirectoryMappings' }
@childnode
childnode / dockerSaveAllImages.scratchfile.sh
Last active July 18, 2017 10:43
dockerSaveAllImages.sh
#!/bin/bash
docker images | grep -v "^REPOSITORY"| awk '{print $1":"$2}' | tee -a scratch.$(date +%F).txt
for i in $(cat scratch.2017-07-18.txt); do echo docker pull $i; done > scratch.$(date +%F).restore.sh
echo -e "\n[DONE] For Restore please execute: scratch.$(date +%F).restore.sh"
chmod +x ./scratch.$(date +%F).restore.sh
@childnode
childnode / integrationTest.gradle
Last active August 16, 2016 05:07
How do I add a new sourceset to Gradle? http://stackoverflow.com/a/37882006/529977
apply plugin: 'java'
// apply the runtimeClasspath from "test" sourceSet to the new one
// to include any needed assets: test, main, test-dependencies and main-dependencies
sourceSets {
integrationTest {
compileClasspath += sourceSets.test.runtimeClasspath
// somehow this redeclaration is needed, but should be irrelevant
// since runtimeClasspath always expands compileClasspath
runtimeClasspath += sourceSets.test.runtimeClasspath
@childnode
childnode / wrapper.nail.java.gradle
Last active June 24, 2016 09:55
gradle.wrapper nail version for gradle and java
allprojects {
sourceCompatibility = JavaVersion.VERSION_1_8
tasks.withType(JavaCompile) { task ->
// nicify "invalid source release: 1.8" message:
task.doFirst {
if (("$System.env.JAVA_HOME".trim().isEmpty() || System.env.JAVA_HOME == null) && ("$System.env.JDK_HOME".trim().isEmpty() || System.env.JDK_HOME == null)) {
println ' WARNING: neither JAVA_HOME nor JDK_HOME set!'
}
if (!JavaVersion.current().equals(project.sourceCompatibility)) {
@childnode
childnode / jboss.hsqldb.file.windows.xml
Created May 10, 2016 10:36
jboss.hsqldb connection strings / configuration xml
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<datasource jndi-name="java:jboss/datasources/myapp-ds"
pool-name="myapp-ds" enabled="true" jta="true" use-java-context="true">
<connection-url>url>jdbc:hsqldb:file:d:\myapp</connection-url>
<driver>hsqldb</driver>
<pool>
<prefill>false</prefill>
<use-strict-min>false</use-strict-min>