Skip to content

Instantly share code, notes, and snippets.

@saharshg29
saharshg29 / infinite_scroll.py
Created December 18, 2023 12:40
Infinite Scroll Snippet in Python
import time
import requests
import pandas as pd
from tqdm import tqdm
import chromedriver_binary
from bs4 import BeautifulSoup
from selenium import webdriver
browser = webdriver.Chrome()
@saharshg29
saharshg29 / solution.js
Created December 4, 2023 12:57
This is a code snippet for competitive programming using js
// For reading input from the command line
const readline = require('readline');
const rl = readline.createInterface({
input: process.stdin,
output: process.stdout,
terminal: false
});
// Function to solve the problem
function solve(input) {
@saharshg29
saharshg29 / openCv.py
Created October 4, 2023 20:19
My first realtime object detection using OpenCV
import cv2
import numpy as np
def detect_boxes(image):
# Convert image to HSV color space
hsv = cv2.cvtColor(image, cv2.COLOR_BGR2HSV)
# Define range for brown color in HSV
lower_brown = np.array([10, 50, 50])
upper_brown = np.array([20, 255, 255])
@saharshg29
saharshg29 / index.js
Created September 21, 2023 08:01
Simple BMI calculator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>BMI Calculator</title>
<style>
body {
@saharshg29
saharshg29 / validate.js
Created August 3, 2023 17:40
Login validation using js
function validateLoginForm() {
const usernameInput = document.getElementById('username');
const passwordInput = document.getElementById('password');
const username = usernameInput.value.trim();
const password = passwordInput.value.trim();
if (username === '' || password === '') {
alert('Please fill in all fields.');
return false;
@saharshg29
saharshg29 / main.js
Created August 3, 2023 13:56
This is main js file for previous html file
function validateLogin() {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if (username === "" || password === "") {
alert("Please enter your username and password.");
return false;
}
var xhr = new XMLHttpRequest();
@saharshg29
saharshg29 / login.html
Created August 3, 2023 13:55
LogIn HTML CSS Bootstrap
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Login Page</title>
<style>
.container {
width: 400px;
margin: 0 auto;
#include <stdio.h>
int main(void)
{
// your code goes here
int n, x, y;
int sum = 0;
int day = 0;
int k = 1;
scanf("%i", &n);
/* package codechef; // don't place package name! */
import java.util.*;
class Codechef
{
public static void main (String[] args)
{
Scanner input =new Scanner(System.in);
int t=input.nextInt();
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0) {
boolean prime = true;
int n = sc.nextInt();
if(n == 1){