Skip to content

Instantly share code, notes, and snippets.

View WardBenjamin's full-sized avatar

Benjamin Ward WardBenjamin

View GitHub Profile
@WardBenjamin
WardBenjamin / FindVcvars(from scikit-build).cmake
Last active November 30, 2022 23:49
Windows MSCV CMake Toolchain
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
FindVcvars
----------
Finds a "vcvars" batch script.
The module can be used when configuring a project or when running
_LibUSB.__init__(<WinDLL 'C:\Users\blward\Workspace\PRJ\AAHU\fusecast\lib\libusb-1.0.dll', handle 7ffc14540000 at 0x1df2b761d90>)
_LibUSB._finalize_object()
2019-11-23 17:03:14,430 DEBUG:usb.backend.libusb1:_LibUSB._finalize_object()
_LibUSB.__init__(<WinDLL 'C:\Users\blward\Workspace\PRJ\AAHU\fusecast\lib\libusb-1.0.dll', handle 7ffc14540000 at 0x1df2b761d90>)
2019-11-23 17:03:14,433 DEBUG:usb.backend.libusb1:_LibUSB.__init__(<WinDLL 'C:\Users\blward\Workspace\PRJ\AAHU\fusecast\lib\libusb-1.0.dll', handle 7ffc14540000 at 0x1df2b761d90>)
find(): using backend "usb.backend.libusb1"
2019-11-23 17:03:14,437 INFO:usb.core:find(): using backend "usb.backend.libusb1"
_LibUSB.enumerate_devices()
2019-11-23 17:03:14,437 DEBUG:usb.backend.libusb1:_LibUSB.enumerate_devices()
2019-11-23 17:03:14,457 DEBUG:usb.backend.libusb1:_LibUSB.get_device_descriptor(<usb.backend.libusb1._Device object at 0x000001DF2BAF64F0>)
import javafx.scene.transform.Affine;
import javafx.application.Platform;
def field = ScriptingEngine.gitScriptRun(
"https://github.com/WPIRoboticsEngineering/RBELabCustomParts.git", // git location of the library
"2002/2002 Field/2002 Field STL.STL" , // file to load
null
)
.rotx(-90)
.toXMin()
@WardBenjamin
WardBenjamin / deltaWeekCalculator.java
Created December 14, 2018 18:21
Calculate the number of weeks "between" two dates, inclusive.
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.DayOfWeek;
import java.time.LocalDate;
import java.time.ZoneId;
import java.time.temporal.TemporalAdjusters;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
@WardBenjamin
WardBenjamin / royalroadl_downloader.py
Created February 5, 2017 14:56
Crude RoyalRoadL downloader, replace XXXXXX with a fiction id
# -*- coding: utf-8 -*-
from urllib import request
from bs4 import BeautifulSoup
if __name__ == '__main__':
fiction_soup = BeautifulSoup(request.urlopen('http://royalroadl.com/fiction/XXXXXX'), "html.parser")
chapter_trs = fiction_soup.findAll('tr')
chapter_urls = []
@WardBenjamin
WardBenjamin / MinHeap.cs
Last active August 28, 2016 16:56
Fast generic minheap implementation
/// Simple pooling for Unity.
/// Author: Benjamin Ward ([email protected])
/// Latest Version: https://gist.github.com/WardBenjamin/991dfa64e94892924b67efe569e35050
/// License: CC0 (http://creativecommons.org/publicdomain/zero/1.0/)
/// UPDATES:
/// N/A
using System;
using System.Collections;
using System.Collections.Generic;
@WardBenjamin
WardBenjamin / TransformEXT.cs
Created June 26, 2016 22:46
Unity Transform extension method to make setting position less painful
using UnityEngine;
public static class TransformEXT
{
public static void SetPosition(this Transform transform, float x = float.NaN, float y = float.NaN, float z = float.NaN)
{
var pos = transform.position;
if (!float.IsNaN(x))
pos.x = x;
if (!float.IsNaN(y))