Skip to content

Instantly share code, notes, and snippets.

View moaxcp's full-sized avatar
💭
X11 wants me back

John Mercier moaxcp

💭
X11 wants me back
View GitHub Profile
@moaxcp
moaxcp / gist:6ff78cdfe45f9e5720fe87a73104cc10
Created January 15, 2024 02:30
There are two annoying things about BufferedInputReader in java
1. `mark()` and 'reset()` does not support nesting. This is calling mark multiple times and resetting each layer.
2. `available()` does not first `fill()` the buffer so developers have to instead either rely on EOFException or do a `mark()`, `read()`, and `reset()` before calling `available()`

Build netbeans from source in nixpkgs

Netbeans

current version is 11.2. It use ant to build. There is a target donwloadLibraries which is used to download dependencies. Some of these are already in nix. Netbeans already exists in nixos as a binary install.

Gentoo

@moaxcp
moaxcp / nix-service.md
Last active October 18, 2019 01:34
nix-service.md

The idea here is to write a service to help maintain a nixos install.

General nix searching

  • Index packages for each channel nix-env -qa

  • Index packages for nur

Server status

@moaxcp
moaxcp / nixpkgs-style-guide.md
Last active May 8, 2020 01:56
nixpkgs style guide

These are some of the tips I have been given in my contributions to nixpkgs.

overall

Include blank lines between sections to increase readability.

data

lists

Searches the classpath of a configuration for a specific class or resource.

I've been running into issues figuring out where spring-boot magic comes from at work. I think a plugin that can find classes or resources for a configuration would help.

chapter 1

Package managers

Most package managers modify the global state of the system. The global state can be represented by typical linux file system (fhs). In this hierarchy there is only one /bin. How does an OS handle conflicts in /bin when two package install the same file? Nix removes the concept of FHS and replaces it with the nix store.

Some systems have alternatives and administrators can always install packages in different locations.

Immutable

  • Using micronaut with lombok
  • Going through each guide in one project
  • using jpa with lombok in micronaut

jpa

article is located at https://guides.micronaut.io/micronaut-data-access-jpa-hibernate/guide/index.html

  • classes are built out of order so there are compile errors until later in the guide
  • uses a lot of if checks instead of Optional.ofNullable(offset);
  • constructors are above members for some reason
  • creates an interface for ApplicationConfiguration which is not very useful

concept

Assertions for testing a main method.

assertThat(Main::main).withArguments(args).withInput("input").hasOutputWhenExecuted().isEqualTo("output");

Not sure how the api would work but this is the idea.

maven has an awesome way of adding taglet libraries to the build for javadoc. Gradle should have something like this too.

<build>
  <plugins>
    <plugin>
      <artifactId>maven-javadoc-plugin</artifactId>
      <version>3.1.0</version>
      <configuration>
 guru.nidi.graphviz.GraphvizTaglet

At work I ran into a problem where an end-to-end test failed after 15 minutes. It failed because one service is broken and needs restarted daily. This got me thinking that it would be nice if test automation where setup as a hierarchy instead of a stepwise process. In a stepwise setup a jenkins job will run unit tests, integration tests, functional tests, then end-to-end tests. If one stage fails the others will not run. What if the test dependecies were mapped between each level of testing?

This is about encoding the hierarchy of tests so the test engine is aware of the hierarchy and can identify higher level tests that will not work when lower level tests is failing. In a system like this all tests can be run and produce a hierarch of failures which can be presented to developers, management, and customers showing which functionality and features are affected by lower level failures.

functional mapped to end-to-end

If functional tests could be mapped to end-to-end tests so that when all the tests are r