Skip to content

Instantly share code, notes, and snippets.

View theol0403's full-sized avatar
💻

Theo Lemay theol0403

💻
View GitHub Profile
let axios = await require("@pipedreamhq/platform").axios;
function count(length) {
return Array.from({ length }, (_, i) => i + 1);
}
let days = count(7);
let hours = count(12);
let minutes = count(30);
@theol0403
theol0403 / customOdometry.cpp
Last active December 8, 2021 22:18
lib7842 unit test demo
#include "lib7842/api/odometry/customOdometry.hpp"
#include <cmath>
namespace lib7842 {
CustomOdometry::CustomOdometry(std::shared_ptr<ChassisModel> imodel,
const ChassisScales& ichassisScales) :
model(std::move(imodel)), chassisScales(ichassisScales) {}
void CustomOdometry::setScales(const ChassisScales& ichassisScales) {
# define NEW_RECORD(press) \
.event = { \
.key = {.col = 254, .row = 254}, \
.time = timer_read() | 1, \
.pressed = press, \
}
bool process_combo_key_release(uint16_t combo_index, combo_t *combo, uint8_t key_index, uint16_t keycode) {
// count the number of keys that were held down before
uint8_t count = __builtin_popcount(combo->state);
@theol0403
theol0403 / init.vim
Last active July 6, 2020 00:50
My vimrc
"plugins
function! Cond(Cond, ...)
let opts = get(a:000, 0, {})
return a:Cond ? opts : extend(opts, { 'on': [], 'for': [] })
endfunction
call plug#begin('~/.vim/plugged')
" essentials
Plug 'tpope/vim-repeat'
Plug 'tpope/vim-surround' "ys{motion}{type} ds{type} cs{type} v_S{type}
@theol0403
theol0403 / flywheel angler.cpp
Created May 7, 2020 20:18
flywheel control
/**
* Distance Control
*/
if(pDigital(DOWN)) {
robot.shooter->setDistanceToFlag(3.5_ft);
lastShootMacro = ShootController::shootMacros::off;
} else if(pDigital(LEFT)) {
robot.shooter->setDistanceToFlag(4.5_ft);
lastShootMacro = ShootController::shootMacros::off;
} else if(pDigital(UP)) {
@theol0403
theol0403 / settings.json
Last active April 26, 2020 23:47
vscode
{
// "C_Cpp.autocomplete": "Disabled",
"C_Cpp.default.cStandard": "c99",
"C_Cpp.default.cppStandard": "c++17",
"C_Cpp.errorSquiggles": "Disabled",
"C_Cpp.intelliSenseEngine": "Disabled",
"C_Cpp.autocomplete": "Disabled",
"C_Cpp.enhancedColorization": "Disabled",
"C_Cpp.updateChannel": "Insiders",
"cSpell.allowCompoundWords": true,
@theol0403
theol0403 / config.json
Created March 21, 2020 00:55
Windows terminal with materialshell scheme
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{0caa0dad-35be-5f56-a8ff-afceeeaa6101}",
"profiles":
[
@theol0403
theol0403 / controllerPrinter.cpp
Created December 24, 2019 18:00
ControllerPrinter
#include "controllerPrinter.hpp"
using namespace pros::c;
namespace lib7842 {
ControllerPrinter::ControllerPrinter() : task(taskFnc, this) {}
void ControllerPrinter::print(int line, std::string str, pros::controller_id_e_t id) {
lines[id].at(line) = str;
}
@theol0403
theol0403 / hyper.js
Created October 21, 2019 01:46
hyper config
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'canary',
@theol0403
theol0403 / controller_print.cpp
Last active September 8, 2019 07:37
V5 Controller printing utility
// arrays to store the three lines of text
std::array<std::string, 3> lines = {};
// used to compare with previous text to see if an update to the controller is needed
std::array<std::string, 3> lastLines = {};
// to print text, all you need to do is write to the `lines` array
// lines[lineNum] = "text";
void controller_print(void*){