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
#For python >= 3.9 | |
#Required to install pypdf by pip install pypdf | |
#There will be an output "Multiple definitions in dictionary at byte 0x1dc for key /Filter", but it's ok, file will still be decrypted | |
from pypdf import PdfReader, PdfWriter | |
def decrypt_pdf(input_path, output_path, password): | |
with open(input_path, 'rb') as input_file, open(output_path, 'wb') as output_file: | |
reader = PdfReader(input_file,strict=False) | |
reader.decrypt(password) |
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
Set-ExecutionPolicy Unrestricted -Scope Process |
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
## importing socket module | |
import socket | |
## getting the hostname by socket.gethostname() method | |
hostname = socket.gethostname() | |
## getting the IP address using socket.gethostbyname() method | |
ip_address = socket.gethostbyname(hostname) | |
## printing the hostname and ip_address | |
print(f"Hostname: {hostname}") | |
print(f"IP Address: {ip_address}") |
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
#define IN1_L 27 //motor Left Pin1 | |
#define IN2_L 26 //motor Left Pin2 | |
#define IN1_R 33 //motor Right Pin1 | |
#define IN2_R 32 //motor Right Pin2 | |
#define PWM_L 14 //PWM motor Left pin | |
#define PWM_R 14 //PWM motor Right pin | |
#define ENA_L 16 //Encoder A motor Left | |
#define ENB_L 17 //Encoder B motor Left | |
#define ENA_R 18 //Encoder A motor Right | |
#define ENB_R 19 //Encoder B motor Right |
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 <SoftwareSerial.h> | |
/* Pins 8, 9, 10 and 11 of Arduino are connected to L298N Motor Driver Input pins i.e. | |
IN1, IN2, In3 and IN4 respectively*/ | |
#define IN1 8 | |
#define IN2 9 | |
#define IN3 10 | |
#define IN4 11 | |
#define DEBUG 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
def estimateSpeed(location1, location2): | |
d_pixels = math.sqrt(math.pow(location2[0] - location1[0], 2) + math.pow(location2[1] - location1[1], 2)) | |
# ppm = location2[2] / carWidht | |
ppm = 8.8 | |
d_meters = d_pixels / ppm | |
#print("d_pixels=" + str(d_pixels), "d_meters=" + str(d_meters)) | |
fps = 18 | |
speed = d_meters * fps * 3.6 | |
return speed |
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
%Projectile motion | |
clear all | |
close all | |
clc | |
global g | |
global h | |
global m | |
g=9.81; | |
h=0.3; |
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
T5=[130 131 132 133 134]; | |
X8=zeros(length(T5)); | |
X5=zeros(length(T5)); | |
for i=1:length(T5) | |
X8(i)=XsolCarrol(T2,T1); | |
X5(i)=XsolCarrol(T1,T5(i)); | |
end |
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
clear | |
clc | |
%syms Q H S P D | |
D=40*10^6; | |
S=10000; | |
H=0.1; | |
P=5; | |
Working_days=250; %(days) | |
Lag_time=7; %(days) | |
%syms Q |
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 x=gauss(A,b) | |
%This function solves system of algebraic equations using Gaussian method | |
%Ax=b | |
%Input: matrix A, column vector b | |
%Output vector x | |
n=size(A,1); | |
b=b(:); %make sure b is a column vector. | |
nb=n+1; | |
Ab=[A b]; %extended matrix |
NewerOlder