Notes, summaries, assignments, exams, and problems for Computers

Sort by
Subject
Level

Web Application Security: Vulnerabilities and Mitigations

Posted by Anonymous and classified in Computers

Written on in English with a size of 1.73 MB

Web Security Fundamentals

Vte60I22Y4rloTJJkNobQnzfKnvzVllIg5VXseVlb8Oo0lemK0wbVL2Ro4ylzQ96mYBvg7I3FlW9EaUPdsbPXfehlUZYxr6v7kaIgqQgAAEIQAACEIBALQHEci2i6bkhhrpMT82oCQQgAAEIQAACEBgPAcTyeLhORKq5E6z84MJENA2FgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwQQyz1pKIoJAQhAAAIQgAAEINA9AcRy98zJEQIQgAAEIAABCECgJwT+L8xpiAEBloqFAAAAAElFTkSuQmCC NF+gw7WaYNgAAAABJRU5ErkJggg== bpX7OFi9HIwAAAABJRU5ErkJggg== aXgG7JY0aGX+AzUxEfBqKaiqwN+Lqr8dhK3JtUSkuu9jiG7CmeBLI0AibpQApn3VjsogYpJsbULXZBVNqNbpV99GfuLaO+y1OBhQCQmAiCfwnQcZEIpS5hYAQEAJCQAgIgVAEJMiQfSEEhIAQEAJCQAiEhYAEGWHBKoMKASEgBISAEBACEmTIHhACQkAICAEhIATCQkCCjLBglUGFgBAQAkJACAgBCTJkDwgBISAEhIAQEAJhIfANRHwpmb9j0SIAAAAASUVORK5CYII= ntAAAAAElFTkSuQmCC wcCnzcg8p0c5gAAAABJRU5ErkJggg==

Common Cross-Site Scripting (XSS) Types

XSS TypeExample PayloadDescription
Reflected XSS<script>alert(1)</script>Injected payload reflected immediately in server response.
Stored XSS<img src="x" onerror="alert(1)">Payload stored on server (e.g., in database), executed later.
DOM-Based XSSURL: #<script>alert(1)</script>Payload executed via client-side JavaScript manipulation.
Event Handler XSS<a onclick="alert(1)">Click</a>Injects event attributes to run JS on user actions.
Attribute Injection"><script>alert(1)</script>Breaks out of HTML attribute to inject malicious code.
JavaScript URI XSS<a href="javascript:alert(1)">Click</a>Runs JS via link clicks
... Continue reading "Web Application Security: Vulnerabilities and Mitigations" »

Shell script

Classified in Computers

Written on in English with a size of 2.47 KB

Ejercicio de descuentos:

#!/bin/bash

read -p "¿Desea el billete también de vuelta? (s/n): " idavuelta

until [ $idavuelta=="s" ] || [ $idavuelta=="n" ]; do

read -p "¿Desea el billete también de vuelta? (s/n): " idavuelta

done

read -p "¿Tiene carnet joven? (s/n): " carnetjoven

until [ $carnetjoven="s" ] || [ $carnetjoven="n" ]; do

read -p "¿Tiene carnet joven? (s/n): " carnetjoven

done

descuento=0 billete=20

if [ $idavuelta="s" ]; then

descuento=20

billete=" expr $billete \* 2'

fi

if [ $carnetjoven="s" ]j then

descuento=30

fi

costefinal=`expr $billete \* \( 100 - $descuento \) / 100`

echo "El precio final del billete es $costefinal"



Ejercicio de medias:

#!/bin/bash

acu=0

cont=0

read -p "Introduce un numero: " num

while [ $num -ne 0 ]; do

acu=`expr $acu + $num`

cont=... Continue reading "Shell script" »

Universal Data Science Python Template for Machine Learning

Posted by Anonymous and classified in Computers

Written on in English with a size of 2.89 KB

Universal Data Science Python Template

This template provides a streamlined workflow for common data science tasks, including data preprocessing, modeling, and visualization.

Step 1: Import Libraries

import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler
from sklearn.linear_model import LogisticRegression, LinearRegression
from sklearn.cluster import KMeans, DBSCAN
from sklearn.metrics import accuracy_score, r2_score, silhouette_score

Step 2: Load Dataset

df = pd.read_csv('your_dataset.csv') # Replace with your dataset name
print(df.head())

Step 3: Data Cleaning

df = df.dropna()

Step 4: Feature Selection

