This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CompressedGene: | |
def __init__(self, gene: str) -> None: | |
self._compress(gene) | |
def _compress(self, gene: str) -> None: | |
self.bit_string = 1 # start with sentinal | |
for nucleotide in gene.upper(): | |
self.bit_string <<= 2 # shift left 2 mits | |
if nucleotide == "A": | |
self.bit_string |= 0b00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.BitSet | |
import scala.collection.mutable | |
case class CompressedGene(nucleotideCount: Int, bits: BitSet) { | |
override def toString(): String = CompressedGene.decompress(this) | |
} | |
object CompressedGene { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.reactivex.Observable; | |
import java.util.function.Supplier; | |
/** | |
* Wrapper around a Supplier (intended to be making remote service request), | |
* that will attempt to retry a request if an exception occurs. | |
* | |
* @author Brian Schlining | |
* @since 2019-04-24T13:54:00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This function takes a page, which defines the limit and offset | |
// and makes the web service call using that limit/offset | |
Function<RequestPager.Page, List<MyObject>> function = (page) -> { | |
try { | |
return service.someApiCall(page.getLimit(), page.getOffset()) | |
.get(timeout.toMillis(), TimeUnit.MILLISECONDS); | |
} catch (Exception e) { | |
throw new RuntimeException("A page request failed", e); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.reactivex.Observable; | |
import io.reactivex.subjects.PublishSubject; | |
import io.reactivex.subjects.Subject; | |
import java.util.ArrayList; | |
import java.util.List; | |
import java.util.concurrent.*; | |
import java.util.concurrent.atomic.AtomicInteger; | |
import java.util.function.Function; | |
import java.util.function.Supplier; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
from dataclasses import dataclass | |
from typing import List | |
__author__ = "Brian Schlining" | |
__copyright__ = "Copyright 2019, Monterey Bay Aquarium Research Institute" | |
@dataclass | |
class Camera: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
for server in "[email protected]" "[email protected]" "[email protected]" | |
do | |
echo "--- Deploying and starting Annosaurus at ${server}" | |
ssh $server <<'ENDSSH' | |
docker pull mbari/annosaurus:latest | |
docker stop annosaurus |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Material desing #400 series of colors https://www.materialui.co/colors | |
[aws] | |
symbol = " " | |
[battery] | |
full_symbol = "" | |
charging_symbol = "" | |
discharging_symbol = "" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |