Skip to content

Instantly share code, notes, and snippets.

@bdemers
bdemers / default.adoc
Last active February 6, 2024 20:23
GitHub + AsciiDoc

Default styling

Tip
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Note
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Caution
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Warning
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
@bdemers
bdemers / TokenViewerApplication.java
Created November 18, 2020 21:33
Simple Spring Access Token Tool
@SpringBootApplication
public class TokenViewerApplication {
public static void main(String[] args) {
SpringApplication.run(TokenViewerApplication.class, args);
}
@RestController
static class TokenController {
@bdemers
bdemers / content.md
Last active August 26, 2020 16:59
Amazon Drive Update

Dear Customer,

We’re writing to let you know about an upcoming change that may affect how you access your content on Amazon Drive, and to help you take steps to keep your content safe.

We understand that you have used Synology Cloud Sync or Hyper Backup on Synology NAS to store information on Amazon Drive.

Amazon will discontinue access to Amazon Drive by Synology Cloud Sync and Hyper Backup starting on November 1st, 2020. Neither application will have access to Amazon Drive after November 1st, 2020, and the only way you will be able to access your stored content will be via Amazon Drive or Amazon Photos web, desktop, and mobile apps.

To ensure a smooth transition, we urge all Synology Cloud Sync and Hyper Backup users to follow these steps:

20.0.0.r11-grl
#!/usr/bin/env bash
echo "RENEWED_LINEAGE: ${RENEWED_LINEAGE}"
# requires `yq` and `jq` cli tools
OKTA_API_TOKEN=$(yq --raw-output .okta.client.token ~/.okta/okta.yaml)
API_URL="${1}/api/internal/v1/custom-url-domain/certificate"
CERT=$(cat "${RENEWED_LINEAGE}/cert.pem")
KEY=$(cat "${RENEWED_LINEAGE}/privkey.pem")
CHAIN=$(cat "${RENEWED_LINEAGE}/chain.pem")
@bdemers
bdemers / README.md
Created April 20, 2020 13:52
IntelliJ Live Templates

Preferences -> Editor -> Live Templates

@bdemers
bdemers / SomeTest.java
Last active April 10, 2020 19:45
TestNG + Mockito + PowerMock
import org.powermock.core.classloader.annotations.PrepareForTest
import org.powermock.modules.testng.PowerMockObjectFactory
import org.testng.IObjectFactory
import org.testng.annotations.ObjectFactory
import org.testng.annotations.Test
import static org.mockito.Mockito.*
import static org.powermock.api.mockito.PowerMockito.mockStatic
@PrepareForTest(AStaticClass.class)
public class SomeTest {
package org.jetbrains.kotlin.maven;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;
import java.io.File;
@bdemers
bdemers / AppExample.java
Created October 11, 2019 17:37
Create and Parse JWTs in Java with JJWT
package com.okta.developer;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jws;
import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.security.Keys;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.Base64;
@bdemers
bdemers / Wrapper.java
Created October 4, 2019 21:52
Wrap Beans
@Bean
BeanPostProcessor delegateForFoo() {
return new WrappingBeanPostProcessor<>(Foo.class, original -> new MyCustomFoo(original));
}
public class WrappingBeanPostProcessor<T> implements BeanPostProcessor {
private final Class<T> type;
private final UnaryOperator<T> beanCreator;