X = df.drop(

... Continue reading "Universal Data Science Python Template for Machine Learning" »

Jose Andres Gutierrez Vargas: Software Developer Profile

Classified in Computers

Written on in English with a size of 3.33 KB

Jose Andres Gutierrez Vargas

Email: [email protected]
Phone: [Your Phone Number]

Professional Summary

Results-driven and highly motivated Software Developer with extensive expertise in backend and frontend development, RESTful APIs, and database management. Skilled in SQL and NoSQL databases, with in-depth experience in Node.js for building scalable and high-performance applications. Adept at optimizing system performance, troubleshooting technical issues, and implementing innovative solutions.

Former Frontend Developer at Google, where I contributed to the development of dynamic and interactive web applications, enhancing user experiences through cutting-edge technologies. Passionate about software development, staying updated with the latest... Continue reading "Jose Andres Gutierrez Vargas: Software Developer Profile" »

C Programming Algorithms: Coin Change, Knapsack, MST, Shortest Path

Posted by Anonymous and classified in Computers

Written on in English with a size of 8.06 KB

Problem Statement 16: Coin Change

Given a set of coins and a value, find the minimum number of coins to satisfy the given value.

Test Case 1:

Coins: {25, 20, 10, 5}, Value: 50 cents

Used coin: 25 cents

Used coin: 25 cents

Total number of coins: 2

Test Case 2:

Coins: {25, 20, 10, 5}, Value: 73 cents

Used coin: 25 cents

Used coin: 25 cents

Used coin: 20 cents

Used coin: 3 cents

Total number of coins: 4

Code:

-
#include int main { int amount =
50; int coins[] = {25, 20, 10, 5}; int
numCoins = 0;
printf("Amount: %d cents\n", amount);
for (int i = 0; i while (amount >= coins[i]){
amount -= coins 1;
numCoins++;
printf("Used
coin: %d cents\n", coins[i]);
}
printf("Total number of coins: %din", numCoins); return 0; }

Problem Statement 19: -#include #include int i,j,k,... Continue reading "C Programming Algorithms: Coin Change, Knapsack, MST, Shortest Path" »

8051 Microcontroller: LCD Interfacing and ADC0804 Control

Classified in Computers

Written on in English with a size of 2.51 KB

LCD Interfacing with 8051

#include <reg51.h>

sbit rs = P2^0;
sbit rw = P2^1;
sbit e = P2^2;

void msdelay(unsigned int time) {
    unsigned int i, j;
    for(i = 0; i < time; i++)
        for(j = 0; j < 1275; j++);
}

void lcd_cmd(unsigned char command) {
    P1 = command;
    rs = 0;
    rw = 0;
    e = 1;
    msdelay(1);
    e = 0;
}

void lcd_init() {
    lcd_cmd(0x38); // 2 lines and 5x7 matrix
    msdelay(10);
    lcd_cmd(0x0F);
    msdelay(10);
    lcd_cmd(0x01);
    msdelay(10);
    lcd_cmd(0x80);
    msdelay(10);
}

void lcd_data(unsigned char disp_data) {
    P1 = disp_data;
    rs = 1;
    rw = 0;
    e = 1;
    msdelay(1);
    e = 0;
}

void main() {
    unsigned char a[4] = "KTU";
    int l = 0;
    lcd_init();
    while(
... Continue reading "8051 Microcontroller: LCD Interfacing and ADC0804 Control" »

Database Management Systems and ERD Fundamentals

Posted by Anonymous and classified in Computers

Written on in English with a size of 36.02 KB

Introduction to Database Management Systems

A database is a structured collection of data stored on a computer system. It is managed using a Database Management System (DBMS), which provides the necessary tools for data storage, retrieval, and modification.

Core Benefits of Using a DBMS

  • Reduced Data Redundancy: A DBMS helps minimize repeated data through organizational rules such as normalization.
  • Enhanced Data Accuracy: The system uses specific rules, such as referential integrity, to maintain data consistency.
  • Support for Multiple Users: Many people can access and use the database simultaneously without encountering operational problems.

Centralized vs. Distributed Databases

  • Centralized: All data is stored in a single, primary location. This setup
... Continue reading "Database Management Systems and ERD Fundamentals" »

Essential SSH and SCP Command Cheat Sheet

Classified in Computers

Written on in English with a size of 4.22 KB

Connecting via SSH

Connect to a server (default port 22):

$ ssh [email protected]

Connect on a specific port:

$ ssh [email protected] -p 6222

Connect via PEM file (requires 0400 permissions):

$ ssh -i /path/file.pem [email protected]

See: SSH Permissions

Executing Remote Commands

Execute a remote command:

$ ssh [email protected] 'ls -l'

Invoke a local script:

$ ssh [email protected] bash < script.sh

Compress and download from a server:

$ ssh [email protected] "tar cvzf - ~/source" > output.tgz

SCP File Transfers

  • Copy from remote to local: scp user@server:/dir/file.ext dest/
  • Copy between two servers: scp user@server:/file user@server:/dir
  • Copy from local to remote: scp dest/file.ext user@server:/dir
  • Copy a whole folder: scp -r user@server:/dir dest/
  • Copy all files
... Continue reading "Essential SSH and SCP Command Cheat Sheet" »

Java Programming Examples and User Registration Forms

Posted by Anonymous and classified in Computers

Written on in English with a size of 2.08 KB

User Registration Form

Name:

Password:

Gender:
Male
Female

Hobbies:
Reading
Music

City:
SuratAhmedabad

Java Programming Examples

1. Simple Interest Calculation

import java.util.Scanner;
class SimpleInterest {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        float p, r, t, si;
        p = sc.nextFloat();
        r = sc.nextFloat();
        t = sc.nextFloat();
        si = (p * r * t) / 100;
        System.out.println("Simple Interest = " + si);
    }
}

2. Call Cost Calculation

import java.util.Scanner;
class CallCost {
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int min;
        float rate, cost;
        min = sc.nextInt();
        rate = sc.nextFloat(
... Continue reading "Java Programming Examples and User Registration Forms" »

Grammar Analysis and Context-Free Language Exercises

Posted by Anonymous and classified in Computers

Written on in English with a size of 4.14 KB

Hexadecimal Integer Grammar Analysis

Consider the following grammar for hexadecimal integers:

  • <hex literal> ::= 0x<number>
  • <number> ::= <number><number> | <digit>
  • <digit> ::= 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F

The string 0xF3 is an element of the language generated by this grammar.

Derivation Sequences and Parse Trees

1. How many distinct derivation sequences exist for this string?

There exist 6 distinct derivation sequences:

  • <hex literal> ⇒ 0x<number> ⇒ 0x<number><number> ⇒ 0x<digit><number> ⇒ 0x<digit><digit> ⇒ 0xF<digit> ⇒ 0xF3
  • <hex literal> ⇒ 0x<number> ⇒ 0x<number><number> ⇒ 0x<number&
... Continue reading "Grammar Analysis and Context-Free Language Exercises" »