Skip to content

Instantly share code, notes, and snippets.

View rlindooren's full-sized avatar

Ricardo Lindooren rlindooren

  • The Netherlands
View GitHub Profile
@rlindooren
rlindooren / README.md
Created July 3, 2024 08:52 — forked from baatochan/README.md
How to remove a custom UEFI/BIOS logo on HP laptops

How to remove a custom UEFI/BIOS logo on HP laptops

Tested on HP Elitebook 840 G3. You may also use this tool to change the logo to your own custom one.

Why am I writing this gist?

Recently I acquired an used HP Elitebook 840 G3. Everything was fine with it, but it had a custom UEFI logo when starting the OS - it was branded by the company that owned this laptop before.

As it became my personal laptop I didn't want it to be branded by them and I tried to find a way to restore the original HP/Windows logo (it had the custom logo during POST and during the OS startup as well).

@rlindooren
rlindooren / download_asset_from_private_github_repo.sh
Created May 28, 2024 18:28
Bash script that can download an asset from a private Github repository
#!/usr/bin/env bash
# Prerequisites: curl, jq, and a GitHub token (provided as environment variable `GITHUB_TOKEN`)
set -e
ORG=${ORG:-"your-default-org"}
REPO=${REPO:-"your-default-repo"}
API_URL="https://api.github.com/repos/${ORG}/${REPO}"
ARCH=${ARCH:-"linux_amd64"}
@rlindooren
rlindooren / date.sh
Created April 23, 2024 10:42
Linux/MacOS date
if [[ "$OSTYPE" == "darwin"* ]]; then
YEAR_AGO=$(date -v-365d +"%Y-%m-%d")
else
YEAR_AGO=$(date -d "365 day ago" +"%Y-%m-%d")
fi
YEAR_AGO_ISO="${YEAR_AGO}T00:00:00"
@rlindooren
rlindooren / AssertJProtoCompare.java
Created November 26, 2023 14:16
AssertJ field by field comparison for ProtoBuf messages ignoring dynamic fields (gRPC)
public <T> ListAssert<T> createAssertionIgnoringCreatedAndModifiedDateFields(List<T> protoMessages) {
return assertThat(protoMessages)
.usingRecursiveFieldByFieldElementComparatorIgnoringFields(
// Ignore fields that are "dynamical" during a test
"createdOn_",
"lastModifiedOn_",
// And also additionally ignore some ProtoBuf 'special fields'
// which otherwise cause the assertion to fail because they are included due to the field-by-field comparison
"memoizedHashCode",
"memoizedIsInitialized");
@rlindooren
rlindooren / gist:766d6a0a80406cdda5edf706077d21cb
Created October 4, 2022 09:36
Postgres find columns that don't have an index
-- Looks at columns ending with '_id' (edit if needed in Where-clause)
select
col.table_name,
col.column_name,
idx.indexdef
from information_schema.columns col
left join pg_indexes idx
on col.table_name = idx.tablename
and idx.indexdef like '%' || col.column_name || '%'
where col.table_schema = 'public'
@rlindooren
rlindooren / SomeProperties.java
Created May 22, 2020 11:44
Spring: inject Map from additional YAML properties file with @propertysource and @ConfigurationProperties
package foo;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import java.util.List;
import java.util.Map;
@rlindooren
rlindooren / ContextAwareExecutorService.java
Last active August 21, 2019 12:17
Passing MDC data to VAVR Future threads
import io.vavr.control.Option;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.MDC;
import javax.annotation.Nonnull;
import java.util.*;
import java.util.concurrent.*;
import java.util.stream.Collectors;
/**
@rlindooren
rlindooren / kafka-service-script
Last active April 24, 2017 19:22 — forked from mottyc/kafka-service-script
Kafka service script (copy to file: /etc/init.d/kafka)
#! /bin/sh
# /etc/init.d/kafka: start the kafka daemon.
### BEGIN INIT INFO
# Provides: kafka
# Required-Start: $local_fs $zookeeper
# Required-Stop: $local_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: kafka
@rlindooren
rlindooren / gist:d248247463da74ba8688225ac6ed1e52
Created May 3, 2016 16:56
Java & MongoDB on Mac OS X: Enable SSL connections with a self signed certificate and allowing clients to connect without a client certificate
# Install MongoDB with SSL support (using brew, because the download from the mongodb website is build without SSL support)
brew install mongodb --with-openssl
# Create a certificate
cd /usr/local/etc/openssl/certs/
openssl req -newkey rsa:2048 -new -x509 -nodes -out mongodb-cert.crt -keyout mongodb-cert.key
cat mongodb-cert.key mongodb-cert.crt > mongodb.pem
# Make a backup of the Java truststore (just in case)
sudo cp $JAVA_HOME/jre/lib/security/cacerts $JAVA_HOME/jre/lib/security/cacerts.original
@rlindooren
rlindooren / es2txt.py
Created March 9, 2015 12:00
Simple Python script that can convert Elasticsearch JSON output (based on Log4j events logged via Logstash) to human readable text
#!/usr/bin/python
import sys
import json
jsonData = json.load(sys.stdin)
for hit in jsonData["hits"]["hits"]:
source = hit["_source"]
print "{0} {1:<5} - <{2}> {3}.{4}.({5}): {6}".format(source["@timestamp"], source["priority"], source["thread"], source["class"], source["method"], source["file"], source["message"])