Skip to content

Instantly share code, notes, and snippets.

View archishou's full-sized avatar

Archishmaan Peyyety archishou

  • 18:18 (UTC -05:00)
View GitHub Profile
def compute_tax(income):
tax = 0
def tax_income(rate, top_bound):
nonlocal income, tax
removed = income - max(income - top_bound, 0)
# print(removed, '\ttaxed at', rate, '\tfor', removed * rate)
tax += removed * rate
income -= removed
tax_income(0.1, 10_275)
@archishou
archishou / .vimrc
Last active November 15, 2023 15:36
Archi Vimrc
syntax on
set number
filetype plugin indent on
" show existing tab with 4 spaces width
set tabstop=4
" when indenting with '>', use 4 spaces width
set shiftwidth=4
" On pressing tab, insert 4 spaces
set expandtab
#pragma once
#include <cstdint>
#include <string>
#include <array>
#include <vector>
#include <algorithm>
#include <sstream>
#include "iostream"
package Library4997.MasqResources.MasqMath;
import Library4997.MasqResources.MasqHelpers.MasqHardware;
/**
* Created by Archishmaan Peyyety on 8/13/18.
* Project: MasqLib
*/
public class MasqVector implements MasqHardware {
package Library4997.MasqMotors;
import android.database.DatabaseErrorHandler;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.DcMotorController;
import com.qualcomm.robotcore.hardware.HardwareMap;
import com.qualcomm.robotcore.util.Range;
import Library4997.MasqResources.MasqHelpers.MasqHardware;
public class MasqPositionTracker implements MasqHardware {
private MasqMotor xSystem, yLSystem, yRSystem, ySystem;
public MasqAdafruitIMU imu;
private double prevHeading, heading;
private double globalX, globalY, prevX, prevY, prevYR, prevYL, xRadius, yRadius, trackWidth;
private DeadWheelPosition position;
public enum DeadWheelPosition {
BOTH_CENTER, BOTH_PERPENDICULAR, THREE
package main
import (
"flag"
"fmt"
. "github.com/dave/jennifer/jen"
"unicode"
)
func main() {
const AWS = require('aws-sdk');
const ddb = new AWS.DynamoDB.DocumentClient();
require('./patch.js');
let send = undefined;
function init(event) {
console.log(event);
const apigwManagementApi = new AWS.ApiGatewayManagementApi({
apiVersion: '2018-11-29',
endpoint: event.requestContext.domainName + '/' + event.requestContext.stage
import cv2 as cv
import math
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
from detectors.color_detector import ColorDetector
from processes.blurs import Blurs
import numpy as np
# load video
cap = cv.VideoCapture('testvideo.mp4')
# cap = cv.VideoCapture(0)
public void driveProportional(double angle, Direction direction, double ratio, double kp, double timeout) {
MasqClock clock = new MasqClock();
MasqPIDController controller = new MasqPIDController(kp, 0, 0);
double out = controller.getOutput(tracker.imu.getRelativeYaw(), angle);
double rightRatio = 1, leftRatio = 1;
if (direction == Direction.RIGHT) rightRatio = ratio;
else leftRatio = ratio;
while (opModeIsActive() && out > 0.1 && !clock.elapsedTime(3, MasqClock.Resolution.SECONDS)) {
out = controller.getOutput(tracker.imu.getRelativeYaw(), angle);
driveTrain.setVelocity(out * leftRatio, out * rightRatio);