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 asyncio | |
import os | |
from contextlib import asynccontextmanager | |
from typing import Any | |
import sqlalchemy as sa | |
from dependency_injector import providers | |
from dependency_injector.containers import DeclarativeContainer | |
from dependency_injector.wiring import Provide, inject | |
from fastapi import APIRouter, Depends, FastAPI |
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 asyncio | |
import os | |
from contextlib import asynccontextmanager | |
import sqlalchemy as sa | |
from dependency_injector import providers | |
from dependency_injector.containers import DeclarativeContainer | |
from dependency_injector.wiring import Provide, inject | |
from fastapi import Depends, FastAPI | |
from sqlalchemy.ext.asyncio import ( |
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
# Build stage | |
FROM node:16 as build | |
WORKDIR /src | |
COPY . ./ | |
RUN corepack enable | |
RUN yarn install --immutable | |
RUN yarn run web:build:prod |
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
#include <Arduino.h> | |
#include <MsgPacketizer.h> | |
#define SERIAL_SPEED 500000 | |
#define MSGPACK_RECV_INDEX 0x01 | |
#define MSGPACK_SEND_INDEX 0x02 | |
#define SERIAL_PORT Serial1 | |
struct ServoCommand { | |
float left; |
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 re | |
from dataclasses import dataclass, field | |
from mcap.reader import make_reader | |
from mcap_ros2.decoder import DecoderFactory | |
from heapq import heappush, heappop | |
from pathlib import Path | |
PATH = "stereo_calib.mcap" |
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
obj-m += vxcan.o | |
all: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) modules | |
clean: | |
make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean |
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 odrive.pyfibre.fibre.libfibre import * | |
import select | |
tasks = [] # time, callback, args... | |
now = time.perf_counter | |
# super stupid "event loop" implementation | |
def spin(): | |
for _ in range(10): | |
delete = [] |
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
#!/bin/bash | |
# Miminum delay between iterations, in seconds | |
delay=10 | |
# Pairs of [bluetooth MAC, test expression] | |
targets=( | |
"98:B6:E9:47:F0:4F" "test ! -e /dev/input/js0" | |
"98:B6:E9:72:6C:31" "test -z \"\$(bluetoothctl info 98:B6:E9:72:6C:31 | grep 'Connected: yes')\"" | |
) |
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 matplotlib.pyplot as plt | |
from matplotlib.lines import Line2D | |
import numpy as np | |
def plot_grad_flow(model): | |
ave_grads = [] | |
max_grads = [] | |
layers = [] | |
for name, param in model.named_parameters(): |
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 urllib.parse as urlparse | |
from envparse import Env | |
import json as pyjson | |
import warnings | |
import os | |
def shortcut(cast): | |
# Fix: `default` kwarg is always second argument | |
# So you can do `env.whatever('KEY', 'DEFAULT')` |
NewerOlder