Skip to content

Instantly share code, notes, and snippets.

View gkhays's full-sized avatar

Garve Hays gkhays

View GitHub Profile
@gkhays
gkhays / GetResource.md
Last active February 13, 2020 00:42
Retrieve a resource on the classpath

Get Resource

Read a file in from a resource. In many cases it is useful to read it into a string. Use a standard Maven directory layout.

├───src
│   ├───main
│   │   ├───java
│   │   └───resources
│ └───test

Getting Debug Logging with Maven and Cargo

Starting in Maven 3.1.x, logging was switched to SLF4J. The consequence is that you no longer receive DEBUG or TRACE logging messages in a cargo build.

Modify Simple Logger Properties

You can update ${MAVEN_HOME}/conf/logging/simplelogger.properties. But that will create a lot of "noise."

org.slf4j.simpleLogger.defaultLogLevel=DEBUG

JSON Parsing in C#

In the past I have used Visual Studio for C# and .NET developement. This little project is used to create a simple .NET console program using Visual Studio Code. The goal is to confirm that for multiple value entries, the .NET parser will use the last entered value.

Getting Started

Use these instructions to get the project up and running.

Prerequisites

Deploy Nginx Using Terraform

terraform init
terraform plan -out tfconfig.tfplan
terraform apply
docker ps
terraform show
@gkhays
gkhays / Compare-Lists-Java.md
Last active October 10, 2019 17:40
Compare members of different lists in Java

Java Collections has some built-in features; e.g. retainAll and removeAll.

//listOne.retainAll(listTwo);
listOne.removeAll(listTwo);

Note: Sets do not allow duplicates.

Keybase proof

I hereby claim:

  • I am gkhays on github.
  • I am gkhays (https://keybase.io/gkhays) on keybase.
  • I have a public key ASArT6jpxW-8ZMbaIJYukNKGpiCD520d9McCdXyoq8T4Pwo

To claim this, I am signing this object:

@gkhays
gkhays / OpenJDK-Mac.md
Last active September 18, 2019 21:14
Install OpenJDK Version 12 on Mac

OpenJDK on Mac

Follow these instructions to move from an Oracle JDK to OpenJDK. In a twist of irony, I had originally replaced OpenJDK on my Mac with the Oracle JDK!

Remove Oracle JDK

The steps for removing different versions of the JDK vary. This is what I did.

sudo rm -rf /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin
@gkhays
gkhays / Eclipse-Console-Logs.md
Last active September 3, 2019 15:36
Redirect Eclipse console logs to a file
@gkhays
gkhays / Javadoc-Markdown.md
Last active November 21, 2023 14:26
Using Markdown in Javadoc

Background: A Google search led me to the source code (on GitHub) for ng_model.ts#L124 wherein it looked like the documentation was Javadoc, but with Markdown syntax.

...
* ### Setting the ngModel name attribute through options
*
* The following example shows you an alternate way to set the name attribute. The name attribute is used
* within a custom form component, and the name `@Input` property serves a different purpose.
*
* ```html
@gkhays
gkhays / App-Isolation.md
Last active November 16, 2019 00:21
Isolate building and executing a Rust application in a Docker container

Isolating a Rust Application in a Docker Container

HN user flatroze posted a CLI tool for saving web pages as a single file. A comment posted by mike-cardwell demonstrated how to compile and run the utility within a Docker container.

Compile and install:

$ git clone https://github.com/Y2Z/monolith.git
$ cd monolith
$ docker run --rm -w "$(pwd)" -v "$(pwd):$(pwd)" -u "$(id -u):$(id -g)" rust cargo install --path .