Skip to content

Instantly share code, notes, and snippets.

View bondolo's full-sized avatar
🏠
😷💉

Mike Duigou bondolo

🏠
😷💉
View GitHub Profile
@bondolo
bondolo / URLTest.java
Created February 25, 2021 23:23
Using JDK HttpServer in a JUnit test
/*
* Copyright © 2017 Mike Duigou.
* Public Domain. No Rights Reserved.
*/
public class URLTest {
private static final Logger LOGGER = Logger.getLogger(URLTest.class.getSimpleName());
private static final int TEST_FILE_SIZE = 1 << 20;
@bondolo
bondolo / .zprofile
Last active February 28, 2023 19:59
My .zprofile for MacOS
##!/usr/bin/env zsh
export EDITOR=$(command -v bbedit || command -v nano || command -v vi || command -v ed)
# initialize python version
if command -v pyenv 1>/dev/null 2>&1; then
eval "$(pyenv init -)"
fi
# Use Java 11
@bondolo
bondolo / gist:ae1d46be7dd0dbbfe4990ce9066d2dac
Last active August 25, 2022 22:27
Install of new MacOS Java development system
Install OhMyZsh!
Install Xcode
Install Homebrew
Install homebrew tap cask-versions
homebrew install —cask bbedit firefox flux oracle-jdk oracle-jdk-javadoc slack transmission vlc wireshark zulu zulu8 gpg-suite
ack
ant
automake
bash
@bondolo
bondolo / StreamingGZIPOutputStream.java
Created November 12, 2020 00:07
Streaming GZIPOutputStream
/*
* Copyright © 2011 Mike Duigou. No rights reserved.
*/
import java.io.IOException;
import java.io.OutputStream;
import java.util.zip.Deflater;
import java.util.zip.GZIPOutputStream;
/**
* Extends GZIPOutputStream to improve behaviour of created streams for incrementally streamed content. This
@bondolo
bondolo / pom.xml
Created October 8, 2020 23:29
Add default execution of integration tests
<!-- enable default execution of integration (*IT.java) tests -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
@bondolo
bondolo / pom.xml
Created September 10, 2020 20:19
Conditionally activating <release> with Java 9+ Maven Compiler plugin
<profile>
<id>Java 9+ configuration</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Use -release compiler option rather than source/target if 9+ -->
<release>${maven.compiler.target}</release>
@bondolo
bondolo / pom.xml
Created August 29, 2018 21:01
profile snippet from parent pom for configuring release with compiler on jdk >= 9
<profile>
<id>Java 9+ configuration</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<!-- Use -release compiler option rather than source/target if 9+ -->
<release>${maven.compiler.target}</release>
@bondolo
bondolo / Thing.java
Last active June 5, 2018 07:24
An investigation of inner class behaviour. Prints information about a class and it's enclosing class.
/**
* public domain
*
* https://creativecommons.org/publicdomain/zero/1.0/
*
*/
package test;
import java.lang.reflect.Modifier;
import java.util.concurrent.Callable;