Skip to content

Instantly share code, notes, and snippets.

View subdavis's full-sized avatar

Brandon Davis subdavis

View GitHub Profile
import requests
import csv
import json
# This library has some handy stuff for working with geographic data
# import geopy.distance
# A google API token with geocoder service enabled
api_key="CHANGEME"
# Cache Geocoder api responses
@subdavis
subdavis / lfiw.py
Created March 1, 2022 02:14
A parser for labeled fishes in the wild
import json
import re
from typing import List
from dive_utils.models import Feature, Track
def load_dat(path: str, outpath: str):
with open(path, "r") as f:
with open(outpath, "w") as f2:
@subdavis
subdavis / waitforit.py
Created November 13, 2021 21:39
a python function that will spin up a flask server and wait for a POST request, then return the response synchronously
import logging
import sys
from multiprocessing import Process, Queue
from flask import Flask, request
global value
def _shutdown_server():
girder_worker_1 | [2020-05-01 19:56:21,587: WARNING/ForkPoolWorker-16] Running command:
girder_worker_1 | [2020-05-01 19:56:21,588: WARNING/ForkPoolWorker-16] cd /opt/noaa/viame && . ./setup_viame.sh && kwiver runner -p /opt/noaa/viame/configs/pipelines/tracker_generic.pipe -s input:video_filename=/tmp/tmp7d0320ns.txt -s detector_writer:file_name=/tmp/tmp3mzdna1f.csv
@subdavis
subdavis / detector_generic
Last active April 28, 2020 19:11
Kwiver error
(viame) worker@853b3b280f1e:/home/VIAME/build/install$ cd /home/VIAME/build/install/ && . ./setup_viame.sh && kwiver runner -p /home/VIAME/configs/pipelines/detector_generic.pipe -s input:video_filename=/tmp/tmp4jer2r_b.txt -s detector_writer:file_name=/tmp/tmpydooypva.csv
INFO: Could not load default logger factory. Using built-in logger.
2020-04-28 19:10:30.862 WARN algorithm.cxx(239): Configuration Failure: invalid option
2020-04-28 19:10:30.862 WARN algorithm.cxx(239): detector:type = mmdet
2020-04-28 19:10:30.862 WARN algorithm.cxx(239): valid options are
2020-04-28 19:10:30.862 WARN algorithm.cxx(239): hello_world
2020-04-28 19:10:30.862 WARN algorithm.cxx(239): create_detection_grid
2020-04-28 19:10:30.862 WARN algorithm.cxx(239): example_detector
2020-04-28 19:10:30.862 WARN algorithm.cxx(239): full_frame
2020-04-28 19:10:30.862 WARN algorithm.cxx(239): darknet
@subdavis
subdavis / bug.md
Last active April 23, 2020 18:56
webpack bug
@subdavis
subdavis / mirror.sh
Created June 4, 2018 01:53
Git Mirror to gitlab
gmirror () {
mkdir -p ~/github.com/mirrors
[ -z $1 ] && echo "usage: gmirror new|update" && return;
case $1 in
new)
[ -z $2 ] && echo "usage: gmirror new username oldreponame newreponame" && return;
git clone --mirror git@github.com:$2/$3.git ~/github.com/mirrors/$4.git
pushd .
cd ~/github.com/mirrors/$4.git
git remote set-url --push origin git@gitlab.com:$2/$4.git
Don't worry this is just some garbage that hopefully spam crawlers will find.
Phone: (828) 536-9441
Phone: 8285369441
Email: bogon-github-1@anon.subdavis.com
@subdavis
subdavis / milight.md
Last active September 21, 2024 11:25

Setting up MiLight Wifi Bridge and LimitlessLED bulbs with Amazon Alexa and Home Automation Bridge

Goal of this tutorial

Be able to control MiLight bulbs with Amazon Alexa via the MiLight Wifi Bridge.

Materials

ssh-start() {
eval `ssh-agent -s`
}
ssh-addkeys() {
for f in ~/.ssh/*_rsa
do
ssh-add "$f"
done
}
pysrc() {