Skip to content

Instantly share code, notes, and snippets.

View BenSlabbert's full-sized avatar
🎯
Focusing

Ben BenSlabbert

🎯
Focusing
  • München, Germany
View GitHub Profile
# first create a network manually:
docker network create shared
# set up 2 docker-compose.yml files:
version: "3.3"
services:
nginx-front:
package main
import (
"bytes"
"fmt"
"mime/multipart"
"net/http"
)
func main() {
@BenSlabbert
BenSlabbert / bash-cli-echo-bytes.sh
Created January 31, 2020 06:58
use echo to write binary data (hex format) directly to file
#!/bin/bash
echo -n -e '\x08\xdb\xb8\x28\x40\x01\x00\x40\x00\xcd\x44\x00' > byteFileForNow
@BenSlabbert
BenSlabbert / mariadb-character-set-scripts.sql
Created October 24, 2019 06:31
Some helper scripts to set schema/table charater sets and to see what the current character sets are
# creating the schema with the default character set
CREATE SCHEMA IF NOT EXISTS my_schema;
ALTER DATABASE my_schema COLLATE = 'utf8mb4_general_ci';
# get the character set for the schema
USE my_schema;
SELECT @@character_set_database, @@collation_database;
# get the default character set for the schema
SELECT default_character_set_name
@BenSlabbert
BenSlabbert / mysql_set_utf8.sql
Created October 21, 2019 08:21
This sql script sets the mysql table to use full utf8 support on a single table
ALTER TABLE 'my_table_name' CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci
@BenSlabbert
BenSlabbert / select specific fields with jq
Created July 8, 2019 09:21
select specific fields with jq
jq '.[] | .icao, .appVersion, .firmwareVersion' file.json
@BenSlabbert
BenSlabbert / maven-properties-spring-info.yml
Created May 21, 2019 09:34
Add maven pom.xml properties to spring info (${base_url}/actuator/info)
info:
app:
name: "@project.name@"
description: "@project.description@"
version: "@project.version@"
@BenSlabbert
BenSlabbert / spring-cloud-rabbitmq-properties.txt
Created May 21, 2019 09:32
Spring Cloud RabbitMQ Properties
# see spring binding docs here
https://spring.io/projects/spring-cloud-stream#learn
# properties are available in these clases
org.springframework.cloud.stream.binder.rabbit.properties.RabbitConsumerProperties
org.springframework.cloud.stream.binder.rabbit.properties.RabbitProducerProperties
org.springframework.cloud.stream.binder.rabbit.properties.RabbitCommonProperties
# config will look something like this in the application.yml
@BenSlabbert
BenSlabbert / get-pom-version.sh
Created May 16, 2019 07:28
Get the POM version with maven
# https://stackoverflow.com/a/26514030/4841710
mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec
@BenSlabbert
BenSlabbert / LiquibaseLockConfigExt.java
Created May 14, 2019 07:54
Override Liquibase DB Locking with Redis (Spring Boot 2.0.4.RELEASE)
// very NB
package liquibase.ext;
import io.lettuce.core.RedisClient;
import io.lettuce.core.SetArgs;
import io.lettuce.core.api.StatefulRedisConnection;
import io.lettuce.core.api.sync.RedisCommands;
import liquibase.database.Database;
import liquibase.exception.DatabaseException;
import liquibase.exception.LockException;