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
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) |
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
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 |
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
#pragma once | |
#include <cstdint> | |
#include <string> | |
#include <array> | |
#include <vector> | |
#include <algorithm> | |
#include <sstream> | |
#include "iostream" |
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
package Library4997.MasqResources.MasqMath; | |
import Library4997.MasqResources.MasqHelpers.MasqHardware; | |
/** | |
* Created by Archishmaan Peyyety on 8/13/18. | |
* Project: MasqLib | |
*/ | |
public class MasqVector implements MasqHardware { |
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
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; |
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
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 |
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
package main | |
import ( | |
"flag" | |
"fmt" | |
. "github.com/dave/jennifer/jen" | |
"unicode" | |
) | |
func main() { |
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
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 |
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 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) |
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
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); |
NewerOlder