Skip to content

Instantly share code, notes, and snippets.

View dzil123's full-sized avatar

Daniel Z. dzil123

  • California, US
  • 05:17 (UTC -07:00)
View GitHub Profile
@dzil123
dzil123 / settings.json
Created October 18, 2018 01:38
VSCode settings.json to go in .vscode/ to hide all non-code folders in the Explorer panel for FTC Java
{
"java.configuration.updateBuildConfiguration": "automatic",
"files.exclude": { // Hide files in Explorer panel
"**/.git": true, // Default excluded
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
package frc.robot.util;
public class Deadband {
private double minValue;
private double m;
private double deadband;
public Deadband(double minValue, double deadband) {
this.minValue = minValue;
m = calcM(minValue, deadband);
import cv2
import numpy
import math
from enum import Enum
class GripPipeline:
"""
An OpenCV pipeline generated by GRIP.
"""
# Maintainer: Ray Rashif <schiv@archlinux.org>
# Contributor: Tobias Powalowski <tpowa@archlinux.org>
pkgbase=opencv344
pkgname=(opencv344 opencv344-samples)
pkgver=3.4.4
pkgrel=1
pkgdesc="Open Source Computer Vision Library"
arch=(x86_64)
license=(BSD)
@dzil123
dzil123 / requirements.txt
Last active July 2, 2022 10:49
Interactive web app without javascript; using css and long polling to dynamically update the page. async, ASGI. Built using Starlette framework and Uvicorn server
# back when i wrote this i didnt add any version info
# so i wasnt able to run it almost a year later
# anyway heres last working versions as of 04/14/2020
# python 3.8.2
starlette==0.11.4 # old, Mar 18, 2019
uvicorn==0.11.3 # this is the newest at time of writing
@dzil123
dzil123 / cam.py
Last active August 7, 2019 07:31
import asyncio
from typing import AsyncGenerator, Dict, List, Tuple
import cv2
import uvicorn
from starlette.applications import Starlette
from starlette.responses import HTMLResponse
# -----------------------------------------------------------------------------
# Reusable ASGI framework
@dzil123
dzil123 / args.py
Created August 6, 2019 17:43
Reference the value of other arguments in your function definitions
import functools
import inspect
import itertools
import typing
class Arg(typing.NamedTuple):
name: str
import multiprocessing as mp
import numpy as np
# Create a np.ndarray that can be shared across processes
# Array.np and Array.arr point to the same memory
# This memory is shared between the processes
# And mp.RawArray can be sent to a new spawned process
class Array:
import threading
import queue
import time
class Program:
def __init__(self):
self.queue = queue.Queue()
self.pipeline = Pipeline(self)
self.web = Webserver(self)
@dzil123
dzil123 / ShuffleboardRGB.java
Last active January 10, 2020 18:47
A way to show arbitrary RGB colors on Shuffleboard. Intended for use with the REV Color Sensor.
import edu.wpi.first.wpilibj.shuffleboard.BuiltInWidgets;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardContainer;
import edu.wpi.first.wpilibj.shuffleboard.SuppliedValueWidget;
import edu.wpi.first.wpilibj.util.Color;
import java.util.Map;
public class ShuffleboardRGB {
public final SuppliedValueWidget<Boolean> widget;
private static final String offStr = "Color when false";