Category: Coding
-
How long should it take to solve the FizzBuzz coding question?
So, it was past midnight, and I was pretty much done for the day when one of those random thoughts ran past me like a fleeting glimpse (thanks, Roger) and I just couldn’t let go: if I were asking a candidate to solve the FizzBuzz problem, how long would be fair to expect them to…
-
Publishing a Java Library to Maven Central
Created by M. Massenzio, 2021-12-26 Motivation Publishing one’s own source code under an Open Source license (Apache 2 being my favorite one) and making the code publicly available on GitHub is only half the story, these days, in ensuring that your open source project will reach a wide audience. A critical part is also packaging…
-
Using Multiple Identities with GitHub
When using multiple accounts with GitHub, it may be necessary to commit changes to private repositories which may not accessible by all accounts. This is how to generate the key and add it to the SSH agent; then add it to the GitHub account too. The original solution was here.
-
Docker ENTRYPOINT (and a note about $@)
This is something I keep forgetting, so I figure I’ll write it down so it’s here for future reference. General rule: use the exec form of ENTRYPOINT, in other words do this: As expected, this will run apache in the foreground, with PID 1 (unless you’re being a complete idiot and using hostPID – see…
-
JSON Web Tokens (JWT) utilities
A simple utility to generate and decode JSON Web Tokens (JWTs) that can be used to authenticate against web applications. The code is released under the Apache 2 Open Source License. See JWT-OPA for an example of how JWTs can be used to authenticate/authorize access to protected online resources/applications. Usage Use –help (or -h) for…
-
Integrating Open Policy Agent with Spring Security Reactive and JSON Web Tokens
We present a Java library that simplifies adopting the Open Policy Agent server to manage user authorization for a Spring Boot microservice, while also managing API Token (JWT) authentication. Motivation Spring Security assumes a fairly simplistic Role-Based access control (RBAC) where the service authenticates the user (via some credentials, typically username/password) and returns a UserDetails…
-
Implement the Envelope Wrapper Pattern in C++ using Google Protocol Buffers
The Envelope Wrapper pattern This pattern, described in “Enterprise Integration Patterns” (Ch. 8, “The Envelope Wrapper”), is used typically in messaging systems, when a number of metadata fields (for routing, security, etc.) are kept in a header, while the data used by service endpoints is serialized in a payload. For the system to be generically…
-
Support multiple JDKs in Debian Linux
With the relatively recent change in the frequency of Java releases (every six months) it has become pretty much required to be able to have multiple JDKs on one’s development machine, and being able to run/test them at different times, for different projects, or even for the same project. Motivation While some wizardry with symlinks…
-
Parse Args in Bash Scripts
There is something to be said for the immediacy of using Bash scripts, especially when dealing with relatively simple system operations; however, parsing command line arguments has always been rather cumbersome and usually done along the lines of painful if [[ ${1} == ‘–build’ ]]; then …. On the other hand, Python is pretty convenient…