Skip to content

Instantly share code, notes, and snippets.

View matthiasbalke's full-sized avatar

Matthias Balke matthiasbalke

  • Germany
View GitHub Profile
@matthiasbalke
matthiasbalke / highlight.sh
Last active December 31, 2015 20:39
Simple shell script to highlight output based on keywords.
#!/bin/bash
# Color highlighting for bash scripts
# by Balke, Matthias <Matthias.Balke@gmail.com> 2013-2014
#
# usage:
# just pipe the output of a script throug this script
#
# tail -f myLog.log | hightlight.sh
@matthiasbalke
matthiasbalke / Usage
Last active January 18, 2017 13:51
How to write the pid of a starting linux process to file and kill it from file afterwards
$ execPid.sh mySpringBoot "java -jar target/spring-boot-sample-actuator-ui-1.0.1.BUILD-SNAPSHOT.jar"
7216
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.0.1.BUILD-SNAPSHOT)
#!/bin/sh
# calculates the usage of every directory in the current directory
du -sch ./* | sort -h
@matthiasbalke
matthiasbalke / IE_JSON_as_plain_text.reg
Created September 4, 2015 13:35
Internet Explorer display JSON as plain text
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=dword:00013880
[HKEY_CLASSES_ROOT\MIME\Database\Content Type\application/hal+json]
"CLSID"="{25336920-03F9-11cf-8FD0-00AA00686F13}"
"Encoding"=dword:00013880
@matthiasbalke
matthiasbalke / .bash_profile
Created December 20, 2016 09:35
delete artifact groups from Gradle cache
#!/bin/bash
# ...
# usage: deleteGradleCache groupId
deleteGradleCache() {
local id=$1
if [ -z "$id" ]; then
echo "Please provide an group or artifact id to delete"
return 1
@matthiasbalke
matthiasbalke / helper.gradle
Last active April 1, 2023 21:53
Gradle resolveDependencies Task
// found here: http://jdpgrailsdev.github.io/blog/2014/10/28/gradle_resolve_all_dependencies.html
task resolveDependencies {
doLast {
project.rootProject.allprojects.each { subProject ->
subProject.buildscript.configurations.each { configuration ->
resolveConfiguration(configuration)
}
@matthiasbalke
matthiasbalke / deleteGradleCache.sh
Created February 1, 2017 18:46
delete a selected artifact / group from gradle local cache
#!/bin/bash
deleteGradleCache() {
local id=$1
if [ -z "$id" ]; then
echo "Please provide an group or artifact id to delete"
return 1
fi
find ~/.gradle/caches/ -type d -name "$id" -prune -exec rm -rf "{}" \; -print
}
@matthiasbalke
matthiasbalke / convert_certificate_der_pem.sh
Created February 9, 2017 14:19
Convert a DER certificate to PEM
openssl x509 -inform DER -in Deutsche_Telekom_Root_CA_2.cer -outform PEM -out Deutsche_Telekom_Root_CA_2.pem
@matthiasbalke
matthiasbalke / get_certificate_infos.sh
Last active May 18, 2021 17:29
Get certificate infos
openssl x509 -in Deutsche_Telekom_Root_CA_2.pem -noout -text | less
openssl x509 -in Deutsche_Telekom_Root_CA_2.pem -noout -issuer -subject| less
openssl x509 -in Deutsche_Telekom_Root_CA_2.pem -noout -serial -fingerprint -issuer -subject -dates | less
# Check an MD5 hash of the public key to ensure that it matches with what is in a CSR or private key
# source: https://www.sslshopper.com/article-most-common-openssl-commands.html
openssl x509 -noout -modulus -in certificate.crt | openssl md5
openssl rsa -noout -modulus -in privateKey.key | openssl md5
openssl req -noout -modulus -in CSR.csr | openssl md5
@matthiasbalke
matthiasbalke / get_certificate_info_from_server.sh
Created February 9, 2017 14:25
Get certificate info from server
openssl s_client -showcerts -state -crlf -ign_eof -connect www.heise.de:443