Skip to content

Instantly share code, notes, and snippets.

Avatar
💻

Theo Lemay theol0403

💻
  • Canada
View GitHub Profile
View improved-combo-auto-mod.c
# 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);
View init.vim
"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}
View flywheel angler.cpp
/**
* 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)) {
View settings.json
{
// "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 Mar 21, 2020
Windows terminal with materialshell scheme
View config.json
// 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":
[
View controllerPrinter.cpp
#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;
}
View hyper.js
// 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 Sep 8, 2019
V5 Controller printing utility
View controller_print.cpp
// 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*){
@theol0403
theol0403 / FlywheelImplementation.cpp
Last active Aug 20, 2019
7842F Flywheel Control System
View FlywheelImplementation.cpp
#include "main.h"
#include "pidVelSystem.hpp"
Motor flywheel(1);
double flywheelRatio = 15;
velPID pid(0.35, 0.05, 0.045, 0.9);
emaFilter rpmFilter(0.15);
double motorSlew = 0.7;
double targetRPM = 0;
@theol0403
theol0403 / JREPL.BAT
Created Aug 17, 2019
Vision Sensor signature conversion script
View JREPL.BAT
@if (@X)==(@Y) @end /* Harmless hybrid line that begins a JScript comment
@goto :Batch
::JREPL.BAT by Dave Benham
::/History
::
:: 2018-10-20 v7.15: Add a string literal syntax to the /INC and /EXC options.
:: 2018-10-15 v7.14: Bug fix - User defined variables declared in /JBEG named
:: str and/or obj were getting clobbered.
:: Bug fix - Internal variable xbytes was visibile to user