Skip to content

Instantly share code, notes, and snippets.

View jabbate19's full-sized avatar

Joe Abbate jabbate19

  • Computer Science House
  • Rochester Institute of Technology
View GitHub Profile
@jabbate19
jabbate19 / wumbo.rs
Created September 7, 2023 15:17
Windows Service Integration in Rust w/ C API
use windows_sys::Win32::{
System::{
Services::{SERVICE_STATUS, ControlService, OpenServiceA, SC_MANAGER_ALL_ACCESS, SERVICE_STATUS_PROCESS, ENUM_SERVICE_STATUS_PROCESSA, OpenSCManagerA, EnumServicesStatusExA, SC_ENUM_PROCESS_INFO, SERVICE_STATE_ALL, SERVICE_WIN32, SC_MANAGER_ENUMERATE_SERVICE, SC_MANAGER_CONNECT}
},
Foundation::GetLastError
};
use anyhow::{anyhow, Result};
use std::{
ffi::{CStr, CString},
ptr::null
from websocket import create_connection
import json
template = [1,1,"3 OR "]
table_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890_"
data_chars = table_chars + "-/:;()$&@\"\\[]{}#%^*+=|~<>€£¥•.,?!'"
def send_test(ws, test):
test_arr = template[:]
test_arr[2] += test
ws.send(json.dumps(test_arr))
r = ws.recv()
#define WIN32_LEAN_AND_MEAN
#include "stdio.h"
#include "winsock2.h"
#include "ws2tcpip.h"
#include "Mstcpip.h"
// Need to link with Ws2_32.lib
#pragma comment (lib, "Ws2_32.lib")
BNO055IMU.Parameters parameters = new BNO055IMU.Parameters();
parameters.angleUnit = BNO055IMU.AngleUnit.RADIANS;
parameters.accelUnit = BNO055IMU.AccelUnit.METERS_PERSEC_PERSEC;
parameters.calibrationDataFile = "BNO055IMUCalibration.json"; // see the calibration sample opmode
parameters.loggingEnabled = true;
parameters.loggingTag = "IMU";
parameters.accelerationIntegrationAlgorithm = new JustLoggingAccelerationIntegrator();
imu = hardwareMap.get(BNO055IMU.class,"imu");
imu.initialize(parameters);
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot.subsystems;
import java.util.function.DoubleSupplier;
import com.ctre.phoenix.motorcontrol.NeutralMode;
import com.ctre.phoenix.motorcontrol.TalonSRXFeedbackDevice;
/**
* This is a very simple robot program that can be used to send telemetry to
* the data_logger script to characterize your drivetrain. If you wish to use
* your actual robot code, you only need to implement the simple logic in the
* autonomousPeriodic function and change the NetworkTables update rate
*/
package dc;
import java.util.function.Supplier;
Imgproc.cvtColor( input, input, Imgproc.COLOR_RGB2HSV );
Core.inRange( input, new Scalar( hueMin, satMin, valMin ),
new Scalar( hueMax, satMax, valMax ), input );
Mat target = input.submat( new Rect( topLeft, bottomRight ) );
double avg = (int) Core.mean( target ).val[ 0 ];
Imgproc.rectangle( input, topLeft, bottomRight, new Scalar( 0, 250, 0 ), 2 );
var questions = ["What is your team number?"];
var teams = [];
var teamData = [];
var activeQ = 0;
var activeInt = [];
var activeTeamData = ["N/A"];
//updateAll();
onEvent("questionBtn", "click", function(event) {
setScreen("questions");
activeQ = 0;
@jabbate19
jabbate19 / hs_err_pid32073.log
Created January 27, 2020 23:37
Crash on Robot Boot
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0xb6940dec, pid=32073, tid=32076
#
# JRE version: OpenJDK Runtime Environment (11.0.4.10) (build 11.0.4.10-frc+0-2020-11.0.4u10-2)
# Java VM: OpenJDK Client VM (11.0.4.10-frc+0-2020-11.0.4u10-2, mixed mode, concurrent mark sweep gc, linux-)
# Problematic frame:
# V [libjvm.so+0x13cdec]
#