Skip to content

Instantly share code, notes, and snippets.

View dhinojosa's full-sized avatar

Daniel Hinojosa dhinojosa

View GitHub Profile
@dhinojosa
dhinojosa / VirtualThreadsTryWithResources.java
Created March 24, 2024 23:02
The following hangs when using ExecutorService in TWR block
package com.evolutionnext.demo.virtualthreads;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.concurrent.*;
@dhinojosa
dhinojosa / FindAllJavaWordsFromURL.java
Last active March 24, 2024 20:22
Does this deadlock for you?
package com.evolutionnext.demo.virtualthreads;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.concurrent.*;
@dhinojosa
dhinojosa / UsingGathererGroupBy.java
Last active March 10, 2024 22:26
GroupBy as a Gatherer
static class GroupBy<T, K> implements Gatherer<T, HashMap<K, List<T>>, Map.Entry<K, List<T>>> {
private final Function<T, K> groupFunction;
public GroupBy(Function<T, K> groupFunction) {
this.groupFunction = groupFunction;
}
@Override
public Supplier<HashMap<K, List<T>>> initializer() {
@dhinojosa
dhinojosa / git_repo_check.sh
Last active February 29, 2024 18:26
Find all the repositories in your home directory and tells you what needs to be updated. Run with ./git_repo_check <dir1> <dir 2>
#!/bin/bash
# Function to check a single git repository
check_git_repo() {
local dir=$1
cd "$dir" || return
# Check for uncommitted changes
uncommitted_changes=$(git status --porcelain)
if [ ! -z "$uncommitted_changes" ]; then
import java.util.concurrent.ExecutionException;
import java.util.concurrent.StructuredTaskScope;
import java.util.concurrent.atomic.AtomicLong;
public class MillionsOfTasks {
private final AtomicLong atomicLong;
public MillionsOfTasks() {
atomicLong = new AtomicLong();
}
[
{
"type": "record",
"namespace": "MyEvents",
"name": "PhoneNumber",
"fields": [
{
"name": "countryCode",
"type": "string"
},
@dhinojosa
dhinojosa / public.adoc
Created September 6, 2023 16:21
Sample adoc public

Test

  • One

  • Two

  • Three

@dhinojosa
dhinojosa / mvn.bat
Created June 18, 2015 21:56
The old mvn.bat file. Hope it works
@REM ----------------------------------------------------------------------------
@REM Licensed to the Apache Software Foundation (ASF) under one
@REM or more contributor license agreements. See the NOTICE file
@REM distributed with this work for additional information
@REM regarding copyright ownership. The ASF licenses this file
@REM to you under the Apache License, Version 2.0 (the
@REM "License"); you may not use this file except in compliance
@REM with the License. You may obtain a copy of the License at
@REM
@REM http://www.apache.org/licenses/LICENSE-2.0
apiVersion: v1
kind: Pod
metadata:
annotations:
dns.alpha.kubernetes.io/internal: api.internal.dik8ssecurity01.k8s.local
kubectl.kubernetes.io/default-container: kube-apiserver
creationTimestamp: null
labels:
k8s-app: kube-apiserver
name: kube-apiserver

openpgp4fpr:8FC6B46B0E6D168B9AD09E774EE08417F5FD33D2