Skip to content

Instantly share code, notes, and snippets.

# I keep all my config settings in .bashrc.
# .bash_profile redirects there
if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi
import datetime
import json
import sys
import requests
# This example uses mock data. But it outlines the general steps needed.
# If you have a lot of images, they can all be registered in a single
# POST request, but you will need to build a JSON array of data first.
# The details of this bulk load are NOT covered in this example
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.net.http.HttpResponse.BodySubscriber;
import java.net.URI;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.concurrent.CompletableFuture;
@hohonuuli
hohonuuli / vars_extract.py
Last active April 20, 2020 21:45
Script to automate extraction of annotated video frames from VARS/M3
from datetime import datetime, timedelta
from typing import List, Dict
import iso8601
import requests
import subprocess
import sys
__author__ = "Brian Schlining"
__copyright__ = "Copyright 2018, Monterey Bay Aquarium Research Institute"
@hohonuuli
hohonuuli / register_video.py
Last active August 29, 2018 20:39
MBARI Media Management - Demonstrate how to register a video in the `vampire-squid` video asset manager
import datetime
import json
import sys
import requests
host = "http://localhost:8084"
client_secret = "foo"
@hohonuuli
hohonuuli / Dockerfile
Created May 11, 2018 20:05
Dockerfile for a scipy setup using jupyter
FROM ubuntu
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
curl \
cmake \
&& rm -rf /var/lib/apt/lists/*
RUN curl -qsSLkO \
@hohonuuli
hohonuuli / csiro.txt
Last active February 28, 2018 05:18
Dumping ground to share info between networks
>> ffprobe -loglevel quiet -show_streams -show_format -show_error -print_format json C01_2017_S027_S003_T002.MOV
# NOTES: File looks good. Has creation-time atom
{
"streams": [
{
"index": 0,
"codec_name": "pcm_s24le",
"codec_long_name": "PCM signed 24-bit little-endian",
"codec_type": "audio",
"codec_time_base": "1/48000",
@hohonuuli
hohonuuli / BudgetPlot.scala
Created December 19, 2017 22:26
Scala class for medium article
import java.time.{Duration, Instant}
object BudgetPlot extends App with scalax.chart.module.Charting {
val budget = CurrentBudget
val endDate = Instant.now.plus(Duration.ofDays(365))
def filter(s: Stream[Transaction]): Stream[Transaction] = s.takeWhile(i => i.date.isBefore(endDate))
val timeseries = new BudgetTimeSeries
budget.events
@hohonuuli
hohonuuli / BudgetTimeSeries.scala
Last active December 19, 2017 23:39
Scala class for Medium article
import java.time.Instant
import scala.collection.mutable
import scilube.Matlib
class BudgetTimeSeries {
private[this] val series = new mutable.TreeMap[Instant, Double]
def addToSeries(events: Seq[Transaction]): Unit = {
@hohonuuli
hohonuuli / BudgetApp.scala
Last active December 19, 2017 22:10
Scala class for Medium article
import java.time.{Duration, Instant}
object BudgetApp extends App {
val budget = CurrentBudget
val endDate = Instant.now.plus(Duration.ofDays(365))
def filter(s: Stream[Transaction]): Stream[Transaction] = s.takeWhile(i => i.date.isBefore(endDate))
def money(s: Stream[Transaction]): Double = s.last.accumulatedValue
val sum = budget.events.map(_.stream) // Convert each transaction into a stream