This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import tty | |
import termios | |
def user_input(prompt, default = None, sensitive = False, ret_type = str, required = True): | |
prompt_default = default | |
# if they provided a default, the input cannot be required | |
if default is not None: | |
required = False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function vi ($File){ | |
$File = $File -replace "\\", "/" -replace " ", "\ " | |
bash -c "vi $File" | |
} | |
function nano ($File){ | |
$File = $File -replace "\\", "/" -replace " ", "\ " | |
bash -c "nano $File" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <ModbusMaster.h> | |
#define MAX485_DE_RE 4 | |
ModbusMaster node; | |
void preTransmission() | |
{ | |
digitalWrite(MAX485_DE_RE, HIGH); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include <ModbusMaster.h> | |
#define MAX485_DE_RE 4 | |
#define OUTPUT_MOTOR_FREQ 0x0007 | |
#define DRIVE_STATUS 0x0006 | |
#define DRIVE_TEMP 0x0018 | |
ModbusMaster node; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"build": { | |
"arduino": { | |
"ldscript": "esp32c3_out.ld" | |
}, | |
"core": "esp32", | |
"extra_flags": [ | |
"-DARDUINO_LOLIN_C3_PICO", | |
"-DARDUINO_USB_MODE=1", | |
"-DARDUINO_USB_CDC_ON_BOOT=1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <Arduino.h> | |
#include "Animator.h" | |
Animator::Animator(){ | |
// nothing for now | |
} | |
void Animator::begin(Adafruit_SSD1306 *display, unsigned int width, unsigned int height, HardwareSerial* serial){ | |
_display = display; | |
_stream = serial; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from picamera import PiCamera | |
from picamera.array import PiRGBArray | |
import sys, curses, time, cv2 | |
import numpy as np | |
import warnings | |
import collections | |
# TODO: resolve these at some point | |
warnings.filterwarnings(action='ignore', message='Mean of empty slice') | |
warnings.filterwarnings(action='ignore', message='invalid value encountered in double_scalars') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void displayPositionedText(char* buf, int textSize, Position vpos, Position hpos) { | |
display.setTextSize(textSize); | |
int16_t x1, y1; | |
uint16_t w, h; | |
display.getTextBounds(buf, 0, 0, &x1, &y1, &w, &h); | |
int _vpos = 0, _hpos = 0; | |
switch (vpos) { | |
case CENTER: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- this was just a rapid development program for fun --> | |
<html> | |
<body> | |
<h1>Chutes and Ladders!</h1> | |
<button onclick="beginGame()">Play Game</button> | |
<img src="https://thumbs.dreamstime.com/z/s-board-games-chutes-ladders-woodbridge-new-jersey-october-circa-game-shown-128701391.jpg" /> | |
<script> | |
// general configs | |
var spin_min = 1, spin_max = 6; | |
var exact_space_win = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python | |
# coding: utf-8 | |
# This is a simple script to quickly switch between HMD mode and headless mode with Vive in SteamVR | |
# It uses symlinks to ensure that SteamVR will continue to run and always preserves the original files, | |
# This should be able to be rerun following updates (assuming the configs haven't structurally changes | |
# along with anything else) -- symlinks require running with elevated priviledges | |
import sys, os, ctypes, time, json, shutil | |
from winreg import QueryValueEx, HKEY_CURRENT_USER, OpenKey |
NewerOlder