Skip to content

Instantly share code, notes, and snippets.

View neatorobito's full-sized avatar

Mark neatorobito

  • 03:18 (UTC -07:00)
View GitHub Profile
@neatorobito
neatorobito / buildFence.ts
Last active August 19, 2022 20:16
Empire State Building Fence
// Listen for fence events.
Perimeter.addListener("FenceEvent", (event: FenceEvent`) => {
console.log(event.fences[0].name);
});
// Create a fence.
let newFence : Fence = {
name : "Empire State Building",
uid : "123456789",
payload: "Here is some data for later.",
@neatorobito
neatorobito / minheap.cr
Last active December 1, 2020 04:37
MinHeap in Crystal
class MinHeap(T)
# Actual heap
@elements = Array(T).new
# Map of Objects -> Locations
@locs = Hash(T, Int32).new
# Look at the top of the heap without removing the element.
def peek? : T | Nil
empty? ? nil : @elements.first
end
@neatorobito
neatorobito / State.Service.ts
Created May 26, 2020 02:51
State Management for Vue based on almy
import _Vue from 'vue';
export namespace StateService
{
export const StorePlugin = {
install(Vue : typeof _Vue, options : { stateModel : any })
{
let store = new Store();
@neatorobito
neatorobito / almy.d.ts
Created December 14, 2019 17:34
Typescript definitions for the almy library
export = almy;
declare const almy: {
almy: {
/**
* Re-initializes the state store.
* @returns None
*/
create(): void;
@neatorobito
neatorobito / v2.directus.captainDefinition
Last active September 17, 2019 22:15
Directus Captain Definition
{
"captainVersion": "2",
"documentation": "Taken from https://github.com/directus/docker.",
"dockerCompose": {
"version": "7",
"services": {
"$$cap_appname-db": {
"image": "mysql:5.7",
"notExposeAsWebApp": "true",
"volumes": [
@neatorobito
neatorobito / metabase.Dockerfile
Created September 14, 2019 02:14
Metabase Dockerfile
FROM openjdk:8-jre-slim
ENV VERSION 0.33.2
WORKDIR /app
ADD https://raw.githubusercontent.com/metabase/metabase/v$VERSION/bin/start /app/bin/
ADD http://downloads.metabase.com/v$VERSION/metabase.jar /app/target/uberjar/
EXPOSE 3000
@neatorobito
neatorobito / cockpit.captainDefinition
Created September 14, 2019 02:14
Cockpit CMS Captain Definition
{
"captainVersion": "2",
"documentation": "Taken from https://hub.docker.com/r/agentejo/cockpit/",
"dockerCompose": {
"version": "7",
"services": {
"$$cap_appname": {
"image": "agentejo/cockpit",
"restart": "always",
import PID, time, math
class FlightVector(object):
x = 0
y = 0
z = 0
def __init__(self, x, y, z):
self.x = float(x)
self.y = float(y)
@neatorobito
neatorobito / Hover.py
Last active November 17, 2017 22:28
ArduPilot PID Override
import time
from dronekit import VehicleMode, connect
import os
from PID import PID
vehicle = connect("/dev/serial/by-id/usb-3D_Robotics_PX4_FMU_v2.x_0-if00")
# vehicle = connect("tcp:127.0.0.1:5760")
MAX_THROTTLE = vehicle.parameters['RC3_MAX']
MIN_THROTTLE = vehicle.parameters['RC3_MIN']