├── downloads ├── daa │ ├── 6a.java │ ├── 7.java │ ├── 3a.java │ ├── 2b.java │ ├── 3b.java │ ├── 1a.java │ ├── 10a.java │ ├── 10b.java │ ├── 9.java │ ├── 8.java │ ├── 1b.java │ ├── 6b.java │ ├── 4.java │ ├── 5.java │ └── 2a.java ├── cn │ ├── 3.awk │ ├── 4.awk │ ├── 1.tcl │ ├── 3.tcl │ ├── 4.tcl │ ├── 2.tcl │ └── 5.tcl ├── mces │ ├── 1.s │ ├── 3.s │ ├── helloworlds.c │ ├── 2.s │ ├── dac2.c │ ├── 8.s │ ├── 4.s │ ├── dac1.c │ ├── 5.s │ ├── 6.s │ ├── 7.s │ ├── motor.c │ ├── helloworld.c │ ├── adc.c │ └── 7seg.c └── dsa │ ├── 5b.c │ ├── 2.c │ ├── 5a.c │ ├── 12.c │ ├── 1.c │ ├── 11.c │ ├── 4.c │ ├── 6.c │ ├── 3.c │ ├── 10.c │ └── 7.c ├── README.md ├── .gitignore ├── public ├── assets │ └── 404.jpg ├── src │ ├── 404.html │ ├── about.html │ ├── prism.css │ ├── style.css │ ├── login.html │ ├── post.html │ └── prism.js └── index.html ├── models ├── userModel.js ├── codeModel.js └── trashModel.js ├── db └── mongoose.js ├── functions └── emptyRecycleBin.js ├── package.json ├── .github └── workflows │ └── node.js.yml ├── routes ├── frontEnd.js ├── downloadsRoutes.js ├── userRoutes.js └── codeRoutes.js ├── index.js ├── middleware └── authJWT.js └── guardedPages └── admin.html /downloads/daa/6a.java: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /downloads/daa/7.java: -------------------------------------------------------------------------------- 1 | public class 7 { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## [Goto Web-site](https://pace-lab.onrender.com/) 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | configs.txt 3 | .DS_Store 4 | apicalls.rest 5 | .env 6 | -------------------------------------------------------------------------------- /public/assets/404.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rabeeh-ta/pace-lab/HEAD/public/assets/404.jpg -------------------------------------------------------------------------------- /downloads/cn/3.awk: -------------------------------------------------------------------------------- 1 | 2 | BEGIN{ 3 | } 4 | { 5 | if($6=="cwnd_") 6 | printf("%f\t%f\t\n",$1,$7); 7 | } 8 | END{ 9 | } 10 | -------------------------------------------------------------------------------- /downloads/mces/1.s: -------------------------------------------------------------------------------- 1 | ;multiply two 16 bit numbers and output a 32 bit number 2 | 3 | AREA MULTIPLY, CODE, READONLY 4 | ENTRY 5 | 6 | LDR R0, MEMORY 7 | LDRH R1, [R0] 8 | LDRH R2, [R0, #2] 9 | MUL R2, R1,R2 10 | STR R2, [R0, #4] 11 | 12 | MEMORY DCD 0X40000000 13 | END -------------------------------------------------------------------------------- /downloads/mces/3.s: -------------------------------------------------------------------------------- 1 | AREA FACT, CODE, READONLY 2 | ENTRY 3 | 4 | LDR R0, RESULT 5 | LDRB R1, [R0] 6 | MOV R2, R1 7 | 8 | UP ADD R1, R1, #-1 9 | CMP R1, #0 10 | BEQ STORE 11 | MUL R3, R2, R1 12 | MOV R2, R3 13 | B UP 14 | 15 | STORE STR R2, [R0, #4] 16 | 17 | RESULT DCD 0X40000000 18 | END -------------------------------------------------------------------------------- /downloads/mces/helloworlds.c: -------------------------------------------------------------------------------- 1 | #include 2 | char *msg = "hello world "; 3 | 4 | int main() 5 | { 6 | PINSEL0 = 0X5; 7 | U0LCR = 0X83; 8 | U0DLM = 0X00; 9 | U0DLL = 0X61; 10 | U0LCR = 0X03; 11 | while (*msg != 0X00) 12 | { 13 | while (!(U0LSR & 0X20)) 14 | ; 15 | U0THR = *msg; 16 | msg++; 17 | } 18 | } -------------------------------------------------------------------------------- /downloads/mces/2.s: -------------------------------------------------------------------------------- 1 | ; add no from 1 to 10 and find sum 2 | AREA SUMOFTEN, CODE, READONLY 3 | 4 | ENTRY 5 | MOV R0, #1 6 | MOV R1, #10 7 | MOV R2, #0 8 | 9 | LOOP ADD R2, R2, R0 10 | ADD R0, R0, #1 11 | ADD R1, R1, #-1 12 | CMP R1, #0 13 | BNE LOOP 14 | LDR R3, RESULT 15 | STR R2, [R3] 16 | S B S 17 | 18 | RESULT DCD 0X40000000 19 | END -------------------------------------------------------------------------------- /downloads/mces/dac2.c: -------------------------------------------------------------------------------- 1 | #include 2 | void Init_DAC() 3 | { 4 | PINSEL1=0X00080000; 5 | DACR=0; 6 | } 7 | void write_DAC(unsigned int dacval) 8 | { 9 | DACR=dacval<<6; 10 | } 11 | int main(void) 12 | { 13 | unsigned int i; 14 | Init_DAC(); 15 | while(1) 16 | { 17 | for(i=0;i<1024;i++) 18 | write_DAC(i); 19 | for(i=1023;i>0;i--) 20 | write_DAC(i); 21 | } 22 | } -------------------------------------------------------------------------------- /downloads/mces/8.s: -------------------------------------------------------------------------------- 1 | AREA ONESANDZEROS, CODE, READONLY 2 | 3 | LDR R0, MEMORY 4 | LDR R1, [R0] 5 | MOV R4, #32 6 | 7 | ROTATE RORS R1, #1 8 | BCS ONES 9 | ADD R3, R3, #1 10 | B NEXT 11 | 12 | ONES ADD R2, R2, #1 13 | NEXT SUBS R4, #1 14 | CMP R4, #0 15 | BNE ROTATE 16 | 17 | STRB R2, [R0, #5] 18 | STRB R3, [R0, #6] 19 | 20 | S B S 21 | 22 | MEMORY DCD 0X40000000 23 | 24 | END 25 | -------------------------------------------------------------------------------- /models/userModel.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const userSchema = new mongoose.Schema({ 4 | user: { 5 | type: String, 6 | required: true, 7 | trim: true, 8 | }, 9 | email: { 10 | type: String, 11 | trim: true, 12 | required: true, 13 | }, 14 | password: { 15 | type: String, 16 | trim: true, 17 | required: true, 18 | }, 19 | }); 20 | 21 | module.exports = mongoose.model('User', userSchema); 22 | -------------------------------------------------------------------------------- /db/mongoose.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | const mongoose = require('mongoose'); 3 | 4 | mongoose 5 | .connect( 6 | `mongodb+srv://rabeeh:${process.env.MONGO_PASSWORD}@prod-cluster.ctha1.mongodb.net/codeShare?retryWrites=true&w=majority`, 7 | { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true } 8 | ) 9 | .then(() => { 10 | console.log('Mongodb Connected'); 11 | }) 12 | .catch((e) => { 13 | console.log(e); 14 | }); 15 | -------------------------------------------------------------------------------- /downloads/mces/4.s: -------------------------------------------------------------------------------- 1 | AREA ADDOFARRY, CODE, READONLY 2 | ENTRY 3 | MOV R0, #4 4 | MOV R1, #0 5 | LDR R2, =VALUES 6 | 7 | LOOP LDR R3, [R2],#2 8 | LDR R4, MASK 9 | AND R3, R3, R4 10 | ADD R1, R1, R3 11 | SUB R0, R0, #1 12 | CMP R0, #0 13 | BNE LOOP 14 | 15 | LDR R5, RESULT 16 | STR R1, [R5] 17 | 18 | S B S 19 | 20 | RESULT DCD 0X40000000 21 | MASK DCD 0X0000FFFF 22 | VALUES DCW 0X0001, 0X0004,0X0001,0X0001 23 | 24 | END -------------------------------------------------------------------------------- /functions/emptyRecycleBin.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | const mongoose = require('mongoose'); 3 | 4 | mongoose 5 | .connect( 6 | `mongodb+srv://rabeeh:${process.env.MONGO_PASSWORD}@prod-cluster.ctha1.mongodb.net/codeShare?retryWrites=true&w=majority`, 7 | { useNewUrlParser: true, useCreateIndex: true, useUnifiedTopology: true } 8 | ) 9 | .then(() => { 10 | console.log('Mongodb Connected'); 11 | process.exit(); 12 | }) 13 | .catch((e) => { 14 | console.log(e); 15 | process.exit(); 16 | }); 17 | -------------------------------------------------------------------------------- /public/src/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 404 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 |

404 error

17 |
18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /downloads/cn/4.awk: -------------------------------------------------------------------------------- 1 | BEGIN{ 2 | count1=0 3 | count2=0 4 | pack1=0 5 | pack2=0 6 | time1=0 7 | time2=0 8 | } 9 | { 10 | if($1=="r" && $3=="_1_" && $4=="AGT") 11 | { 12 | count1++ 13 | pack1=pack1+$8 14 | time1=$2 15 | } 16 | if($1=="r" && $3=="_2_" && $4=="AGT") 17 | { 18 | count2++ 19 | pack2=pack2+$8 20 | time2=$2 21 | } 22 | } 23 | END{ 24 | printf("The Throughput from n0 to n1: %f Mbps \n", ((count1*pack1*8)/(time1*1000000))); 25 | printf("The Throughput from n1 to n2: %f Mbps ", ((count2*pack2*8)/(time2*1000000))); 26 | } 27 | -------------------------------------------------------------------------------- /downloads/daa/3a.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Divide { 4 | public static void main(String[] args) { 5 | Scanner scan = new Scanner(System.in); 6 | 7 | System.out.println("Enter the integers A and B"); 8 | int a = scan.nextInt(); 9 | int b = scan.nextInt(); 10 | 11 | try { 12 | System.out.println("The result of division a / b is " + (a / b)); 13 | } catch (ArithmeticException e) { 14 | System.out.println("division by zero error"); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /downloads/mces/dac1.c: -------------------------------------------------------------------------------- 1 | #include 2 | int Init_DAC() 3 | { 4 | PINSEL1=0x000800000; 5 | DACR = 0; 6 | } 7 | int Write_DAC(unsigned int dacval) 8 | { 9 | DACR = dacval<<6; 10 | } 11 | 12 | void delay(unsigned int count ) 13 | { 14 | int j=0,i=0; 15 | for(j=0;j>>>>>> 82b1d6c1d563a805640cd61dff83464fd0c9fd32 6 | on: 7 | schedule: 8 | - cron: '5 0 * * *' 9 | 10 | workflow_dispatch: 11 | 12 | env: 13 | MONGO_PASSWORD: ${{secrets.MONGO_PASSWORD}} 14 | 15 | jobs: 16 | cleanTrashBin: 17 | runs-on: ubuntu-latest 18 | 19 | strategy: 20 | matrix: 21 | node-version: [14.x] 22 | 23 | steps: 24 | - uses: actions/checkout@v2 25 | 26 | - name: Use Node.js ${{ matrix.node-version }} 27 | uses: actions/setup-node@v2 28 | with: 29 | node-version: ${{ matrix.node-version }} 30 | 31 | - run: npm install 32 | - run: node functions/emptyRecycleBin.js 33 | -------------------------------------------------------------------------------- /models/codeModel.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const codeSchema = new mongoose.Schema({ 4 | title: { 5 | type: String, 6 | required: true, 7 | trim: true, 8 | }, 9 | description: { 10 | type: String, 11 | trim: true, 12 | required: true, 13 | }, 14 | code: { 15 | type: String, 16 | required: true, 17 | }, 18 | sem: { 19 | type: Number, 20 | min: 1, 21 | max: 8, 22 | required: true, 23 | }, 24 | tag: { 25 | type: String, 26 | trim: true, 27 | }, 28 | author: { 29 | type: String, 30 | default: 'anonymous', 31 | trim: true, 32 | }, 33 | date: { 34 | type: Date, 35 | default: Date.now, 36 | }, 37 | }); 38 | 39 | module.exports = mongoose.model('Code', codeSchema); 40 | -------------------------------------------------------------------------------- /downloads/mces/7.s: -------------------------------------------------------------------------------- 1 | AREA SORT, CODE, READONLY 2 | ENTRY 3 | MOV R8, #4 4 | LDR R2, =VALUES 5 | LDR R3, RESULT 6 | 7 | LOOP0 LDR R1, [R2] , #4 8 | STR R1, [R3], #4 9 | SUBS R8, R8, #1 10 | CMP R8, #0 11 | BNE LOOP0 12 | 13 | START MOV R5, #3 14 | MOV R7, #0 15 | LDR R1, RESULT 16 | 17 | LOOP1 LDR R2, [R1], #4 18 | LDR R3, [R1] 19 | CMP R2, R3 20 | BLT LOOP2 21 | STR R2, [R1], #-4 22 | STR R3, [R1] 23 | MOV R7, #1 24 | ADD R1, #4 25 | 26 | LOOP2 SUBS R5, R5, #1 27 | CMP R5, #0 28 | BNE LOOP1 29 | CMP R7, #0 30 | BNE START 31 | 32 | S B S 33 | 34 | VALUES DCD 0X44444444 35 | DCD 0X11111111 36 | DCD 0X33333333 37 | DCD 0X22222222 38 | 39 | RESULT DCD 0X40000000 40 | END -------------------------------------------------------------------------------- /models/trashModel.js: -------------------------------------------------------------------------------- 1 | const mongoose = require('mongoose'); 2 | 3 | const trashSchema = new mongoose.Schema({ 4 | title: { 5 | type: String, 6 | required: true, 7 | trim: true, 8 | }, 9 | description: { 10 | type: String, 11 | trim: true, 12 | required: true, 13 | }, 14 | code: { 15 | type: String, 16 | required: true, 17 | }, 18 | author: { 19 | type: String, 20 | default: 'anonymous', 21 | trim: true, 22 | }, 23 | deletedBy: { 24 | type: String, 25 | default: 'anonymous', 26 | trim: true, 27 | }, 28 | deletedOn: { 29 | type: Date, 30 | default: Date.now, 31 | }, 32 | date: { 33 | type: Date, 34 | required: true, 35 | }, 36 | }); 37 | 38 | module.exports = mongoose.model('Trash', trashSchema); 39 | -------------------------------------------------------------------------------- /downloads/dsa/5b.c: -------------------------------------------------------------------------------- 1 | #include 2 | void towers(int, char, char, char); 3 | int main() 4 | { 5 | int n; 6 | char source, dest, auxiliary; 7 | printf("Enter the number of disks : "); 8 | scanf("%d", &n); 9 | printf("\nSOURCE = %c DESTINATION = %c AUXILIARY = %c\n", 'A', 'C', 'B'); 10 | towers(n, 'A', 'C', 'B'); 11 | } 12 | void towers(int n, char source, char dest, char auxiliary) 13 | { 14 | printf("\n\nTOWERS : %d, %c, %c, %c", n, source, dest,auxiliary); 15 | if (n == 1) 16 | printf("\n\nMove from %c to %c", source, dest); 17 | else 18 | { 19 | towers(n - 1, source, auxiliary, dest); 20 | printf("\nMove from %c to %c", source, dest); 21 | towers(n - 1, auxiliary, dest, source); 22 | } 23 | printf("\n"); 24 | } 25 | -------------------------------------------------------------------------------- /downloads/mces/motor.c: -------------------------------------------------------------------------------- 1 | #include 2 | #define CLK 0x00010000 3 | #define ACLK 0x00020000 4 | void delay(unsigned int count) 5 | { 6 | int j=0,i=0; 7 | for(j=0;j 2 | void initclock(void); 3 | void inituart0(void); 4 | void U0write(char data); 5 | void send_string(char* stringptr); 6 | char string[]=" hello world \n\r\n"; 7 | unsigned int delay; 8 | int main(void) 9 | { 10 | initclock(); 11 | inituart0(); 12 | { 13 | send_string(string); 14 | for(delay=0;delay<500000;delay++); 15 | } 16 | } 17 | void inituart0(void) 18 | { 19 | PINSEL0=0X5; 20 | U0LCR=0X83; 21 | U0DLL=110; 22 | U0DLM=1; 23 | U0FDR=0XF1; 24 | U0LCR &=0X0F; 25 | } 26 | void U0write(char data) 27 | { 28 | while(!(U0LSR &(1<5))); 29 | U0THR=data; 30 | } 31 | void initclock(void) 32 | { 33 | PLL0CON=0X01; 34 | PLL0CFG=0X24; 35 | PLL0FEED=0XAA; 36 | PLL0FEED=0X55; 37 | while(!(PLL0STAT & 0X00000040)); 38 | PLL0CON=0X03; 39 | PLL0FEED=0XAA; 40 | PLL0FEED=0X55; 41 | VPBDIV=0X01; 42 | } 43 | void send_string(char*stringptr) 44 | { 45 | while(*stringptr!=0x00) 46 | { 47 | U0write(*stringptr); 48 | stringptr++; 49 | } 50 | } -------------------------------------------------------------------------------- /routes/frontEnd.js: -------------------------------------------------------------------------------- 1 | const { authenticateJWT } = require('../middleware/authJWT'); 2 | const path = require('path'); 3 | const express = require('express'); 4 | 5 | const { dirname } = require('path'); 6 | 7 | const router = new express.Router(); 8 | 9 | //? frontend html serving routes 10 | router.get('/', (req, res) => { 11 | res.sendFile(path.join(__dirname, '../public/index.html')); 12 | }); 13 | 14 | router.get('/about', (req, res) => { 15 | res.sendFile(path.join(__dirname, '../public/src/about.html')); 16 | }); 17 | 18 | router.get('/post', (req, res) => { 19 | res.sendFile(path.join(__dirname, '../public/src/post.html')); 20 | }); 21 | 22 | router.get('/login', (req, res) => { 23 | res.sendFile(path.join(__dirname, '../public/src/login.html')); 24 | }); 25 | 26 | router.get('/admin', authenticateJWT, (req, res) => { 27 | res.sendFile(path.join(__dirname, '../guardedPages/admin.html')); 28 | }); 29 | 30 | router.get('/*', (req, res) => { 31 | res.sendFile(path.join(__dirname, '../public/src/404.html')); 32 | }); 33 | 34 | module.exports = router; 35 | -------------------------------------------------------------------------------- /routes/downloadsRoutes.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | 5 | const router = new express.Router(); 6 | 7 | router.get('/download/:sub/:programNo', (req, res) => { 8 | const currentPath = path.join( 9 | __dirname, 10 | '..', 11 | 'downloads', 12 | req.params.sub, 13 | req.params.programNo 14 | ); 15 | 16 | res.sendFile(`${currentPath}`); 17 | }); 18 | 19 | router.get('/download/ls', (req, res) => { 20 | let dirs = []; 21 | let files = []; 22 | const currentPath = path.join(__dirname, '..', 'downloads'); 23 | 24 | // search directories 25 | fs.readdirSync(currentPath).forEach((dir) => { 26 | if (!(dir[0] == '.')) dirs.push(dir); 27 | }); 28 | 29 | //search files 30 | dirs.forEach((dir, index) => { 31 | let subFiles = []; 32 | fs.readdirSync(currentPath + '/' + dir).forEach((file) => { 33 | if (!(file[0] == '.')) subFiles.push(file); 34 | }); 35 | files[index] = subFiles; 36 | }); 37 | 38 | res.send(`${dirs} \n ${files}`); 39 | }); 40 | 41 | module.exports = router; 42 | -------------------------------------------------------------------------------- /downloads/cn/1.tcl: -------------------------------------------------------------------------------- 1 | set ns [new Simulator] 2 | 3 | set nf [open lab1.nam w] 4 | $ns namtrace-all $nf 5 | 6 | set tf [open lab1.tr w] 7 | $ns trace-all $tf 8 | 9 | proc finish { } { 10 | global ns nf tf 11 | $ns flush-trace 12 | close $nf 13 | close $tf 14 | exec nam lab1.nam & 15 | exit 0 16 | } 17 | 18 | set n0 [$ns node] 19 | set n1 [$ns node] 20 | set n2 [$ns node] 21 | set n3 [$ns node] 22 | 23 | $ns duplex-link $n0 $n2 200Mb 10ms DropTail 24 | $ns duplex-link $n1 $n2 100Mb 5ms DropTail 25 | $ns duplex-link $n2 $n3 1Mb 1000ms DropTail 26 | $ns queue-limit $n0 $n2 10 27 | $ns queue-limit $n1 $n2 10 28 | 29 | set udp0 [new Agent/UDP] 30 | $ns attach-agent $n0 $udp0 31 | set cbr0 [new Application/Traffic/CBR] 32 | $cbr0 set packetSize_ 500 33 | $cbr0 set interval_ 0.005 34 | $cbr0 attach-agent $udp0 35 | 36 | set udp1 [new Agent/UDP] 37 | $ns attach-agent $n1 $udp1 38 | set cbr1 [new Application/Traffic/CBR] 39 | $cbr1 attach-agent $udp1 40 | 41 | set udp2 [new Agent/UDP] 42 | $ns attach-agent $n2 $udp2 43 | set cbr2 [new Application/Traffic/CBR] 44 | $cbr2 attach-agent $udp2 45 | set null0 [new Agent/Null] 46 | $ns attach-agent $n3 $null0 47 | $ns connect $udp0 $null0 48 | $ns connect $udp1 $null0 49 | 50 | $ns at 0.1 "$cbr0 start" 51 | $ns at 0.2 "$cbr1 start" 52 | $ns at 1.0 "finish" 53 | 54 | $ns run 55 | -------------------------------------------------------------------------------- /downloads/mces/adc.c: -------------------------------------------------------------------------------- 1 | #include /* LPC214x definitions */ 2 | #include 3 | #include "lcd.h" 4 | 5 | ////////// Init ADC0 ///////////////// 6 | int Init_ADC() 7 | { 8 | // Convert Port pin 0.28 to function as AD0.2 9 | PINSEL1 = 0X01000000; 10 | } 11 | 12 | ////////// READ ADC0 CH:2 ///////////////// 13 | unsigned int Read_ADC() 14 | { 15 | unsigned int i=0; 16 | 17 | AD0CR = 0x00200D02; //0x00200D04; 18 | AD0CR |= 0x01000000; // Start A/D Conversion 19 | 20 | do 21 | { 22 | i = AD0GDR; // Read A/D Data Register 23 | } while ((i & 0x80000000) == 0); // Wait for end of A/D Conversion 24 | 25 | return (i >> 6) & 0x03FF; // bit 6:15 is 10 bit AD value 26 | 27 | } 28 | 29 | ////////// DISPLAY ADC VALUE ///////////////// 30 | void Display_ADC() 31 | { 32 | unsigned int adc_value = 0; 33 | char buf[4] = {4}; 34 | float voltage = 0.0; 35 | 36 | adc_value = Read_ADC(); 37 | sprintf((char *)buf, "%3d", adc_value); 38 | lcd_putstring16(0,"ADC VAL = 000 "); 39 | lcd_gotoxy(0,10); 40 | lcd_putstring(buf); 41 | } 42 | 43 | ////////// MAIN ///////////////// 44 | int main (void) 45 | { 46 | init_lcd(); 47 | Init_ADC(); 48 | while(1) 49 | { 50 | Display_ADC(); 51 | delay(50000); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | require('./db/mongoose'); 3 | const path = require('path'); 4 | const express = require('express'); 5 | const cors = require('cors'); 6 | const cookieParser = require('cookie-parser'); 7 | 8 | //? different routes files. 9 | const codeRouter = require('./routes/codeRoutes'); 10 | const userRouter = require('./routes/userRoutes'); 11 | const frontRouter = require('./routes/frontEnd'); 12 | const downloadsRouter = require('./routes/downloadsRoutes'); 13 | 14 | //? setup express 15 | const app = express(); 16 | const port = process.env.PORT || 3000; 17 | 18 | //? redirect http to https 19 | app.use((req, res, next) => { 20 | if (process.env.NODE_ENV == 'production') { 21 | if (req.headers['x-forwarded-proto'] != 'https') 22 | // the statement for performing our redirection 23 | return res.redirect('https://' + req.headers.host + req.url); 24 | else return next(); 25 | } else return next(); 26 | }); 27 | 28 | //? express configurations 29 | app.use(cors()); 30 | app.use(express.json()); 31 | app.use(express.static('public')); 32 | app.use(express.static('downloads')); 33 | app.use(cookieParser()); 34 | 35 | //? application logic/backend routes 36 | app.use(codeRouter); 37 | app.use(userRouter); 38 | app.use(downloadsRouter); 39 | app.use(frontRouter); 40 | 41 | app.listen(port, () => { 42 | console.log('Express running on port ' + port); 43 | }); 44 | -------------------------------------------------------------------------------- /downloads/mces/7seg.c: -------------------------------------------------------------------------------- 1 | #include /* LPC214x definitions */ 2 | #define DIG2 (1 << 11) 3 | //#define LED_DATA_MASK 0x007F8000 4 | ////////// digits are created using bit patterns corresponding to the segments //////////////////// 5 | unsigned char dig[] = {0x88,0xeb,0x4c,0x49,0x2b,0x19,0x18,0xcb,0x8,0x9,0xa,0x38,0x9c,0x68,0x1c,0x1e}; 6 | 7 | /**************************************************************************** 8 | Function Name : delay() 9 | ********************************************************************************/ 10 | void delay(unsigned int count) 11 | { 12 | int j=0,i=0; 13 | 14 | for(j=0;j 2 | #include 3 | void ReadStrings(); 4 | void PatternMatching(char[], char[], char[]); 5 | char STR[100], PAT[100], REP[100]; 6 | int main() 7 | { 8 | ReadStrings(STR, PAT, REP); 9 | PatternMatching(STR, PAT, REP); 10 | } 11 | void ReadStrings(char STR[100], char PAT[100], char REP[100]) 12 | { 13 | printf("Enter the main string STR : "); 14 | gets(STR); 15 | printf("Enter the pattern string PAT : "); 16 | gets(PAT); 17 | printf("Enter the replace string REP : "); 18 | gets(REP); 19 | } 20 | void PatternMatching(char STR[100], char PAT[100], char REP[100]) 21 | { 22 | int i, j, k, m, c, flag, count; 23 | i = m = c = j = count = flag = 0; 24 | char RESULT[100]; 25 | while (STR[c] != '\0') 26 | { 27 | if (STR[m] == PAT[i]) 28 | { 29 | i++; 30 | m++; 31 | if (PAT[i] == '\0') 32 | { 33 | for (k = 0; REP[k] != '\0'; k++, j++) 34 | RESULT[j] = REP[k]; 35 | i = 0; 36 | c = m; 37 | count++; 38 | flag = 1; 39 | } 40 | } 41 | else 42 | { 43 | RESULT[j] = STR[c]; 44 | j++; 45 | c++; 46 | m = c; 47 | i = 0; 48 | } 49 | } 50 | if (flag == 0) 51 | printf("Pattern does not found\n"); 52 | else 53 | { 54 | RESULT[j] = '\0'; 55 | printf("Pattern found %d times\n", count); 56 | printf("The resultant string is\n%s\n", RESULT); 57 | } 58 | } -------------------------------------------------------------------------------- /downloads/cn/3.tcl: -------------------------------------------------------------------------------- 1 | set ns [new Simulator] 2 | set tf [open lab3.tr w] 3 | $ns trace-all $tf 4 | set nf [open lab3.nam w] 5 | $ns namtrace-all $nf 6 | 7 | set n0 [$ns node] 8 | $n0 color "magenta" 9 | $n0 label "src1" 10 | set n1 [$ns node] 11 | set n2 [$ns node] 12 | $n2 color "magenta" 13 | $n2 label "src2" 14 | set n3 [$ns node] 15 | $n3 color "blue" 16 | $n3 label "dest2" 17 | set n4 [$ns node] 18 | set n5 [$ns node] 19 | $n5 color "blue" 20 | $n5 label "dest1" 21 | $ns make-lan "$n0 $n1 $n2 $n3 $n4" 100Mb 100ms LL Queue/DropTail Mac/802_3 22 | $ns duplex-link $n4 $n5 1Mb 1ms DropTail 23 | set tcp0 [new Agent/TCP] 24 | $ns attach-agent $n0 $tcp0 25 | set ftp0 [new Application/FTP] 26 | $ftp0 attach-agent $tcp0 27 | $ftp0 set packetSize_ 500 28 | $ftp0 set interval_ 0.0001 29 | set sink5 [new Agent/TCPSink] 30 | $ns attach-agent $n5 $sink5 31 | $ns connect $tcp0 $sink5 32 | set tcp2 [new Agent/TCP] 33 | $ns attach-agent $n2 $tcp2 34 | set ftp2 [new Application/FTP] 35 | $ftp2 attach-agent $tcp2 36 | $ftp2 set packetSize_ 600 37 | $ftp2 set interval_ 0.001 38 | set sink3 [new Agent/TCPSink] 39 | $ns attach-agent $n3 $sink3 40 | $ns connect $tcp2 $sink3 41 | set file1 [open file1.tr w] 42 | $tcp0 attach $file1 43 | set file2 [open file2.tr w] 44 | $tcp2 attach $file2 45 | $tcp0 trace cwnd_ 46 | $tcp2 trace cwnd_ 47 | proc finish { } { 48 | global ns nf tf 49 | $ns flush-trace 50 | close $tf 51 | close $nf 52 | exec nam lab3.nam & 53 | exit 0 54 | } 55 | $ns at 0.1 "$ftp0 start" 56 | $ns at 5 "$ftp0 stop" 57 | $ns at 7 "$ftp0 start" 58 | $ns at 0.2 "$ftp2 start" 59 | $ns at 8 "$ftp2 stop" 60 | $ns at 14 "$ftp0 stop" 61 | $ns at 10 "$ftp2 start" 62 | $ns at 15 "$ftp2 stop" 63 | $ns at 16 "finish" 64 | $ns run 65 | 66 | -------------------------------------------------------------------------------- /downloads/daa/10a.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class floyd { 4 | public static void main(String[] args) { 5 | int wt[][] = new int[10][10]; 6 | int i, j, n; 7 | Scanner scan = new Scanner(System.in); 8 | 9 | System.out.println("\n create a graph using adjacency matrix"); 10 | System.out.println("Enter the no of vertices"); 11 | n = scan.nextInt(); 12 | 13 | System.out.println("Enter the elements. 999 in infinity value"); 14 | for (i = 1; i <= n; i++) { 15 | for (j = 1; j <= n; j++) 16 | wt[i][j] = scan.nextInt(); 17 | } 18 | 19 | System.out.println("Computing shortest path"); 20 | floyd_shortest_path(wt, n); 21 | 22 | } 23 | 24 | public static void floyd_shortest_path(int wt[][], int n) { 25 | int d[][] = new int[10][10]; 26 | int i, j, k; 27 | 28 | for (i = 1; i <= n; i++) { 29 | for (j = 1; j <= n; j++) 30 | d[i][j] = wt[i][j]; 31 | } 32 | 33 | for (k = 1; k <= n; k++) { 34 | for (i = 1; i <= n; i++) { 35 | for (j = 1; j <= n; j++) 36 | d[i][j] = min(d[i][j], (d[i][k] + d[k][j])); 37 | } 38 | } 39 | 40 | for (k = 0; k <= n; k++) { 41 | System.out.println("d(" + k + ")\n"); 42 | for (i = 1; i <= n; i++) { 43 | for (j = 1; j <= n; j++) { 44 | System.out.print(" " + d[i][j]); 45 | } 46 | System.out.println(" "); 47 | } 48 | 49 | } 50 | 51 | } 52 | 53 | public static int min(int a, int b) { 54 | if (a < b) 55 | return a; 56 | else 57 | return b; 58 | } 59 | } -------------------------------------------------------------------------------- /downloads/cn/4.tcl: -------------------------------------------------------------------------------- 1 | set ns [new Simulator] 2 | set tf [open lab4.tr w] 3 | $ns trace-all $tf 4 | set topo [new Topography] 5 | $topo load_flatgrid 1000 1000 6 | set nf [open lab4.nam w] 7 | $ns namtrace-all-wireless $nf 1000 1000 8 | 9 | $ns node-config -adhocRouting DSDV \ 10 | -llType LL \ 11 | -macType Mac/802_11 \ 12 | -ifqType Queue/DropTail \ 13 | -ifqLen 50 \ 14 | -phyType Phy/WirelessPhy \ 15 | -channelType Channel/WirelessChannel \ 16 | -propType Propagation/TwoRayGround \ 17 | -antType Antenna/OmniAntenna \ 18 | -topoInstance $topo \ 19 | -agentTrace ON \ 20 | -routerTrace ON \ 21 | 22 | create-god 3 23 | set n0 [$ns node] 24 | set n1 [$ns node] 25 | set n2 [$ns node] 26 | 27 | $n0 label "tcp0" 28 | $n1 label "sink1/tcp1" 29 | $n2 label "sink2" 30 | 31 | $n0 set X_ 50 32 | $n0 set Y_ 50 33 | $n0 set Z_ 0 34 | $n1 set X_ 100 35 | $n1 set Y_ 100 36 | $n1 set Z_ 0 37 | $n2 set X_ 600 38 | $n2 set Y_ 600 39 | $n2 set Z_ 0 40 | 41 | $ns at 0.1 "$n0 setdest 50 50 15" 42 | $ns at 0.1 "$n1 setdest 100 100 25" 43 | $ns at 0.1 "$n2 setdest 600 600 25" 44 | 45 | set tcp0 [new Agent/TCP] 46 | $ns attach-agent $n0 $tcp0 47 | 48 | set ftp0 [new Application/FTP] 49 | $ftp0 attach-agent $tcp0 50 | set sink1 [new Agent/TCPSink] 51 | $ns attach-agent $n1 $sink1 52 | $ns connect $tcp0 $sink1 53 | set tcp1 [new Agent/TCP] 54 | $ns attach-agent $n1 $tcp1 55 | set ftp1 [new Application/FTP] 56 | $ftp1 attach-agent $tcp1 57 | set sink2 [new Agent/TCPSink] 58 | $ns attach-agent $n2 $sink2 59 | $ns connect $tcp1 $sink2 60 | 61 | $ns at 5 "$ftp0 start" 62 | $ns at 5 "$ftp1 start" 63 | 64 | $ns at 100 "$n1 setdest 550 550 15" 65 | $ns at 190 "$n1 setdest 70 70 15" 66 | proc finish { } { 67 | global ns nf tf 68 | $ns flush-trace 69 | exec nam lab4.nam & 70 | close $tf 71 | exit 0 72 | } 73 | $ns at 250 "finish" 74 | $ns run 75 | 76 | -------------------------------------------------------------------------------- /downloads/dsa/5a.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | int stack[50]; 6 | int top = -1; 7 | void push(int); 8 | int pop(); 9 | void push(int num) 10 | { 11 | stack[++top] = num; 12 | } 13 | int pop() 14 | { 15 | return stack[top--]; 16 | } 17 | int main() 18 | { 19 | char suffix[50], ch; 20 | int p1, p2, p3, i; 21 | printf("Enter the valid suffix expression : "); 22 | gets(suffix); 23 | for (i = 0; suffix[i] != '\0'; i++) 24 | { 25 | ch = suffix[i]; 26 | // puts(ch); 27 | if (isdigit(ch)) 28 | push(ch - '0'); 29 | else 30 | { 31 | p2 = pop(); 32 | p1 = pop(); 33 | switch (ch) 34 | { 35 | case '+': 36 | push(p1 + p2); 37 | break; 38 | case '-': 39 | push(p1 - p2); 40 | break; 41 | case '*': 42 | push(p1 * p2); 43 | break; 44 | case '/': 45 | if (p2 == 0) 46 | { 47 | printf("Divide by Zero error\n"); 48 | exit(0); 49 | } 50 | push(p1 / p2); 51 | break; 52 | case '%': 53 | if (p2 == 0) 54 | { 55 | printf("Divide by Zero error\n"); 56 | exit(0); 57 | } 58 | push(p1 % p2); 59 | break; 60 | case '^': 61 | push(pow(p1, p2)); 62 | break; 63 | default: 64 | printf("Invalid Expression\n"); 65 | } 66 | } 67 | } 68 | printf("The value of given suffix expression is : %d\n", pop()); 69 | } 70 | -------------------------------------------------------------------------------- /downloads/daa/10b.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class TSP { 4 | static int cost = 0; 5 | 6 | public static void main(String[] args) { 7 | int a[][] = new int[10][10]; 8 | int visited[] = new int[10]; 9 | int i, j, n; 10 | System.out.print("\n eneter no of cities"); 11 | Scanner in = new Scanner(System.in); 12 | n = in.nextInt(); 13 | System.out.println("enter cost matrix"); 14 | for (i = 0; i < n; i++) { 15 | for (j = 0; j < n; j++) { 16 | a[i][j] = in.nextInt(); 17 | } 18 | visited[i] = 0; 19 | } 20 | System.out.println("The Path is"); 21 | mincost(a, n, 0, visited); 22 | display(); 23 | } 24 | 25 | public static void mincost(int a[][], int n, int city, int visited[]) { 26 | int i, cityno; 27 | visited[city] = 1; 28 | System.out.print((city + 1) + "->"); 29 | cityno = least(a, visited, n, city); 30 | if (cityno == 999) { 31 | cityno = 0; 32 | System.out.print("" + (cityno + 1)); 33 | cost += a[city][cityno]; 34 | return; 35 | } 36 | mincost(a, n, cityno, visited); 37 | } 38 | 39 | public static int least(int a[][], int visited[], int n, int c) { 40 | int i, minnode = 999, min = 999, newmin = 0; 41 | for (i = 0; i <= n; i++) { 42 | if ((a[c][i] != 0) && (visited[i] == 0)) 43 | if (a[c][i] < min) { 44 | min = a[i][0] + a[c][i]; 45 | newmin = a[c][i]; 46 | minnode = i; 47 | } 48 | } 49 | if (min != 999) 50 | cost += newmin; 51 | return minnode; 52 | } 53 | 54 | public static void display() { 55 | System.out.println("\n total cost of tour " + cost); 56 | } 57 | } -------------------------------------------------------------------------------- /downloads/daa/9.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Prims { 4 | public int cost[][] = new int[10][10]; 5 | public int isVisited[] = new int[10]; 6 | public int minCost; 7 | 8 | public void calc(int n) { 9 | int i, j, min = 999, num_edges = 1, a = 1, b = 1, minpos_i = 1, minpos_j = 1; 10 | 11 | while (num_edges < n) { 12 | for (i = 1, min = 999; i <= n; i++) 13 | for (j = 1; j <= n; j++) 14 | if (this.cost[i][j] < min) { 15 | if (this.isVisited[i] != 0) { 16 | min = this.cost[i][j]; 17 | a = minpos_i = i; 18 | b = minpos_j = j; 19 | } 20 | } 21 | 22 | if (this.isVisited[minpos_i] == 0 || this.isVisited[minpos_j] == 0) { 23 | System.out.println("\t from Vertex " + a + " to Vertex " + b + " mincost:" + min + " \n"); 24 | this.minCost = this.minCost + min; 25 | num_edges = num_edges + 1; 26 | this.isVisited[b] = 1; 27 | } 28 | this.cost[a][b] = this.cost[b][a] = 999; 29 | } 30 | System.out.println("MINIMUM COST SPANNING TREE " + this.minCost); 31 | } 32 | 33 | public static void main(String[] args) { 34 | int i, j, n; 35 | Scanner scan = new Scanner(System.in); 36 | Prims p = new Prims(); 37 | 38 | System.out.println("Enter the number of nodes"); 39 | n = scan.nextInt(); 40 | 41 | System.out.println("Enter the cost matrix weights"); 42 | for (i = 1; i <= n; i++) { 43 | for (j = 1; j <= n; j++) { 44 | p.cost[i][j] = scan.nextInt(); 45 | if (p.cost[i][j] == 0) 46 | p.cost[i][j] = 999; 47 | } 48 | p.isVisited[1] = 1; 49 | } 50 | p.calc(n); 51 | 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /middleware/authJWT.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | const jwt = require('jsonwebtoken'); 3 | 4 | //? middle ware function where it will check if the JWT that the user has send is valid or not. 5 | var authenticateJWT = function (req, res, next) { 6 | //! "Bearer JWT" authorization from req header. 7 | const authHeader = req.headers['authorization']; 8 | var token = authHeader && authHeader.split(' ')[1]; //if there is a jwt token passed then return the token else UNDEFINED, the split(' ')[1] will get the token part from the string passed in the Header "Bearer KEY" 9 | 10 | //! "cookie" based authorization from req header. 11 | //? if there is jwt in req cookie then that is the token 12 | if (req.cookies.authorization != undefined) token = req.cookies.authorization; 13 | 14 | if (token == null) return res.redirect('/login'); // if no token is passed then no access granted login 15 | 16 | jwt.verify(token, process.env.ACCESS_TOKEN_SECRET, (err, user) => { 17 | if (err) return res.sendStatus(403); // you have a token but it is not valid 18 | req.user = user; // user => the decrypted value which was inside the JWT 19 | next(); 20 | }); 21 | }; 22 | 23 | module.exports = { authenticateJWT }; 24 | 25 | /* 26 | //? middle ware function where it will check if the JWT that the user has send is valid or not. 27 | const authenticateJWT = function (req, res, next) { 28 | const authHeader = req.headers['authorization']; 29 | const token = authHeader && authHeader.split(' ')[1]; //if there is a jwt token passed then return the token else UNDEFINED, the split(' ')[1] will get the token part from the string passed in the Header "Bearer KEY" 30 | 31 | if (token == null) return res.sendStatus(401); // if no token is passed then no access granted login 32 | 33 | jwt.verify(token, process.env.ACCESS_TOKEN_SECRET, (err, user) => { 34 | if (err) return res.sendStatus(403); // you have a token but it is not valid 35 | req.user = user; // user => the decrypted value which was inside the JWT 36 | next(); 37 | }); 38 | }; 39 | */ 40 | -------------------------------------------------------------------------------- /downloads/daa/8.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Kruskals { 4 | public int cost[][] = new int[10][10]; 5 | public int parent[] = new int[10]; 6 | public int minCost; 7 | 8 | public void calc(int n) { 9 | int i, j, min = 999, num_edges = 1, a = 1, b = 1, minpos_i = 1, minpos_j = 1; 10 | parent[minpos_i] = 0; 11 | parent[minpos_j] = 0; 12 | while (num_edges < n) { 13 | for (i = 1, min = 999; i <= n; i++) 14 | for (j = 1; j <= n; j++) 15 | if (this.cost[i][j] < min) { 16 | min = this.cost[i][j]; 17 | a = minpos_i = i; 18 | b = minpos_j = j; 19 | } 20 | while (parent[minpos_i] != 0) 21 | minpos_i = parent[minpos_i]; 22 | while (parent[minpos_j] != 0) 23 | minpos_j = parent[minpos_j]; 24 | if (minpos_i != minpos_j) { 25 | System.out.println("\t from Vertex " + a + " to Vertex " + b + " mincost:" + min + " \n"); 26 | this.minCost = this.minCost + min; 27 | num_edges = num_edges + 1; 28 | this.parent[minpos_j] = minpos_i; 29 | } 30 | this.cost[a][b] = this.cost[b][a] = 999; 31 | } 32 | System.out.println("MINIMUM COST SPANNING TREE " + this.minCost); 33 | } 34 | 35 | public static void main(String[] args) { 36 | int i, j, n; 37 | Scanner scan = new Scanner(System.in); 38 | Kruskals k = new Kruskals(); 39 | 40 | System.out.println("Enter the number of nodes"); 41 | n = scan.nextInt(); 42 | 43 | System.out.println("Enter the cost matrix weights"); 44 | for (i = 1; i <= n; i++) { 45 | for (j = 1; j <= n; j++) { 46 | k.cost[i][j] = scan.nextInt(); 47 | if (k.cost[i][j] == 0) 48 | k.cost[i][j] = 999; 49 | } 50 | } 51 | k.calc(n); 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /downloads/dsa/12.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define MAX 100 4 | int main() 5 | { 6 | int n, m, ht[MAX], i, j, k, rec, address, homebucket, currentbucket, 7 | count = 0, choice; 8 | printf("Enter the number of employee records : "); 9 | scanf("%d", &n); 10 | for (i = 0; i < MAX; i++) 11 | ht[i] = -1; 12 | for (k = 0; k < n; k++) 13 | { 14 | printf("\nEnter the record %d\n", k + 1); 15 | scanf("%d", &rec); 16 | address = rec % MAX; 17 | homebucket = address; 18 | currentbucket = homebucket; 19 | while (ht[currentbucket] != -1) 20 | { 21 | currentbucket = (currentbucket + 1) % MAX; 22 | if (currentbucket == homebucket) 23 | { 24 | printf("Hash Table Overflow"); 25 | exit(0); 26 | } 27 | count++; 28 | } 29 | if (count != 0) 30 | printf("Collision occured %d times and solved using Linear Probing\n", count); 31 | count = 0; 32 | ht[currentbucket] = rec; 33 | printf("Record : %d\nHome Address : %d\nCurrent Adrress : %d\n", rec, homebucket, currentbucket); 34 | } 35 | printf("\nHASH TABLE DISPLAY\n"); 36 | while (1) 37 | { 38 | printf("\n\n**********************MENU*****************"); 39 | printf("\n1. Complete Hash table contents\n2. Hash Table showing only record entries\n3. Exit\n\n"); 40 | printf("Enter your choice : "); 41 | scanf("%d", &choice); 42 | switch (choice) 43 | { 44 | case 1: 45 | printf("Complete Hash Table Contents :\n"); 46 | for (j = 0; j < MAX; j++) 47 | printf("%d %d\n", j, ht[j]); 48 | break; 49 | case 2: 50 | printf("Hash Table showing Records : \n"); 51 | for (j = 0; j < MAX; j++) 52 | if (ht[j] != -1) 53 | printf("%d %d\n", j, ht[j]); 54 | break; 55 | case 3: 56 | exit(0); 57 | break; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /downloads/daa/1b.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Stack { 4 | private static final int max_size = 5; 5 | 6 | int[] arr = new int[max_size]; 7 | int top = -1; 8 | 9 | public void push(int ele) { 10 | if (top < max_size - 1) { 11 | System.out.println("the element added is " + ele); 12 | top++; 13 | arr[top] = ele; 14 | } else { 15 | System.out.println("Error: StackOverflow"); 16 | } 17 | } 18 | 19 | public void pop() { 20 | if (top >= 0) { 21 | System.out.println("the element poped is " + arr[top]); 22 | top--; 23 | } else { 24 | System.out.println("Error: Stack underflow"); 25 | } 26 | } 27 | 28 | public void display_stack_contents() { 29 | if (top >= 0) { 30 | for (int i = 0; i <= top; i++) { 31 | System.out.println(arr[i] + " "); 32 | } 33 | } else { 34 | System.out.println("stack is empty"); 35 | } 36 | } 37 | 38 | public static void main(String[] args) { 39 | Stack stack = new Stack(); 40 | Scanner scan = new Scanner(System.in); 41 | 42 | int elem; 43 | boolean whileLoop = true; 44 | 45 | do { 46 | System.out.println("Enter your choice: \n 1.push \n 2.pop \n 3.dispaly \n 4.exit \n"); 47 | int choice = scan.nextInt(); 48 | 49 | switch (choice) { 50 | case 1: 51 | System.out.println("Enter the element to be inserted \n"); 52 | elem = scan.nextInt(); 53 | stack.push(elem); 54 | break; 55 | case 2: 56 | stack.pop(); 57 | break; 58 | case 3: 59 | stack.display_stack_contents(); 60 | break; 61 | case 4: 62 | whileLoop = false; 63 | break; 64 | default: 65 | System.out.println("invalid input"); 66 | } 67 | } while (whileLoop); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /public/src/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Tools 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 40 | 41 |
42 | 43 |
44 | 45 | 46 | 47 |
48 | 49 | 50 |
51 |
1. Send Mails with our service go to site 52 |
53 |
54 |
55 | 56 | 57 |
58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /downloads/dsa/1.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | int a[50], n; 4 | void create(int a[]) 5 | { 6 | printf("Enter the number of elements to create an array:\t"); 7 | scanf("%d", &n); 8 | printf("\n Enter the elements to be inserted:\n"); 9 | for (int i = 0; i < n; i++) 10 | scanf("%d", &a[i]); 11 | } 12 | void display(int a[]) 13 | { 14 | printf("\nThe array elements are:\n"); 15 | for (int i = 0; i < n; i++) 16 | printf("%d\n", a[i]); 17 | } 18 | void insert(int ele, int pos) 19 | { 20 | n = n + 1; 21 | for (int i = n; i > pos - 1; i--) 22 | { 23 | a[i] = a[i - 1]; 24 | } 25 | a[pos - 1] = ele; 26 | } 27 | void delete (int pos) 28 | { 29 | int ele; 30 | if (pos > n) 31 | { 32 | printf("Invalid position !!!!!! Please enter the valid position"); 33 | } 34 | else 35 | { 36 | ele = a[pos - 1]; 37 | for (int i = pos - 1; i < n; i++) 38 | { 39 | a[i] = a[i + 1]; 40 | } 41 | n = n - 1; 42 | } 43 | } 44 | int main() 45 | { 46 | int elem, pos, choice; 47 | while (1) 48 | { 49 | printf("\n*******************************\n"); 50 | printf("\nEnter your choice : \n1.create\n2.display\n3.insert\n4.delete\n5.exit\n"); 51 | printf("\n-----------------------------\n"); 52 | scanf("%d", &choice); 53 | switch (choice) 54 | { 55 | case 1: 56 | create(a); 57 | break; 58 | case 2: 59 | display(a); 60 | break; 61 | case 3: 62 | printf("Enter the element to be inserted:"); 63 | scanf("%d", &elem); 64 | printf("\nEnter the position:"); 65 | scanf("%d", &pos); 66 | insert(elem, pos); 67 | break; 68 | case 4: 69 | printf("\nEnter the position:"); 70 | scanf("%d", &pos); 71 | delete (pos); 72 | break; 73 | case 5: 74 | exit(0); 75 | break; 76 | default: 77 | printf("Invalid choice!!!"); 78 | break; 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /downloads/dsa/11.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define MAX 10 4 | int source; 5 | void DFS(int a[MAX][MAX], int visited[MAX], int s, int n) 6 | { 7 | int u, v; 8 | u = s; 9 | visited[u] = 1; 10 | if (u != source) 11 | printf(" %d ", u); 12 | for (v = 1; v <= n; v++) 13 | { 14 | if (a[u][v] == 1 && visited[v] == 0) 15 | DFS(a, visited, v, n); 16 | } 17 | } 18 | void BFS(int a[MAX][MAX], int visited[MAX], int source, int n) 19 | { 20 | int queue[MAX], f = 0, r = 0, u, v; 21 | queue[r] = source; 22 | visited[source] = 1; 23 | while (f <= r) 24 | { 25 | u = queue[f++]; 26 | for (v = 1; v <= n; v++) 27 | { 28 | if (a[u][v] == 1 && visited[v] == 0) 29 | { 30 | printf("%d ", v); 31 | visited[v] = 1; 32 | queue[++r] = v; 33 | } 34 | } 35 | } 36 | } 37 | int main() 38 | { 39 | int a[MAX][MAX], visited[MAX], n, choice, i, j, x, y; 40 | printf("Enter the number of vertices in the graph : "); 41 | scanf("%d", &n); 42 | printf("Enter the adjacency matrix for the graph\n"); 43 | for (i = 1; i <= n; i++) 44 | for (j = 1; j <= n; j++) 45 | scanf("%d", &a[i][j]); 46 | printf("Enter the starting node of the graph : "); 47 | scanf("%d", &source); 48 | while (1) 49 | { 50 | printf("\n\n**********************MENU*****************"); 51 | printf("\n1. DFS\n2. BFS\n3. Exit\n"); 52 | printf("Enter your choice : "); 53 | scanf("%d", &choice); 54 | switch (choice) 55 | { 56 | case 1: 57 | printf("Nodes reachable from %d using DFS method\n", source); 58 | for (x = 1; x <= n; x++) 59 | visited[x] = 0; 60 | DFS(a, visited, source, n); 61 | break; 62 | case 2: 63 | printf("Nodes reachable from %d using BFS method\n", source); 64 | for (y = 1; y <= n; y++) 65 | visited[y] = 0; 66 | BFS(a, visited, source, n); 67 | break; 68 | case 3: 69 | exit(0); 70 | break; 71 | } 72 | } 73 | } -------------------------------------------------------------------------------- /routes/userRoutes.js: -------------------------------------------------------------------------------- 1 | require('dotenv').config(); 2 | const express = require('express'); 3 | const bcrypt = require('bcryptjs'); 4 | const jwt = require('jsonwebtoken'); 5 | const User = require('../models/userModel'); 6 | 7 | const router = new express.Router(); 8 | 9 | //? register a new user. 10 | router.post('/register', async (req, res) => { 11 | // make sure everything is passed ie, name,email,password 12 | var { name, email, password } = req.body; 13 | email = email.toLowerCase(); 14 | if (!(name && email && password)) { 15 | return res.status(400).send('pass in name, email, password as JSON object'); 16 | } 17 | 18 | // check if user already exists 19 | const userAlreadyExists = await User.findOne({ email }); 20 | if (userAlreadyExists) { 21 | return res.status(409).send('User already exist, Please Login'); 22 | } 23 | 24 | // encrypt password 25 | const encryptedPassword = await bcrypt.hash(password, 10); 26 | 27 | // save new user to DB 28 | const user = new User({ user: name, email, password: encryptedPassword }); 29 | 30 | try { 31 | await user.save(); 32 | res.status(201).send('new user ' + user.user + ' registered.'); 33 | } catch (e) { 34 | res.status(400).send(e); 35 | } 36 | }); 37 | 38 | //? login route 39 | router.post('/login', async (req, res) => { 40 | try { 41 | const { email, password } = req.body; 42 | // find user by using email and do auth 43 | User.findOne({ email }, (err, user) => { 44 | // no user found with the given email 45 | if (user == null) { 46 | return res 47 | .status(401) 48 | .send({ error: 'No user found, Please Register.' }); 49 | } 50 | 51 | // check password match with found user and passed password 52 | bcrypt.compare(password, user.password).then((passwordMatched) => { 53 | if (passwordMatched) { 54 | // give a jwt 55 | const accessToken = jwt.sign( 56 | { userId: user._id }, 57 | process.env.ACCESS_TOKEN_SECRET 58 | ); 59 | 60 | return res.status(200).send({ accessToken }); 61 | } else { 62 | return res.status(401).send({ error: 'Wrong Password!' }); 63 | } 64 | }); 65 | }); 66 | } catch (e) { 67 | res.status(400).send(e); 68 | } 69 | }); 70 | 71 | module.exports = router; 72 | -------------------------------------------------------------------------------- /downloads/daa/6b.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class GreedyKnapsack { 4 | 5 | static void knapsack(int n, float weight[], float profit[], float capacity) { 6 | float x[] = new float[20], tp = 0; 7 | int i, j, u; 8 | c = (int) capacity; 9 | for (i = 0; i < n; i++) 10 | x[i] = (float) 0.0; 11 | for (i = 0; i < n; i++) { 12 | if (weight[i] > c) 13 | break; 14 | else { 15 | x[i] = (float) 1.0; 16 | tp = tp + profit[i]; 17 | c = (int) (c - weight[i]); 18 | } 19 | } 20 | if (i < n) 21 | x[i] = c / weight[i]; 22 | tp = tp + (x[i] * profit[i]); 23 | System.out.println("the result vector"); 24 | for (i = 0; i < n; i++) 25 | System.out.println(+x[i]); 26 | System.out.println("the total profit is"); 27 | System.out.println(+tp); 28 | } 29 | 30 | public static void main(String[] args) { 31 | float weight[] = new float[20]; 32 | float profit[] = new float[20]; 33 | float capacity; 34 | int num, i, j; 35 | float ratio[] = new float[20], temp; 36 | System.out.println("\nenter the no of objects"); 37 | Scanner s = new Scanner(System.in); 38 | num = s.nextInt(); 39 | System.out.println("\n enter weights and profit of each object"); 40 | for (i = 0; i < num; i++) { 41 | weight[i] = s.nextInt(); 42 | profit[i] = s.nextInt(); 43 | } 44 | System.out.println("\ncapacity of knapsack"); 45 | capacity = s.nextInt(); 46 | for (i = 0; i < num; i++) { 47 | ratio[i] = profit[i] / weight[i]; 48 | } 49 | for (i = 0; i < num; i++) { 50 | for (j = i + 1; j < num; j++) { 51 | if (ratio[i] < ratio[j]) { 52 | temp = ratio[j]; 53 | ratio[j] = ratio[i]; 54 | ratio[i] = temp; 55 | temp = weight[j]; 56 | weight[j] = weight[i]; 57 | weight[i] = temp; 58 | temp = profit[j]; 59 | profit[j] = profit[i]; 60 | profit[i] = temp; 61 | } 62 | } 63 | } 64 | knapsack(num, weight, profit, capacity); 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /downloads/daa/4.java: -------------------------------------------------------------------------------- 1 | import java.util.Random; 2 | import java.util.Scanner; 3 | 4 | public class Quick { 5 | private int[] numbers; 6 | private int size; 7 | 8 | public void sort(int[] values) { 9 | this.numbers = values; 10 | size = values.length; 11 | quicksort(0, size - 1); 12 | 13 | } 14 | 15 | private void quicksort(int low, int high) { 16 | int j; 17 | 18 | if (low <= high) { 19 | j = part(low, high); 20 | quicksort(low, j - 1); 21 | quicksort(j + 1, high); 22 | } 23 | } 24 | 25 | private int part(int low, int high) { 26 | int i, j, pivot; 27 | pivot = numbers[low]; 28 | 29 | i = low + 1; 30 | j = high; 31 | 32 | while (true) { 33 | while (i < high && pivot > numbers[i]) 34 | i++; 35 | while (numbers[j] > pivot) 36 | j--; 37 | 38 | if (i < j) { 39 | int temp = numbers[i]; 40 | numbers[i] = numbers[j]; 41 | numbers[j] = temp; 42 | } else { 43 | int temp = numbers[low]; 44 | numbers[low] = numbers[j]; 45 | numbers[j] = temp; 46 | return j; 47 | } 48 | } 49 | } 50 | 51 | public static void main(String[] args) { 52 | Quick sorter = new Quick(); 53 | 54 | int[] numbers; 55 | int size; 56 | 57 | Scanner scan = new Scanner(System.in); 58 | System.out.println("Enter the size of the array"); 59 | size = scan.nextInt(); 60 | 61 | numbers = new int[size]; 62 | System.out.println("\n The elements of the array"); 63 | Random random = new Random(); 64 | 65 | for (int i = 0; i < size; i++) 66 | numbers[i] = Math.abs(random.nextInt(100)); 67 | 68 | for (int i = 0; i < size; i++) 69 | System.out.print("\t" + numbers[i]); 70 | System.out.println(); 71 | 72 | long startTime = System.currentTimeMillis(); 73 | sorter.sort(numbers); 74 | long stopTime = System.currentTimeMillis(); 75 | long elapsedTime = stopTime - startTime; 76 | System.out.println("\n The sorted array is"); 77 | for (int i : numbers) 78 | System.out.print("\t" + i); 79 | 80 | System.out.print("\nTime Taken " + elapsedTime); 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /downloads/daa/5.java: -------------------------------------------------------------------------------- 1 | import java.util.Random; 2 | import java.util.Scanner; 3 | 4 | public class Merge { 5 | private int[] numbers; 6 | private int[] c; 7 | 8 | private int number; 9 | 10 | public void sort(int[] values) { 11 | if (values == null || values.length == 0) 12 | return; 13 | 14 | this.numbers = values; 15 | number = values.length; 16 | this.c = new int[number]; 17 | 18 | mergesort(0, number - 1); 19 | } 20 | 21 | public void mergesort(int low, int high) { 22 | if (low < high) { 23 | int mid = (low + high) / 2; 24 | 25 | mergesort(low, mid); 26 | mergesort(mid + 1, high); 27 | mergearray(low, mid, high); 28 | } 29 | } 30 | 31 | public void mergearray(int low, int mid, int high) { 32 | int i = low; 33 | int j = mid + 1; 34 | int k = low; 35 | 36 | while (i < mid && j < high) { 37 | if (numbers[i] < numbers[j]) 38 | c[k++] = numbers[i++]; 39 | else 40 | c[k++] = numbers[j++]; 41 | } 42 | 43 | while (i <= mid) 44 | c[k++] = numbers[i++]; 45 | while (j <= high) 46 | c[k++] = numbers[j++]; 47 | 48 | for (i = low; i <= high; i++) 49 | numbers[i] = c[i]; 50 | } 51 | 52 | public static void main(String[] args) { 53 | Merge sorter = new Merge(); 54 | int[] numbers; 55 | int number; 56 | int[] c; 57 | 58 | Scanner scan = new Scanner(System.in); 59 | 60 | System.out.println("Enter size of the array"); 61 | number = scan.nextInt(); 62 | 63 | numbers = new int[number]; 64 | 65 | System.out.println("The elements of the array"); 66 | Random random = new Random(); 67 | 68 | for (int i = 0; i < number; i++) 69 | numbers[i] = Math.abs(random.nextInt(5000)); 70 | 71 | for (int i = 0; i < number; i++) 72 | System.out.print("\t" + numbers[i]); 73 | System.out.println(); 74 | 75 | long statTime = System.currentTimeMillis(); 76 | sorter.sort(numbers); 77 | long stopTime = System.currentTimeMillis(); 78 | long elapsedTime = stopTime - statTime; 79 | 80 | System.out.println("sorted array is"); 81 | for (int i : numbers) 82 | System.out.print("\t" + i); 83 | 84 | System.out.println(); 85 | System.out.println("time taken " + elapsedTime); 86 | 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /downloads/dsa/4.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | void evaluate(); 4 | void push(char); 5 | char pop(); 6 | int prec(char); 7 | char infix[30], postfix[30], stack[30]; 8 | int top = -1; 9 | int main() 10 | { 11 | printf("\nEnter the valid infix expression:\t"); 12 | scanf("%s", infix); 13 | evaluate(); 14 | printf("\nThe entered infix expression is :\n %s \n", infix); 15 | printf("\nThe corresponding postfix expression is :\n %s \n", postfix); 16 | } 17 | void evaluate() 18 | { 19 | int i = 0, j = 0; 20 | char symb, temp; 21 | push('#'); 22 | for (i = 0; infix[i] != '\0'; i++) 23 | { 24 | symb = infix[i]; 25 | switch (symb) 26 | { 27 | case '(': 28 | push(symb); 29 | break; 30 | case ')': 31 | temp = pop(); 32 | while (temp != '(') 33 | { 34 | postfix[j] = temp; 35 | j++; 36 | temp = pop(); 37 | } 38 | break; 39 | case '+': 40 | case '-': 41 | case '*': 42 | case '/': 43 | case '%': 44 | case '^': 45 | case '$': 46 | while (prec(stack[top]) >= prec(symb)) 47 | { 48 | temp = pop(); 49 | postfix[j] = temp; 50 | j++; 51 | } 52 | push(symb); 53 | break; 54 | default: 55 | postfix[j] = symb; 56 | j++; 57 | } 58 | } 59 | while (top > 0) 60 | { 61 | temp = pop(); 62 | postfix[j] = temp; 63 | j++; 64 | } 65 | postfix[j] = '\0'; 66 | } 67 | void push(char item) 68 | { 69 | top = top + 1; 70 | stack[top] = item; 71 | } 72 | char pop() 73 | { 74 | char item; 75 | item = stack[top]; 76 | top = top - 1; 77 | return item; 78 | } 79 | int prec(char symb) 80 | { 81 | int p; 82 | switch (symb) 83 | { 84 | case '#': 85 | p = -1; 86 | break; 87 | case '(': 88 | case ')': 89 | p = 0; 90 | break; 91 | case '+': 92 | case '-': 93 | p = 1; 94 | break; 95 | case '*': 96 | case '/': 97 | case '%': 98 | p = 2; 99 | break; 100 | case '^': 101 | case '$': 102 | p = 3; 103 | break; 104 | } 105 | return p; 106 | } -------------------------------------------------------------------------------- /public/src/prism.css: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.23.0 2 | https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+c+cpp&plugins=highlight-keywords+normalize-whitespace */ 3 | /** 4 | * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML 5 | * Based on https://github.com/chriskempson/tomorrow-theme 6 | * @author Rose Pritchard 7 | */ 8 | 9 | code[class*='language-'], 10 | pre[class*='language-'] { 11 | color: #ccc; 12 | background: none; 13 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 14 | font-size: 1em; 15 | text-align: left; 16 | white-space: pre; 17 | word-spacing: normal; 18 | word-break: normal; 19 | word-wrap: normal; 20 | line-height: 1.5; 21 | 22 | -moz-tab-size: 4; 23 | -o-tab-size: 4; 24 | tab-size: 4; 25 | 26 | -webkit-hyphens: none; 27 | -moz-hyphens: none; 28 | -ms-hyphens: none; 29 | hyphens: none; 30 | } 31 | 32 | /* Code blocks */ 33 | pre[class*='language-'] { 34 | padding: 1em; 35 | margin: 0.5em 0; 36 | overflow: auto; 37 | } 38 | 39 | :not(pre) > code[class*='language-'], 40 | pre[class*='language-'] { 41 | background: #2d2d2d; 42 | } 43 | 44 | /* Inline code */ 45 | :not(pre) > code[class*='language-'] { 46 | padding: 0.1em; 47 | border-radius: 0.3em; 48 | white-space: normal; 49 | } 50 | 51 | .token.comment, 52 | .token.block-comment, 53 | .token.prolog, 54 | .token.doctype, 55 | .token.cdata { 56 | color: #999; 57 | } 58 | 59 | .token.punctuation { 60 | color: #ccc; 61 | } 62 | 63 | .token.tag, 64 | .token.attr-name, 65 | .token.namespace, 66 | .token.deleted { 67 | color: #e2777a; 68 | } 69 | 70 | .token.function-name { 71 | color: #6196cc; 72 | } 73 | 74 | .token.boolean, 75 | .token.number, 76 | .token.function { 77 | color: #f08d49; 78 | } 79 | 80 | .token.property, 81 | .token.class-name, 82 | .token.constant, 83 | .token.symbol { 84 | color: #f8c555; 85 | } 86 | 87 | .token.selector, 88 | .token.important, 89 | .token.atrule, 90 | .token.keyword, 91 | .token.builtin { 92 | color: #cc99cd; 93 | } 94 | 95 | .token.string, 96 | .token.char, 97 | .token.attr-value, 98 | .token.regex, 99 | .token.variable { 100 | color: #7ec699; 101 | } 102 | 103 | .token.operator, 104 | .token.entity, 105 | .token.url { 106 | color: #67cdcc; 107 | } 108 | 109 | .token.important, 110 | .token.bold { 111 | font-weight: bold; 112 | } 113 | .token.italic { 114 | font-style: italic; 115 | } 116 | 117 | .token.entity { 118 | cursor: help; 119 | } 120 | 121 | .token.inserted { 122 | color: green; 123 | } 124 | -------------------------------------------------------------------------------- /downloads/cn/2.tcl: -------------------------------------------------------------------------------- 1 | set ns [ new Simulator] 2 | set nf [ open 108.nam w] 3 | $ns namtrace-all $nf 4 | set tf [open 108.tr w] 5 | $ns trace-all $tf 6 | set n0 [$ns node] 7 | set n1 [$ns node] 8 | set n2 [$ns node] 9 | set n3 [$ns node] 10 | set n4 [$ns node] 11 | set n5 [$ns node] 12 | $n4 shape box 13 | $ns duplex-link $n0 $n4 1005Mb 1ms DropTail 14 | $ns duplex-link $n1 $n4 50Mb 1ms DropTail 15 | $ns duplex-link $n2 $n4 2000Mb 1ms DropTail 16 | $ns duplex-link $n3 $n4 200Mb 1ms DropTail 17 | $ns duplex-link $n4 $n5 1Mb 1ms DropTail 18 | set p1 [new Agent/Ping] 19 | $ns attach-agent $n0 $p1 20 | $p1 set packetSize_ 50000 21 | $p1 set interval_ 0.0001 22 | set p2 [new Agent/Ping] 23 | $ns attach-agent $n1 $p2 24 | set p3 [new Agent/Ping] 25 | $ns attach-agent $n2 $p3 26 | $p3 set packetSize_ 30000 27 | $p3 set interval_ 0.00001 28 | set p4 [new Agent/Ping] 29 | $ns attach-agent $n3 $p4 30 | set p5 [new Agent/Ping] 31 | $ns attach-agent $n5 $p5 32 | $ns queue-limit $n0 $n4 5 33 | $ns queue-limit $n2 $n4 3 34 | $ns queue-limit $n4 $n5 2 35 | Agent/Ping instproc recv {from rtt} { 36 | $self instvar node_ 37 | puts "nod [$node_ id] received answer from $from wiht round trip time $rtt msec" 38 | } 39 | $ns connect $p1 $p5 40 | $ns connect $p3 $p4 41 | proc finish {} { 42 | global ns nf tf 43 | $ns flush-trace 44 | close $nf 45 | close $tf 46 | exec nam 108.nam & 47 | exit 0 48 | } 49 | $ns at 0.1 "$p1 send" 50 | $ns at 0.2 "$p1 send" 51 | $ns at 0.3 "$p1 send" 52 | $ns at 0.4 "$p1 send" 53 | $ns at 0.5 "$p1 send" 54 | $ns at 0.6 "$p1 send" 55 | $ns at 0.7 "$p1 send" 56 | $ns at 0.8 "$p1 send" 57 | $ns at 0.9 "$p1 send" 58 | $ns at 1.0 "$p1 send" 59 | $ns at 1.1 "$p1 send" 60 | $ns at 1.2 "$p1 send" 61 | $ns at 1.3 "$p1 send" 62 | $ns at 1.4 "$p1 send" 63 | $ns at 1.5 "$p1 send" 64 | $ns at 1.6 "$p1 send" 65 | $ns at 1.7 "$p1 send" 66 | $ns at 1.8 "$p1 send" 67 | $ns at 1.9 "$p1 send" 68 | $ns at 2.0 "$p1 send" 69 | $ns at 2.1 "$p1 send" 70 | $ns at 2.2 "$p1 send" 71 | $ns at 2.3 "$p1 send" 72 | $ns at 2.4 "$p1 send" 73 | $ns at 2.5 "$p1 send" 74 | $ns at 2.6 "$p1 send" 75 | $ns at 2.7 "$p1 send" 76 | $ns at 2.8 "$p1 send" 77 | $ns at 2.9 "$p1 send" 78 | $ns at 0.1 "$p3 send" 79 | $ns at 0.2 "$p3 send" 80 | $ns at 0.3 "$p3 send" 81 | $ns at 0.4 "$p3 send" 82 | $ns at 0.5 "$p3 send" 83 | $ns at 0.6 "$p3 send" 84 | $ns at 0.7 "$p3 send" 85 | $ns at 0.8 "$p3 send" 86 | $ns at 0.9 "$p3 send" 87 | $ns at 1.0 "$p3 send" 88 | $ns at 1.1 "$p3 send" 89 | $ns at 1.2 "$p3 send" 90 | $ns at 1.3 "$p3 send" 91 | $ns at 1.4 "$p3 send" 92 | $ns at 1.5 "$p3 send" 93 | $ns at 1.6 "$p3 send" 94 | $ns at 1.7 "$p3 send" 95 | $ns at 1.8 "$p3 send" 96 | $ns at 1.9 "$p3 send" 97 | $ns at 2.0 "$p3 send" 98 | $ns at 2.1 "$p3 send" 99 | $ns at 2.2 "$p3 send" 100 | $ns at 2.3 "$p3 send" 101 | $ns at 2.4 "$p3 send" 102 | $ns at 2.5 "$p3 send" 103 | $ns at 2.6 "$p3 send" 104 | $ns at 2.7 "$p3 send" 105 | $ns at 2.8 "$p3 send" 106 | $ns at 2.9 "$p3 send" 107 | $ns at 3.0 "finish" 108 | $ns run 109 | 110 | -------------------------------------------------------------------------------- /downloads/dsa/6.c: -------------------------------------------------------------------------------- 1 | 2 | #include 3 | #include 4 | #define max 3 5 | char cqueue[max]; 6 | int front = -1; 7 | int rear = -1; 8 | void enqueue() 9 | { 10 | if (front == rear + 1 || (front == 0 && rear == max - 1)) 11 | { 12 | printf("\n!!!!!!***** Circular Queue is full... *****!!!!!!\n"); 13 | } 14 | else 15 | { 16 | char ele; 17 | printf("Enter the element which is to be inserted: "); 18 | getc(stdin); 19 | scanf("%c", &ele); 20 | 21 | if (front == -1 && rear == -1) 22 | { 23 | front = 0; 24 | rear = 0; 25 | } 26 | else if (front != 0 && rear == max - 1) 27 | { 28 | rear = 0; 29 | } 30 | else 31 | { 32 | rear++; 33 | } 34 | 35 | cqueue[rear] = ele; 36 | } 37 | } 38 | 39 | void dequeue() 40 | { 41 | if (front == -1 && rear == -1) 42 | { 43 | printf("\n!!!!! Circular Queue is empty...!!!!!\n"); 44 | } 45 | else 46 | { 47 | char ele = cqueue[front]; 48 | if (front == rear) 49 | { 50 | 51 | front = -1; 52 | rear = -1; 53 | } 54 | else if (front == max - 1) 55 | { 56 | front = 0; 57 | } 58 | else 59 | { 60 | front = front + 1; 61 | } 62 | 63 | printf("\nThe dequeued element is %c", ele); 64 | } 65 | } 66 | 67 | void display() 68 | { 69 | int i, j; 70 | if (front == -1 && rear == -1) 71 | { 72 | printf("\n!!!!! Circular Queue is empty...!!!!!\n"); 73 | } 74 | printf("The elements in a circular queue are: "); 75 | if (front > rear) 76 | { 77 | for (i = front; i <= max; i++) 78 | { 79 | printf("\t%c", cqueue[i]); 80 | } 81 | for (j = 0; j <= rear; j++) 82 | { 83 | printf("\t%c", cqueue[j]); 84 | } 85 | } 86 | else 87 | { 88 | for (i = front; i <= rear; i++) 89 | { 90 | printf("\t%c", cqueue[i]); 91 | } 92 | } 93 | printf("\n"); 94 | } 95 | int main() 96 | { 97 | 98 | int choice; 99 | char ele; 100 | 101 | while (1) 102 | { 103 | printf("\n *** Menu ***\n1: Insert an element"); 104 | printf("\n2: Delete an element"); 105 | printf("\n3: Display the element"); 106 | printf("\n4: Exit"); 107 | printf("\n"); 108 | printf("\nEnter your choice: "); 109 | scanf("%d", &choice); 110 | 111 | switch (choice) 112 | { 113 | 114 | case 1: 115 | enqueue(); 116 | break; 117 | case 2: 118 | dequeue(); 119 | break; 120 | case 3: 121 | display(); 122 | break; 123 | case 4: 124 | exit(0); 125 | default: 126 | printf("Invalid choice..."); 127 | break; 128 | } 129 | } 130 | return 0; 131 | } 132 | -------------------------------------------------------------------------------- /downloads/dsa/3.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #define MAX 3 5 | 6 | void push(int[], int, int); 7 | int pop(int[], int); 8 | void palin(int[], int); 9 | void display(int[], int); 10 | 11 | int main() 12 | { 13 | int choice, stack[MAX], top = -1, ele; 14 | while (1) 15 | { 16 | printf("\n\n***************menu***************"); 17 | printf("\n 1. push an elelment to stack \n 2. pop an element from stack\n 3. checking stack for palindrome\n 4. display the status of the stacks\n 5. exit\n"); 18 | printf("enteryour choice : "); 19 | scanf("%d", &choice); 20 | switch (choice) 21 | { 22 | case 1: 23 | if (top < MAX - 1) 24 | { 25 | 26 | printf("Enter the Element to be pushed :"); 27 | scanf("%d", &ele); 28 | top++; 29 | push(stack, ele, top); 30 | } 31 | else 32 | printf("stack is full\n"); 33 | break; 34 | 35 | case 2: 36 | if (top >= 0) 37 | { 38 | ele = pop(stack, top); 39 | top--; 40 | printf("The element popped is %d ", ele); 41 | break; 42 | } 43 | else 44 | { 45 | printf("Stack is empty\n"); 46 | break; 47 | } 48 | 49 | case 3: 50 | palin(stack, top); 51 | break; 52 | 53 | case 4: 54 | display(stack, top); 55 | break; 56 | 57 | case 5: 58 | exit(0); 59 | } 60 | } 61 | } 62 | 63 | void push(int stack[MAX], int ele, int top) 64 | { 65 | stack[top] = ele; 66 | } 67 | 68 | int pop(int stack[MAX], int top) 69 | { 70 | return stack[top]; 71 | } 72 | 73 | void palin(int stack[MAX], int top) 74 | { 75 | int i, num = 0, count = 0, temp = 0, dup = 0, digit = 0, rev = 0; 76 | if (top >= 0) 77 | { 78 | for (i = top; i >= 0; i--) 79 | { 80 | num = stack[i]; 81 | while (num != 0) 82 | { 83 | num = num / 10; 84 | count++; 85 | } 86 | temp = temp * pow(10, count) + stack[i]; 87 | count = 0; 88 | } 89 | dup = temp; 90 | while (temp != 0) 91 | { 92 | digit = temp % 10; 93 | rev = rev * 10 + digit; 94 | temp = temp / 10; 95 | } 96 | if (dup == rev) 97 | printf("the content of the stack is pallindrome"); 98 | else 99 | printf("the content of the stack is not pallindrome"); 100 | } 101 | else 102 | printf("stack is empty\n"); 103 | } 104 | void display(int stack[MAX], int top) 105 | { 106 | int i; 107 | if (top >= 0) 108 | { 109 | printf("the elements of stack are \n\n"); 110 | for (i = 0; i <= top; i++) 111 | printf("%d ", stack[i]); 112 | } 113 | else 114 | printf("stack is empty\n"); 115 | } 116 | -------------------------------------------------------------------------------- /downloads/daa/2a.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Staff { 4 | private String staffId; 5 | private String name; 6 | private long phone; 7 | private int salary; 8 | 9 | void accept() { 10 | Scanner scan = new Scanner(System.in); 11 | System.out.println("Enter the Staffid"); 12 | staffId = scan.next(); 13 | System.out.println("Enter the Name"); 14 | name = scan.next(); 15 | System.out.println("Enter the Phone"); 16 | phone = scan.nextLong(); 17 | System.out.println("Enter the Salary"); 18 | salary = scan.nextInt(); 19 | } 20 | 21 | public void display() { 22 | System.out.println("Staff Id: " + staffId); 23 | System.out.println("Name: " + name); 24 | System.out.println("Phone: " + phone); 25 | System.out.println("Salary: " + salary); 26 | } 27 | } 28 | 29 | class Teaching extends Staff { 30 | private String domain; 31 | private String[] publications; 32 | 33 | public void accept() { 34 | super.accept(); 35 | Scanner scan = new Scanner(System.in); 36 | 37 | System.out.println("enter the domain"); 38 | domain = scan.next(); 39 | System.out.println("Enter the number of publication"); 40 | int n = scan.nextInt(); 41 | publications = new String[n]; 42 | 43 | System.out.println("Enter the Publications"); 44 | for (int i = 0; i < n; i++) { 45 | publications[i] = scan.next(); 46 | } 47 | } 48 | 49 | public void display() { 50 | super.display(); 51 | System.out.println("domain: " + domain); 52 | for (int i = 0; i < publications.length; i++) { 53 | System.out.println(publications[i]); 54 | } 55 | } 56 | } 57 | 58 | class Technical extends Staff { 59 | private String[] skills; 60 | 61 | public void accept() { 62 | super.accept(); 63 | Scanner scan = new Scanner(System.in); 64 | 65 | System.out.println("Enter the number of skills"); 66 | int n = scan.nextInt(); 67 | skills = new String[n]; 68 | 69 | System.out.println("Enter the skills"); 70 | for (int i = 0; i < n; i++) { 71 | skills[i] = scan.next(); 72 | } 73 | } 74 | 75 | public void display() { 76 | super.display(); 77 | System.out.println("Skills: "); 78 | for (int i = 0; i < skills.length; i++) { 79 | System.out.println(skills[i]); 80 | } 81 | } 82 | } 83 | 84 | class Contract extends Staff { 85 | private int period; 86 | 87 | public void accept() { 88 | super.accept(); 89 | Scanner scan = new Scanner(System.in); 90 | 91 | System.out.println("Enter Time period"); 92 | period = scan.nextInt(); 93 | } 94 | 95 | public void display() { 96 | super.display(); 97 | System.out.println("Period: " + period); 98 | } 99 | } 100 | 101 | class Main { 102 | public static void main(String[] args) { 103 | Teaching teaching = new Teaching(); 104 | Technical technical = new Technical(); 105 | Contract contract = new Contract(); 106 | 107 | System.out.println("Enter the details for Teaching Staff"); 108 | teaching.accept(); 109 | System.out.println("Enter the details for Technical Staff"); 110 | technical.accept(); 111 | System.out.println("Enter the details for contract Staff"); 112 | contract.accept(); 113 | 114 | System.out.println("Details for Teaching Staff"); 115 | teaching.display(); 116 | System.out.println("Details for Technical Staff"); 117 | technical.display(); 118 | System.out.println("Details for Contract Staff"); 119 | contract.display(); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /downloads/dsa/10.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #define MAX 20 4 | struct node 5 | { 6 | int data; 7 | struct node *lchild, *rchild; 8 | }; 9 | typedef struct node *NODE; 10 | NODE tree = NULL; 11 | void CreateBST(int a[MAX], int n) 12 | { 13 | NODE temp, p, q; 14 | int i; 15 | for (i = 0; i < n; i++) 16 | { 17 | temp = (struct node *)malloc(sizeof(struct node *)); 18 | temp->data = a[i]; 19 | temp->lchild = temp->rchild = NULL; 20 | if (tree == NULL) 21 | tree = temp; 22 | else 23 | { 24 | p = q = tree; 25 | while (q != NULL) 26 | { 27 | p = q; 28 | if (a[i] < p->data) 29 | q = p->lchild; 30 | else if (a[i] > p->data) 31 | q = p->rchild; 32 | else 33 | { 34 | free(temp); 35 | break; 36 | } 37 | } 38 | if (q == NULL) 39 | { 40 | if (a[i] < p->data) 41 | p->lchild = temp; 42 | else 43 | p->rchild = temp; 44 | } 45 | } 46 | } 47 | printf("Binary Seacrh Tree created\n\n"); 48 | } 49 | void Inorder(NODE tree) 50 | { 51 | if (tree != NULL) 52 | { 53 | Inorder(tree->lchild); 54 | printf("%d ", tree->data); 55 | Inorder(tree->rchild); 56 | } 57 | } 58 | void Preorder(NODE tree) 59 | { 60 | if (tree != NULL) 61 | { 62 | printf("%d ", tree->data); 63 | Preorder(tree->lchild); 64 | Preorder(tree->rchild); 65 | } 66 | } 67 | void Postorder(NODE tree) 68 | { 69 | if (tree != NULL) 70 | { 71 | Postorder(tree->lchild); 72 | Postorder(tree->rchild); 73 | printf("%d ", tree->data); 74 | } 75 | } 76 | void SearchBST() 77 | { 78 | NODE temp1; 79 | int key; 80 | printf("Enter the key to be searched : "); 81 | scanf("%d", &key); 82 | temp1 = tree; 83 | while (temp1 != NULL) 84 | { 85 | if (key == temp1->data) 86 | { 87 | printf("The key %d found in the BST", key); 88 | return; 89 | } 90 | else if (key < temp1->data) 91 | temp1 = temp1->lchild; 92 | else 93 | temp1 = temp1->rchild; 94 | } 95 | printf("Key %d not found in the BST", key); 96 | } 97 | int main() 98 | { 99 | int a[MAX], n, i, choice; 100 | while (1) 101 | { 102 | printf("\n\n****MENU***"); 103 | printf("\n1. Create a BST of n integers\n2. Traverse the BST inInorder\n3. Traverse the BST in Preorder\n4. Traverse the BST inPostorder\n5. Search the BST for a given element (KEY)\n6. Exit\n"); 104 | printf("Enter your choice : "); 105 | scanf("%d", &choice); 106 | switch (choice) 107 | { 108 | case 1: 109 | printf("Enter the number of integers : "); 110 | scanf("%d", &n); 111 | printf("Enter the elements\n"); 112 | for (i = 0; i < n; i++) 113 | scanf("%d", &a[i]); 114 | CreateBST(a, n); 115 | break; 116 | case 2: 117 | printf("Inorder Traversal :\n"); 118 | Inorder(tree); 119 | break; 120 | case 3: 121 | printf("Preorder Traversal :\n"); 122 | Preorder(tree); 123 | break; 124 | case 4: 125 | printf("Postoder Traversal :\n"); 126 | Postorder(tree); 127 | break; 128 | case 5: 129 | SearchBST(); 130 | break; 131 | case 6: 132 | exit(0); 133 | break; 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /routes/codeRoutes.js: -------------------------------------------------------------------------------- 1 | const express = require('express'); 2 | const { authenticateJWT } = require('../middleware/authJWT'); 3 | const Code = require('../models/codeModel'); 4 | const Trash = require('../models/trashModel'); 5 | const User = require('../models/userModel'); 6 | 7 | const router = new express.Router(); 8 | 9 | //? get info about the server 10 | router.get('/api', (req, res) => { 11 | return res.send( 12 | ` 13 | Server Status: OK 14 |
\n 15 | ----- routes -------
\n 16 | GET #/codes #/code:id #/trashBin
\n 17 | POST #/code
\n 18 | PUT #/codes:id
\n 19 | DELETE #/codes:id(auth) #/trashBin:id
\n 20 |
\n 21 | GET #/download/ls #/download/:sub/:programNo 22 | ` 23 | ); 24 | }); 25 | 26 | //? create a new code file 27 | router.post('/code', async (req, res) => { 28 | const code = new Code(req.body); 29 | 30 | try { 31 | await code.save(); 32 | res.status(201).send(code); 33 | } catch (e) { 34 | res.status(400).send(e); 35 | } 36 | }); 37 | 38 | //? Read all code files 39 | router.get('/codes', async (req, res) => { 40 | try { 41 | const codes = await Code.find().sort({ posted: 'desc' }); 42 | res.status(200).send(codes); 43 | } catch (e) { 44 | res.status(400).send(e); 45 | } 46 | }); 47 | 48 | //? get one by ID 49 | router.get('/codes/:id', async (req, res) => { 50 | const _id = req.params.id; 51 | try { 52 | const code = await Code.findById(_id); 53 | if (!code) { 54 | return res.status(404).send({ error: 'The Code post does not exist.' }); 55 | } 56 | res.status(200).send(code); 57 | } catch (e) { 58 | res.status(500).send(e); 59 | } 60 | }); 61 | 62 | //? delete a code file 63 | router.delete('/codes/:id', authenticateJWT, async (req, res) => { 64 | const _id = req.params.id; // the id of the code needs to be deleted 65 | const uid = req.user.userId; // the users id who is logged in now 66 | 67 | var trashSchema = {}; // the object to save to trash 68 | 69 | try { 70 | const deletedCode = await Code.findByIdAndDelete(_id).lean(); 71 | // const deletedCode = await Code.findById(_id).lean(); 72 | if (deletedCode) { 73 | const user = await User.findById(uid); // get the user info with id 74 | trashSchema = deletedCode; 75 | delete trashSchema._id; // delete the id field 76 | trashSchema.deletedOn = Date.now(); // adding two new fields 77 | trashSchema.deletedBy = user.user; // name of the user. 78 | const trash = await new Trash(trashSchema).save(); // save the deleted code to trash. 79 | } 80 | 81 | if (!deletedCode) { 82 | return res.status(404).send({ response: 'Code file not found.' }); 83 | } 84 | 85 | res 86 | .status(200) 87 | .send({ response: 'Deleted and Moved to Recently deleted.' }); 88 | } catch (e) { 89 | res.status(500).send(e); 90 | console.log(e); 91 | } 92 | }); 93 | 94 | //? update a file 95 | router.put('/codes/:id', async (req, res) => { 96 | const _id = req.params.id; 97 | const updates = Object.keys(req.body); 98 | const updateCode = req.body; 99 | // console.log(updates); 100 | try { 101 | let code = await Code.findById(_id); 102 | 103 | if (!code) { 104 | return res.status(404).send({ response: 'Code file not found' }); 105 | } 106 | 107 | // console.log(code.author); 108 | // console.log(updateCode.description); 109 | console.log(code); 110 | updates.forEach((update) => { 111 | code[update] = updateCode.update; 112 | }); 113 | console.log(code); 114 | 115 | res.status(404).send({ response: 'updating a code is under maintenance' }); 116 | } catch (e) { 117 | res.status(500).send(e); 118 | } 119 | }); 120 | 121 | //! trash bin routes 122 | 123 | //? Read all codes recently deleted 124 | router.get('/trashBin', async (req, res) => { 125 | try { 126 | const trash = await Trash.find().sort({ posted: 'desc' }); 127 | res.status(200).send(trash); 128 | } catch (e) { 129 | res.status(400).send(e); 130 | } 131 | }); 132 | 133 | router.delete('/trashBin/:id', async (req, res) => { 134 | const _id = req.params.id; 135 | 136 | try { 137 | const deletedFromBin = await Trash.findByIdAndDelete(_id); 138 | 139 | if (!deletedFromBin) { 140 | return res.status(404).send({ response: 'Code file not found.' }); 141 | } 142 | 143 | res 144 | .status(200) 145 | .send({ response: 'Deleted and Moved to Recently deleted.' }); 146 | } catch (e) { 147 | res.status(500).send(e); 148 | console.log(e); 149 | } 150 | }); 151 | 152 | module.exports = router; 153 | -------------------------------------------------------------------------------- /downloads/cn/5.tcl: -------------------------------------------------------------------------------- 1 | # This script is created by NSG2 beta1 2 | # 3 | 4 | #=================================== 5 | # Simulation parameters setup 6 | #=================================== 7 | set val(stop) 50.0 ;# time of simulation end 8 | set opt(title) zero; 9 | set opt(stop) 50; 10 | set opt(ecn) 0; 11 | 12 | #topology 13 | set opt(type) gsm ; 14 | set opt(secondDelay) 55; 15 | 16 | #AQM parameters 17 | set opt(minth) 30; 18 | set opt(maxth0 0; 19 | set opt(adaptive) 1; 20 | 21 | #traffic generation 22 | set opt(flows) 0; 23 | set opt(window) 30; 24 | set opt(web) 2; 25 | 26 | #default downlink bandwith in bps 27 | set bwDL(gsm) 9600 28 | 29 | #default uplink bandwith in bps 30 | set bwUL(gsm) 9600 31 | 32 | #default downlink propogation delay in sec 33 | set propDL(gsm) .500 34 | 35 | #default uplink propogation delay in sec 36 | set propUL(gsm) .500 37 | 38 | #default buffer size in packets 39 | set buf(gsm) 10 40 | #end 41 | 42 | #=================================== 43 | # Initialization 44 | #=================================== 45 | #Create a ns simulator 46 | set ns [new Simulator] 47 | 48 | #Open the NS trace file 49 | set tracefile [open 5nn.tr w] 50 | $ns trace-all $tracefile 51 | 52 | #Open the NAM trace file 53 | set namfile [open 5nn.nam w] 54 | $ns namtrace-all $namfile 55 | 56 | #=================================== 57 | # Nodes Definition 58 | #=================================== 59 | #Create 5 nodes 60 | set nodes(n0) [$ns node] 61 | set nodes(n1) [$ns node] 62 | set nodes(n2) [$ns node] 63 | set nodes(n3) [$ns node] 64 | set nodes(n4) [$ns node] 65 | 66 | #=================================== 67 | # Links Definition 68 | #=================================== 69 | #Createlinks between nodes 70 | 71 | proc cell_topo {} { 72 | global ns nodes 73 | $ns duplex-link $nodes(n0) $nodes(n1) 3.0Mb 10ms DropTail 74 | 75 | $ns duplex-link $nodes(n1) $nodes(n2) 1.0Mb 10ms RED 76 | 77 | $ns duplex-link $nodes(n2) $nodes(n3) 1.0Mb 10ms RED 78 | 79 | $ns duplex-link $nodes(n3) $nodes(n4) 3.0Mb 10ms DropTail 80 | 81 | puts " Cell Topology" 82 | } 83 | 84 | proc set_link_params {t} { 85 | global ns nodes bwUL bwDL propUL propDL buf 86 | $ns bandwidth $nodes(n0) $nodes(n1) $bwDL($t) duplex 87 | $ns bandwidth $nodes(n1) $nodes(n2) $bwUL($t) duplex 88 | $ns bandwidth $nodes(n2) $nodes(n3) $bwDL($t) duplex 89 | $ns bandwidth $nodes(n3) $nodes(n4) $bwUL($t) duplex 90 | 91 | $ns delay $nodes(n0) $nodes(n1) $propDL($t) duplex 92 | $ns delay $nodes(n1) $nodes(n2) $propDL($t) duplex 93 | $ns delay $nodes(n2) $nodes(n3) $propDL($t) duplex 94 | $ns delay $nodes(n3) $nodes(n4) $propDL($t) duplex 95 | 96 | 97 | $ns queue-limit $nodes(n0) $nodes(n1) $buf($t) 98 | $ns queue-limit $nodes(n1) $nodes(n2) $buf($t) 99 | $ns queue-limit $nodes(n2) $nodes(n3) $buf($t) 100 | $ns queue-limit $nodes(n3) $nodes(n4) $buf($t) 101 | } 102 | 103 | #create topology 104 | switch $opt(type) { 105 | gsm - 106 | gprs - 107 | umts {cell_topo} 108 | } 109 | set_link_params $opt(type) 110 | $ns insert-delayer $nodes(n0) $nodes(n1) [new Delayer] 111 | $ns insert-delayer $nodes(n1) $nodes(n2) [new Delayer] 112 | $ns insert-delayer $nodes(n2) $nodes(n3) [new Delayer] 113 | $ns insert-delayer $nodes(n3) $nodes(n4) [new Delayer] 114 | 115 | 116 | #=================================== 117 | # Agents Definition 118 | #=================================== 119 | #Setup a TCP connection 120 | set tcp0 [new Agent/TCP] 121 | $ns attach-agent $nodes(n0) $tcp0 122 | set sink2 [new Agent/TCPSink/Sack1] 123 | $ns attach-agent $nodes(n2) $sink2 124 | $ns connect $tcp0 $sink2 125 | $tcp0 set packetSize_ 1500 126 | 127 | #Setup a TCP connection 128 | set tcp1 [new Agent/TCP] 129 | $ns attach-agent $nodes(n0) $tcp1 130 | set sink3 [new Agent/TCPSink/Sack1] 131 | $ns attach-agent $nodes(n2) $sink3 132 | $ns connect $tcp1 $sink3 133 | $tcp1 set packetSize_ 1500 134 | 135 | 136 | #=================================== 137 | # Applications Definition 138 | #=================================== 139 | #Setup a FTP Application over TCP connection 140 | set ftp0 [new Application/FTP] 141 | $ftp0 attach-agent $tcp0 142 | $ns at 1.0 "$ftp0 start" 143 | $ns at 35.0 "$ftp0 stop" 144 | 145 | #Setup a FTP Application over TCP connection 146 | set ftp1 [new Application/FTP] 147 | $ftp1 attach-agent $tcp1 148 | $ns at 1.0 "$ftp1 start" 149 | $ns at 45.0 "$ftp1 stop" 150 | 151 | 152 | #=================================== 153 | # Termination 154 | #=================================== 155 | #Define a 'finish' procedure 156 | proc finish {} { 157 | global ns tracefile namfile 158 | $ns flush-trace 159 | close $tracefile 160 | close $namfile 161 | exec nam out.nam & 162 | exit 0 163 | } 164 | $ns at $val(stop) "$ns nam-end-wireless $val(stop)" 165 | $ns at $val(stop) "finish" 166 | $ns at $val(stop) "puts \"done\" ; $ns halt" 167 | $ns run 168 | 169 | 170 | -------------------------------------------------------------------------------- /public/src/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #333a45; 3 | margin: 0; 4 | padding: 0; 5 | font-family: 'Roboto Mono', monospace; 6 | } 7 | 8 | .stickFont { 9 | font-family: 'Stick', sans-serif; 10 | } 11 | 12 | nav { 13 | display: flex; 14 | justify-content: space-evenly; 15 | } 16 | 17 | nav a { 18 | text-decoration: none; 19 | color: #cd4773; 20 | font-size: bold; 21 | } 22 | 23 | nav a:hover { 24 | text-decoration: none; 25 | color: #cd4773; 26 | font-size: bold; 27 | } 28 | 29 | .link-live { 30 | color: #eea7be; 31 | } 32 | 33 | nav ul { 34 | padding-top: 20px; 35 | } 36 | 37 | nav li>a { 38 | color: white; 39 | font-size: 1.2rem; 40 | } 41 | 42 | nav li>a:hover { 43 | color: #dea9ba; 44 | } 45 | 46 | .selected-sem { 47 | color: #ded746 !important; 48 | 49 | } 50 | 51 | .sem-section { 52 | justify-content: center; 53 | display: flex; 54 | flex-direction: row; 55 | } 56 | 57 | .sem-section ul { 58 | list-style-type: none; 59 | display: flex; 60 | justify-content: center; 61 | align-items: center; 62 | } 63 | .sem-section span { 64 | margin-left: 60px; 65 | font-size: 20px; 66 | color: white; 67 | } 68 | 69 | 70 | .sem-section li { 71 | margin: 10px; 72 | font-weight: bold; 73 | } 74 | 75 | .sem-section a { 76 | text-decoration: none; 77 | color: #959698; 78 | } 79 | 80 | .sem-section a:hover { 81 | color: #ded746; 82 | } 83 | 84 | .sem-filter-tags{ 85 | cursor: pointer; 86 | color: #7DCE13; 87 | } 88 | 89 | .cards-section { 90 | margin-top: 1%; 91 | display: flex; 92 | flex-direction: row; 93 | flex-wrap: wrap; 94 | justify-content: center; 95 | } 96 | 97 | .card { 98 | text-decoration: none; 99 | color: black; 100 | margin: 1%; 101 | min-width: 300px; 102 | background-color: #e8e8e8; 103 | } 104 | 105 | .card a { 106 | text-decoration: none; 107 | color: black; 108 | } 109 | 110 | .card a:hover { 111 | text-decoration: none; 112 | color: black; 113 | } 114 | 115 | .cardFooter { 116 | display: flex; 117 | flex-direction: row; 118 | justify-content: space-between; 119 | } 120 | 121 | .cardFooter button { 122 | color: #00917c; 123 | text-transform: uppercase; 124 | font-weight: bold; 125 | } 126 | 127 | .btn-red { 128 | color: #b91646 !important; 129 | } 130 | 131 | .btn-green { 132 | color: #00917c !important; 133 | } 134 | 135 | .btn-copy { 136 | color: #146356 !important; 137 | border-radius: 5; 138 | font-size: 12px; 139 | border: 2px solid #00917c; 140 | margin-right: 10px; 141 | } 142 | 143 | .form-div { 144 | margin: 0 auto; 145 | width: 500px; 146 | color: white; 147 | } 148 | 149 | @media (max-width: 480px) { 150 | 151 | nav { 152 | display: flex; 153 | flex-direction: column; 154 | } 155 | 156 | nav ul { 157 | padding-top: 4px; 158 | } 159 | .sem-section { 160 | display: flex; 161 | flex-direction: column; 162 | } 163 | .sem-section ul { 164 | list-style-type: none; 165 | display: flex; 166 | justify-content: start; 167 | margin: 2px; 168 | } 169 | .sem-section li { 170 | margin: 5px; 171 | } 172 | 173 | } 174 | 175 | /* about page*/ 176 | .img-section img { 177 | width: 200px; 178 | height: 300px; 179 | border-radius: 25%; 180 | } 181 | 182 | .content-about { 183 | margin: 10px; 184 | color: white; 185 | width: 70%; 186 | } 187 | 188 | /* f404 page */ 189 | .fourOfour h1 { 190 | color: white; 191 | margin: 0 0 0 18px; 192 | } 193 | 194 | .fourOfour img { 195 | width: 120px; 196 | border-radius: 50%; 197 | } 198 | 199 | .fourOfour { 200 | width: 70vh; 201 | height: 70vw; 202 | } 203 | 204 | @keyframes hor-movement { 205 | from { 206 | margin-left: 0%; 207 | } 208 | 209 | to { 210 | margin-left: 100%; 211 | } 212 | } 213 | 214 | @keyframes ver-movement { 215 | from { 216 | margin-top: 0%; 217 | } 218 | 219 | to { 220 | margin-top: 100%; 221 | } 222 | } 223 | 224 | .fourOfour img { 225 | animation-name: hor-movement, ver-movement; 226 | animation-duration: 6.141s, 3.414s; 227 | animation-iteration-count: infinite; 228 | animation-direction: alternate; 229 | animation-timing-function: linear; 230 | } 231 | 232 | /* login page */ 233 | .feedback { 234 | color: #fff323; 235 | font-style: italic; 236 | margin-left: 30px; 237 | } 238 | 239 | /* admin page */ 240 | .admin-control-panel { 241 | color: white; 242 | display: flex; 243 | justify-content: center; 244 | list-style: none; 245 | padding: 10px; 246 | } 247 | 248 | .admin-control-panel a { 249 | color: inherit; 250 | padding-left: 25px; 251 | cursor: pointer; 252 | text-decoration: none; 253 | } 254 | 255 | .admin-control-panel a span { 256 | margin-right: 7px; 257 | } 258 | 259 | .adminPanelActiveBtn { 260 | color: #fff323 !important; 261 | } 262 | 263 | /* post page */ 264 | 265 | .select-sem { 266 | margin-right: 50px; 267 | padding: 2px; 268 | color: #212529; 269 | background-color: #fff; 270 | background-clip: padding-box; 271 | border: 1px solid #ced4da; 272 | border-radius: 4px; 273 | } 274 | 275 | .form-control-sm { 276 | width: 120px; 277 | color: #212529; 278 | background-color: #fff; 279 | background-clip: padding-box; 280 | border: 1px solid #ced4da; 281 | border-radius: 4px; 282 | } -------------------------------------------------------------------------------- /public/src/login.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Login 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 40 | 41 | 42 | 43 |
44 | 45 |
46 | 47 |
48 | 49 | 51 | 52 |
53 |
54 | 55 | 56 |
57 | 58 | Submit 59 | 60 | 61 |
62 | 63 | 64 |
65 | 66 | 67 |
68 | 69 | 126 | 127 | 128 | -------------------------------------------------------------------------------- /downloads/dsa/7.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | int count = 0; 5 | struct node 6 | { 7 | int sem, phno; 8 | char usn[50], name[50], branch[50]; 9 | struct node *link; 10 | }; 11 | struct node *first = NULL, *last = NULL, *temp = NULL, *temp1 = NULL; 12 | void CreateNode() 13 | { 14 | int sem, phno; 15 | char usn[50], name[50], branch[50]; 16 | temp = (struct node *)malloc(sizeof(struct node)); 17 | printf("\nEnter usn,name, branch, sem, phno of student \n"); 18 | scanf("%s %s %s %d %d", usn, name, branch, &sem, &phno); 19 | strcpy(temp->usn, usn); 20 | strcpy(temp->name, name); 21 | strcpy(temp->branch, branch); 22 | temp->sem = sem; 23 | temp->phno = phno; 24 | temp->link = NULL; 25 | count++; 26 | } 27 | void InsertAtFront() 28 | { 29 | if (first == NULL) 30 | { 31 | CreateNode(); 32 | first = temp; 33 | last = first; 34 | } 35 | else 36 | { 37 | CreateNode(); 38 | temp->link = first; 39 | first = temp; 40 | } 41 | } 42 | void InsertAtEnd() 43 | { 44 | if (first == NULL) 45 | { 46 | CreateNode(); 47 | first = temp; 48 | last = first; 49 | } 50 | else 51 | { 52 | CreateNode(); 53 | last->link = temp; 54 | last = temp; 55 | } 56 | } 57 | void Display() 58 | { 59 | temp1 = first; 60 | if (temp1 == NULL) 61 | { 62 | printf("\nList is empty \n"); 63 | } 64 | else 65 | { 66 | printf("\nThe elements of SLL are :\n"); 67 | while (temp1 != NULL) 68 | { 69 | printf("%s %s %s %d %d\n", temp1->usn, temp1->name, temp1->branch, temp1->sem, temp1->phno); 70 | temp1 = temp1->link; 71 | } 72 | } 73 | printf("Number of students = %d\n", count); 74 | } 75 | void DeleteAtEnd() 76 | { 77 | struct node *temp; 78 | temp = first; 79 | if (first == NULL) 80 | printf("\nList is empty\n"); 81 | else if (temp->link == NULL) 82 | { 83 | printf("The student record deleted is\n%s %s %s %d %d\n", 84 | temp->usn, temp->name, temp->branch, temp->sem, temp->phno); 85 | free(temp); 86 | first = NULL; 87 | count--; 88 | } 89 | else 90 | { 91 | while (temp->link != last) 92 | temp = temp->link; 93 | printf("The student record deleted is\n%s %s %s %d %d\n", 94 | last->usn, last->name, last->branch, last->sem, last->phno); 95 | free(last); 96 | temp->link = NULL; 97 | last = temp; 98 | count--; 99 | } 100 | } 101 | void DeleteAtFront() 102 | { 103 | struct node *temp; 104 | temp = first; 105 | if (first == NULL) 106 | printf("\nList is empty\n"); 107 | else if (temp->link == NULL) 108 | { 109 | printf("The student record deleted is\n%s %s %s %d %d", 110 | temp->usn, temp->name, temp->branch, temp->sem, temp->phno); 111 | free(temp); 112 | first = NULL; 113 | count--; 114 | } 115 | else 116 | { 117 | first = temp->link; 118 | printf("The student record deleted is\n%s %s %s %d %d", 119 | temp->usn, temp->name, temp->branch, temp->sem, temp->phno); 120 | free(temp); 121 | count--; 122 | } 123 | } 124 | int main() 125 | { 126 | while (1) 127 | { 128 | int choice, n, i, choice2, flag1, flag2; 129 | printf("\n\n**********************MENU*****************"); 130 | printf("\n1.Create a SLL of N students Data by using front insertion\n2. Display the status of SLL and count the number of nodes in it\n3. Perform Insertion/Deletion at End of SLL\n4. PerformInsertion/Deletion at Front of SLL (Demonstaration of SLL as STACK)\n5. Exit\n"); 131 | printf("\nEnter your choice : "); 132 | scanf("%d", &choice); 133 | switch (choice) 134 | { 135 | case 1: 136 | printf("Enter the number of students : "); 137 | scanf("%d", &n); 138 | for (i = 0; i < n; i++) 139 | InsertAtFront(); 140 | break; 141 | case 2: 142 | Display(); 143 | break; 144 | case 3: 145 | flag1 = 0; 146 | while (flag1 == 0) 147 | { 148 | printf("\n\n1. Insertion\n2. Deletion\n3. Exit"); 149 | printf("\n\nEnter your option\n"); 150 | scanf("%d", &choice2); 151 | switch (choice2) 152 | { 153 | case 1: 154 | InsertAtEnd(); 155 | Display(); 156 | break; 157 | case 2: 158 | DeleteAtEnd(); 159 | Display(); 160 | break; 161 | case 3: 162 | flag1 = 1; 163 | break; 164 | } 165 | } 166 | break; 167 | case 4: 168 | flag2 = 0; 169 | printf("\n\nDemonstration of STACK\n"); 170 | while (flag2 == 0) 171 | { 172 | printf("\n\n1. Insertion\n2. Deletion\n3. Exit\n"); 173 | printf("\n\nEnter your option\n"); 174 | scanf("%d", &choice2); 175 | switch (choice2) 176 | { 177 | case 1: 178 | InsertAtFront(); 179 | Display(); 180 | break; 181 | case 2: 182 | DeleteAtFront(); 183 | Display(); 184 | break; 185 | case 3: 186 | flag2 = 1; 187 | break; 188 | } 189 | } 190 | break; 191 | case 5: 192 | exit(0); 193 | break; 194 | } 195 | } 196 | } -------------------------------------------------------------------------------- /public/src/post.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Post 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 18 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 | 40 | 41 | 42 | 43 |
44 | 45 |
46 | 47 |
48 | 49 | 50 | 51 |
52 | 53 |
54 | 55 | 57 |
58 | 59 |
60 | 61 | 71 | 72 | 73 | 75 | 76 |
77 | 78 |
79 | 80 | 82 |
83 | 84 |
85 | 86 | 88 |
89 |
90 | Submit 91 | 92 |
93 | 94 | 95 | 96 | 97 |
98 | 99 | 100 |
101 | 102 | 161 | 162 | 163 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Home 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | 46 | 47 | 48 |
49 |
50 | 60 | 61 |
    62 | 63 |
  • 64 | {{tag}}
  • 65 |
66 |
67 | 68 | 69 | 70 |
71 | 72 |
73 |
74 |
{{code.title}}
75 |
@{{code.author}}
76 |

{{code.description}}

77 |
78 |
79 | Sub: 80 | {{(code.tag).toUpperCase()}} 81 |
82 | Posted:{{code.posted}} 83 |
84 | 85 | 86 | 87 | 89 | 90 | 91 | 92 | 119 | 120 |
121 |
122 |
123 |
124 |
125 |
126 | 127 | 200 | 201 | 202 | -------------------------------------------------------------------------------- /guardedPages/admin.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Admin Panel 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 |
36 | 46 | 57 | 58 | 59 |
60 | 61 |
62 |
63 |
{{code.title}}
64 |
- {{code.author}}
65 |

{{code.description}}

66 |
67 | 68 | Posted: {{code.posted}} 69 | 70 | 71 | 73 | 74 | 75 |
76 |
77 |

Permanently Deleted in {{code.deleteInDays}} days

79 |
80 |
81 |
82 |
83 | 84 | 85 |
86 | 87 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /public/src/prism.js: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.23.0 2 | https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+c+cpp&plugins=highlight-keywords+normalize-whitespace */ 3 | var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(u){var c=/\blang(?:uage)?-([\w-]+)\b/i,n=0,e={},M={manual:u.Prism&&u.Prism.manual,disableWorkerMessageHandler:u.Prism&&u.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof W?new W(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&").replace(/=l.reach);y+=m.value.length,m=m.next){var k=m.value;if(t.length>n.length)return;if(!(k instanceof W)){var b,x=1;if(h){if(!(b=z(p,y,n,f)))break;var w=b.index,A=b.index+b[0].length,P=y;for(P+=m.value.length;P<=w;)m=m.next,P+=m.value.length;if(P-=m.value.length,y=P,m.value instanceof W)continue;for(var S=m;S!==t.tail&&(Pl.reach&&(l.reach=N);var j=m.prev;O&&(j=I(t,j,O),y+=O.length),q(t,j,x);var C=new W(o,g?M.tokenize(E,g):E,d,E);if(m=I(t,j,C),L&&I(t,m,L),1l.reach&&(l.reach=_.reach)}}}}}}(e,a,n,a.head,0),function(e){var n=[],t=e.head.next;for(;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=M.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=M.hooks.all[e];if(t&&t.length)for(var r,a=0;r=t[a++];)r(n)}},Token:W};function W(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||"").length}function z(e,n,t,r){e.lastIndex=n;var a=e.exec(t);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function i(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function I(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function q(e,n,t){for(var r=n.next,a=0;a"+a.content+""},!u.document)return u.addEventListener&&(M.disableWorkerMessageHandler||u.addEventListener("message",function(e){var n=JSON.parse(e.data),t=n.language,r=n.code,a=n.immediateClose;u.postMessage(M.highlight(r,M.languages[t],t)),a&&u.close()},!1)),M;var t=M.util.currentScript();function r(){M.manual||M.highlightAll()}if(t&&(M.filename=t.src,t.hasAttribute("data-manual")&&(M.manual=!0)),!M.manual){var a=document.readyState;"loading"===a||"interactive"===a&&t&&t.defer?document.addEventListener("DOMContentLoaded",r):window.requestAnimationFrame?window.requestAnimationFrame(r):window.setTimeout(r,16)}return M}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); 4 | Prism.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(a,e){var s={};s["language-"+e]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^$/i;var t={"included-cdata":{pattern://i,inside:s}};t["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var n={};n[a]={pattern:RegExp("(<__[^>]*>)(?:))*\\]\\]>|(?!)".replace(/__/g,function(){return a}),"i"),lookbehind:!0,greedy:!0,inside:t},Prism.languages.insertBefore("markup","cdata",n)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(a,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp("(^|[\"'\\s])(?:"+a+")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))","i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml; 5 | !function(s){var e=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|(?:[^\\\\\r\n()\"']|\\\\[^])*)\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:RegExp("[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+e.source+")*(?=\\s*\\{)"),string:{pattern:e,greedy:!0},property:/(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var t=s.languages.markup;t&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))}(Prism); 6 | Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/}; 7 | Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-flags":/[a-z]+$/,"regex-delimiter":/^\/|\/$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)","javascript")),Prism.languages.js=Prism.languages.javascript; 8 | Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:__attribute__|_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|asm|typeof|inline|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|union|unsigned|void|volatile|while)\b/,function:/[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^\s*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}},constant:/\b(?:__FILE__|__LINE__|__DATE__|__TIME__|__TIMESTAMP__|__func__|EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|stdin|stdout|stderr)\b/}),delete Prism.languages.c.boolean; 9 | !function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char8_t|char16_t|char32_t|class|compl|concept|const|consteval|constexpr|constinit|const_cast|continue|co_await|co_return|co_yield|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n="\\b(?!)\\w+(?:\\s*\\.\\s*\\w+)*\\b".replace(//g,function(){return t.source});e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp("(\\b(?:class|concept|enum|struct|typename)\\s+)(?!)\\w+".replace(//g,function(){return t.source})),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:true|false)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp('(\\b(?:module|import)\\s+)(?:"(?:\\\\(?:\r\n|[^])|[^"\\\\\r\n])*"|<[^<>\r\n]*>|'+"(?:\\s*:\\s*)?|:\\s*".replace(//g,function(){return n})+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","operator",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(Prism); 10 | "undefined"!=typeof self&&!self.Prism||"undefined"!=typeof global&&!global.Prism||Prism.hooks.add("wrap",function(e){"keyword"===e.type&&e.classes.push("keyword-"+e.content)}); 11 | !function(){var i=Object.assign||function(e,n){for(var t in n)n.hasOwnProperty(t)&&(e[t]=n[t]);return e};function e(e){this.defaults=i({},e)}function s(e){for(var n=0,t=0;t