Skip to content

Instantly share code, notes, and snippets.

View fathomnet_minimal_example.txt
concept,image,x,y,width,height
Nanomia bijuga,http://dsg.mbari.org/path/image.png,10,20,30,40
Rock,http://dsg.mbari.org/path/image.png,21,22,23,24
@hohonuuli
hohonuuli / VocParser.scala
Last active Mar 15, 2021
Scala VOC parser. For Medium article
View VocParser.scala
import scala.xml.Elem
object VocParser {
def parse(xml: Elem): Voc = {
val filename = (xml \ "filename").text
val objects = xml \ "object"
val vocObjects = objects.map(n => {
val name = (n \ "name").text
// VOC is 1-based index. Convert to 0 based.
@hohonuuli
hohonuuli / VOC.scala
Last active Mar 15, 2021
Pascal VOC modeled in Scala. For medium article
View VOC.scala
case class Voc(
filename: String,
objects: Seq[VocObject] = Nil
)
case class VocObject(
name: String,
xmin: Int,
ymin: Int,
xmax: Int,
@hohonuuli
hohonuuli / pascal_vox_sample.xml
Last active Mar 16, 2021
Example Pascal VOC file
View pascal_vox_sample.xml
<annotation>
<filename>left_2019-11-04T16.59.22.762426Z.jpg</filename>
<object>
<name>Outer filter</name>
<bndbox>
<xmin>738</xmin>
<ymin>39</ymin>
<xmax>831</xmax>
<ymax>130</ymax>
</bndbox>
@hohonuuli
hohonuuli / CirceDemo.sc
Created Jan 17, 2021
Example for medium article on Circe
View CirceDemo.sc
#!/usr/bin/env amm
import $ivy.`io.circe::circe-core:0.13.0`
import $ivy.`io.circe::circe-generic:0.13.0`
import $ivy.`io.circe::circe-parser:0.13.0`
import io.circe._
import io.circe.generic.semiauto._
import io.circe.parser._
import io.circe.syntax._
@hohonuuli
hohonuuli / CirceDemo.json
Created Jan 17, 2021
Content for medium article on Circe
View CirceDemo.json
[
{
"uuid": "037fa69d-cc52-4d9c-90e1-68d12c455fbd",
"name": "My Name",
"blobs" : [
{
"uuid": "77bcfc71-1c2a-4872-b11d-501d65afd01a",
"url": "https://www.foo.bar/path/to/blob1",
"checksum": "MTIzNDU2Nzg5"
},
@hohonuuli
hohonuuli / FirebaseController.java
Last active Sep 19, 2020
Code for a Medium article
View FirebaseController.java
package firebase.jwt;
import javax.inject.Inject;
import com.google.firebase.auth.FirebaseAuthException;
import io.micronaut.http.HttpRequest;
import io.micronaut.http.annotation.*;
import io.micronaut.security.annotation.Secured;
import io.micronaut.security.authentication.UserDetails;
import io.micronaut.security.rules.SecurityRule;
@hohonuuli
hohonuuli / AuthHeader.java
Created Sep 18, 2020
Code for a Medium article
View AuthHeader.java
package firebase.jwt;
import java.util.Optional;
public class AuthHeader {
private final String type;
private final String token;
public AuthHeader(String type, String token) {
this.type = type;
@hohonuuli
hohonuuli / Firebase.java
Last active Sep 21, 2020
For Medium Article
View Firebase.java
package firebase.jwt;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.firebase.FirebaseApp;
import com.google.firebase.FirebaseOptions;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseAuthException;
import com.google.firebase.auth.FirebaseToken;
import io.micronaut.core.io.ResourceResolver;
import io.micronaut.core.io.scan.ClassPathResourceLoader;
View starship.toml
# Material desing #400 series of colors https://www.materialui.co/colors
[aws]
symbol = ""
[battery]
full_symbol = ""
charging_symbol = ""
discharging_symbol = ""