This file contains 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 APIFetch extends Component { | |
constructor(props){ | |
super(props) | |
this.state = { | |
data: null, | |
isError: false, | |
isFetching: true | |
} | |
} | |
This file contains 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
const fetchHOC = (WrappedComponent, fetchPath, optionalHeader) => { | |
return class extends Component { | |
constructor(props){ | |
super(props) | |
this.state = { | |
data: null, | |
isError: false, | |
isFetching: true | |
} | |
} |
This file contains 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 { google } from 'googleapis'; | |
import { auth } from 'google-auth-library' | |
export default class getModel { | |
modelName: string; | |
projectName: string; | |
constructor(attrs) { | |
this.modelName = attrs.modelName | |
this.projectName = attrs.projectName |
This file contains 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
// extension of classical overwriting ring buffer that holds an incremental counter that can be indexed | |
// this should not be used for read heavy write infrequent streams (as a map would be a much mor effective implementation) | |
// this could be used for write heavy read infrequent streams | |
export class OverwritingRingBuffer<T> { | |
private buffer: T[]; | |
private bufferLength: number; | |
private pointer: number; | |
private counter: number; |
This file contains 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 cv2 | |
import time | |
import numpy as np | |
from threading import Thread | |
from queue import Queue | |
log_const = 30 | |
This file contains 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 cv2 | |
import time | |
import numpy as np | |
import multiprocessing as mp | |
log_const = 30 | |
class FPS: |
This file contains 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
from shared import camera_producer, cpu_bound, display | |
def main(): | |
frames = camera_producer() | |
cpu_bound_op = cpu_bound() | |
for frame in frames: | |
cpu_bound_op(frame) | |
display(frame) |
This file contains 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
from queue import Queue | |
from threading import Thread | |
from typing import cast | |
import asyncio | |
import janus | |
# note that this will never cleanup the thread. You will need to implement your own shutdown logic / methods. | |
def sync_to_async_queue(queue: Queue, loop: asyncio.AbstractEventLoop) -> asyncio.Queue: | |
conversion_queue: janus.Queue = janus.Queue(loop=loop) |
This file contains 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
from queue import Queue | |
from threading import Thread | |
class KillSignal: | |
pass | |
class QueuePipe: | |
def __init__(self, queue_in: Queue, queue_out: Queue) -> None: |
This file contains 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
from queue import Queue, Empty | |
from threading import Thread | |
from typing import Any | |
import time | |
class Ticker: | |
_alive = True | |
_q = Queue() | |
_stop_q = Queue() |
OlderNewer