Skip to content

Instantly share code, notes, and snippets.

// Compare IGroupable (with a type parameter) here with IGroupableX below (without a type argument).
// In what situation will the generics version buy you something that the non-generic version won't.
interface IGroupable<E extends IGroupable<E>> {
E fraction(double fraction);
public static class AlphaGroupable implements IGroupable<AlphaGroupable> {
@Override
public AlphaGroupable fraction(double fraction) { return null; }
}

This page describes the flow of requests, tokens etc. when using the Okta sign-in widget with a backend (such as Spring Boot) that's configured for OAuth2 based authentication.

Okta Login flow

If I have a web-app running on myapp.mycompany.com and an Okta organization running on dev-993392.oktapreview.com then there are 3 actors involved in the login flow:

  • The server that serves up the myapp.mycompany.com pages.
  • Browser pages with origin myapp.mycompany.com.
  • Browser pages with origin dev-993392.oktapreview.com

Below is page 2 of the Routledge Frequency Dictionary of German. This screenshot was taken using the "Look inside" feature of the Amazon product page for this book. The dictionary says it is based off the Leipzig/BYU Corpus of Contemporary German. Googling for information on this corpus turns up little or nothing.

Leipzig make available various corpora here but neither it nor Brigham Young University seem to have any web content related to something called the "Corpus of Contemporary German".

The dictionary says the corpus brings together words from spoken language, literature, newspapers, academic texts and instructional language. So the dictionary claims to use a broad based corpus and as its full title is "A Frequency Dictionary o

#!/bin/bash
DRIVERS_DIR=/sys/bus/pci/drivers
# George Hawkins Nov 18th, 2014
# I found various scripts that bind and unbind the USB devices to reset the whole USB system.
# All used hardcoded slots and drivers - slots aren't consistent across machines and driver names change with OS releases.
# This script attempts to discover all values.
# This awk script finds all PCI devices with class 'USB controller' that have a slot and a driver.

Accessing Okta accounts etc. in Java

If you've already followed the Getting Started With Okta document from Stormpath then you should already have a Spring Boot application where users can login.

However if you try to interogate the system e.g. for all accounts you'll quickly find out that most of the methods provided by Application, such as getAccounts(), throw UnsupportedOperationException.

Another way to get at this data is via the Okta Java SDK.

By default this SDK uses a different mechanism to pickup the Okta API token etc. to the one used by the Okta compatible version of the Stormpath Spring Boot SDK.

[Unit]
Description=Broadcast triggered shutdown
After=network.target
# To install:
# $ sudo apt-get install socat
# $ sudo chown root:root broadcast-shutdown.service
# $ sudo mv broadcast-shutdown.service /etc/systemd/system
# $ sudo systemctl daemon-reload
# $ sudo systemctl enable broadcast-shutdown
@george-hawkins
george-hawkins / ResolveArgumentTest.java
Created February 1, 2017 15:59
ServletRequestMethodArgumentResolver issue
package com.example;
import java.lang.reflect.Method;
import java.security.Principal;
import org.junit.Assert;
import org.junit.Test;
import org.springframework.core.MethodParameter;
import org.springframework.security.core.Authentication;
@george-hawkins
george-hawkins / arm64.md
Last active March 24, 2024 14:36
Running virtualized x86_64 and emulated arm64 Ubuntu cloud images using QEMU

QEMU arm64 cloud server emulation

This is basically a rehash of an original post on CNXSoft - all credit (particularly for the Virtio device arguments used below) belongs to the author of that piece.

Download the latest uefi1.img image. E.g. ubuntu-16.04-server-cloudimg-arm64-uefi1.img from https://cloud-images.ubuntu.com/releases/16.04/release/

Download the UEFI firmware image QEMU_EFI.fd from https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/

Determine your current username and get your current ssh public key: