Skip to content

Instantly share code, notes, and snippets.

View mohitkh7's full-sized avatar

Mohit Khandelwal mohitkh7

View GitHub Profile
@mohitkh7
mohitkh7 / wp_bomb.js
Created August 27, 2023 15:39
Whatsapp Invisible Message Bomber
function sendMessage(){
const mainEl = document.querySelector('#main')
const textareaEl = mainEl.querySelector('div[contenteditable="true"]')
if(!textareaEl) {
throw new Error('There is no opened conversation')
}
random_length = Math.floor(Math.random() * 1000) + 1
textareaEl.focus()
document.execCommand('insertText', false, '‎ '.repeat(random_length))
@mohitkh7
mohitkh7 / blockchain.py
Last active January 21, 2022 05:33
Workshop on blockchain - Scipy 2021
"""
Exercises:
Try to change difficulty level in proof of work algorithm and see how long does it takes to compute nonce.
Write a method to validate the chain.
Reward the mining node.
"""
# blockchain.py
import hashlib
@mohitkh7
mohitkh7 / blockchain_skeleton.py
Created January 20, 2022 19:44
Skeleton code for scipy 2021 blockchain workshop
from flask import Flask
class Blockchain():
def __init__(self):
self.chain = []
self.current_transactions = []
def new_block(self):
# Creates a new Block and adds it to the chain
pass
@mohitkh7
mohitkh7 / interview_question.py
Created September 25, 2021 08:33
Solution for interview
"""
Q1. Given an unsorted array with multiple duplicate elements. Find the most repeated element. Return the bigger number if multiple numbers have the highest frequency.
For example:
T1:
Input: [2, 1, -2, 55, 2, 1, 3, 9, 3, 3]
Answer: 3
T2: [1, 1, 2, 2, 2, 2, 1, 1]
Answer: 2
"""
def most_frequent(arr):
@mohitkh7
mohitkh7 / game_of_dice.py
Created August 9, 2021 11:31
"Game of Dice" is a CLI based game written in python language.
"""
The Game of Dice
The "Game of Dice" is a game where two players roll 6 faced dice in a round-robin fashion.
Each time a player rolls the dice their points increase by the number (1 to 6) achieved by the
roll. The first player to accumulate M points wins the game.
created by - Mohit Khandelwal (mohitkh7@gmail.com)
"""
@mohitkh7
mohitkh7 / solution.js
Created July 23, 2021 08:55
solution for programming question
// Q2. Write a function to get Max value of a number Array?
function findMax(arr) {
maxValue = arr[0];
arr.forEach(element => {
if (element >= maxValue) {
maxValue = element;
}
});
return maxValue;
@mohitkh7
mohitkh7 / variableHeightDiv.html
Created May 4, 2019 18:06
A scroll able div inside collapsible panel having variable height
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<style>
#scroll-section{
@mohitkh7
mohitkh7 / game.py
Created May 4, 2019 10:03
Python Game
import turtle
# set up screen
window = turtle.Screen()
window.bgcolor("#bbb")
# Setting up boundry
mypen = turtle.Turtle()
mypen.penup()
mypen.setposition(-260, -260)
@mohitkh7
mohitkh7 / file_with_milisecond_name.py
Created July 16, 2018 05:44
Python codefile to save file with name as timestamp of accuracy upto millisecond
# Python code to save a file with timestamp of accuracy upto millisecond
from datetime import datetime as dt
current_time = dt.now() # current system time e.g. 2018-07-16 16:34:43.050328
current_time_as_str = str(current_time)
filename = current_time_as_str + ".txt"
file = open(filename, "w+") # Create a empty text file with timestamp name
file.close()
@mohitkh7
mohitkh7 / pg_study.md
Last active July 5, 2018 13:16
Study & Analysis of Payment Gateway

Hosted vs Integrated Gateway

The integrated gateways let your buyers enter their payment data while they are on your website; the hosted gateways redirect users to the payment processor’s platform. An integrated gateway allows users to input their payment data without leaving your website. For them this is a seamless process. But this type of payment gateway will work well only if your website is secure enough, since all payment details will be stored on your server.

Payment Gateway Fees

  • Setup fee/registration fee (one-time payment);
  • monthly fee;
  • Transaction fee/payment processing fee/credit card processing fee (charged as a percentage or a fixed fee on every transaction);
  • Chargeback fee.