Skip to content

Instantly share code, notes, and snippets.

View childnode's full-sized avatar
🐝
Bee here

Marcel Trautwein childnode

🐝
Bee here
View GitHub Profile
@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 / 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 / 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
}
## 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 / 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\(\)\)
|
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 / 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; }
@childnode
childnode / adb_fubu.sh
Last active November 18, 2016 12:24
`./adb pull -a ~/fubu/` hangs unexpected on `pull: building file list...`
mkdir -p ~/fubu/;
for i in $(./adb shell ls | grep -ve "^proc\b" | grep -v "^sys\b" | tr -s [:space:] ' '); do
echo "====$i===";
./adb pull -a /$i ~/fubu/$i;
done
@childnode
childnode / regen_host_keys.sh
Created November 28, 2016 14:46
regenerate all hostkeys for sshd
for i in /etc/ssh/ssh_host_*_key; do ssh-keygen -f $i -t $(echo $i | awk 'BEGIN {FS= "_"} { print $3}'); done
@childnode
childnode / brew-cask-check-updates.bash
Last active March 9, 2017 21:58
brew-cask-check-updates
for cask in $(brew cask list -1); do
echo -n "${cask} : ";
caskLatest=$(brew cask info $cask | head -1 | awk -F: '{print $2}' | tr -d '[[:space:]]');
caskCurrentDir=$(brew cask info $cask | grep -e "^$(brew --prefix).*/${cask}/"| head -1| awk '{print $1}');
[ ! -d $(dirname ${caskCurrentDir})/${caskLatest} ] && echo "outdated : ("$(basename ${caskCurrentDir})" -> "${caskLatest}")" || echo "current";
done