Skip to content

Instantly share code, notes, and snippets.

View mressler's full-sized avatar
Building the "Internet of Swings"

Michael Ressler mressler

Building the "Internet of Swings"
View GitHub Profile
@mressler
mressler / keybase.md
Created July 18, 2021 00:29
Keybase Verify

Keybase proof

I hereby claim:

  • I am mressler on github.
  • I am mressler (https://keybase.io/mressler) on keybase.
  • I have a public key ASD-V10t8CB6KmlntWPWuzq70c4WAsn7SghSJp-AnGB0mAo

To claim this, I am signing this object:

@mressler
mressler / spin_axis.py
Created May 22, 2019 16:06
Spin Axis to Spin Direction
def map_to_clock(spin_axis):
sp_x = spin_axis[0]
sp_z = spin_axis[2]
angle = np.arctan2(sp_z, sp_x)
angle_deg = angle / np.pi * 180
angle_clock = -angle_deg / 30.0 + 3.0
if angle_clock < 0:
angle_clock += 12
@mressler
mressler / Base64UrlCodec.java
Created November 6, 2017 22:23
Base64UrlEncoding
/*
* Copyright (C) 2014 jsonwebtoken.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mressler
mressler / SessionType.java
Last active January 30, 2019 19:30
sessionTypeUuid Disambiguation
package com.diamondkinetics.model.enums;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.diamondkinetics.model.json.SessionTypeSerializer;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(using = SessionTypeSerializer.class)
public enum SessionType {
@mressler
mressler / HttpTestServer.java
Created February 6, 2015 18:30
HttpTestServer Additions
import static org.junit.Assert.*;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.concurrent.Semaphore;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@mressler
mressler / gist:a2c082f75deb04ac367f
Created July 8, 2014 18:07
Type Erasure and Deserializing JSON Objects
public static class ProfileResponse extends ODataListValueDTO<UserProfileDTO> {}
// I was having a lot of difficulty getting Jackson to appropriately deserialize a complex
// data type due to type erasure. By creating an "as needed" class, I can avoid the type
// erasure problem and get an ODataListValueDTO<UserProfileDTO> as a result
ResponseEntity<ProfileResponse> profileResponse = template.exchange(
"http://localhost:8080/dummy",
HttpMethod.POST,
new HttpEntity<UserProfileDTO>(toSend, headers),
ProfileResponse.class);