Skip to content

Instantly share code, notes, and snippets.

View KtanPatel's full-sized avatar
🎯

Ketan Patel KtanPatel

🎯
View GitHub Profile
@KtanPatel
KtanPatel / .ktanpatel.omp.json
Created August 5, 2024 12:57
my oh-my-posh config file - improved kali styled
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"foreground": "blue",
"properties": {
"fetch_version": false,
@KtanPatel
KtanPatel / scrapper-products.js
Created July 31, 2024 07:23
Product list scrapping through all the pages (pagination) and save it to json file and download the images: nodejs + playwright
// npm i axios playwright playwright-core
const playwright = require("playwright");
const fs = require("fs");
const path = require("path");
const axios = require("axios");
async function scrapeItems(url) {
const browser = await playwright.chromium.launch({
headless: process.env.NODE_ENV === "production",
@KtanPatel
KtanPatel / maintanance.html
Created February 1, 2024 09:42
Maintanance HTML Page
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
href="https://fonts.googleapis.com/css?family=Roboto:100,300"
rel="stylesheet"
/>
<title>Maintainance Mode On</title>
@KtanPatel
KtanPatel / mongodb_backup.md
Last active September 22, 2023 05:39
MongoDB Backup (mongodump) - CronJob - Daily - Ubuntu

MongoDB Backup (mongodump) - CronJob - Daily - Ubuntu

mongo_backup.sh

#!/bin/bash

set -e

URI=mongodb://user:password@0.0.0.0:27017
@KtanPatel
KtanPatel / production-nodejs-mongodb-server-setup-ubuntu-22.04.sh
Last active March 15, 2024 10:55
Setup Node.js + MongoDB + PM2 Production Server on Ubuntu 22.04
#!/usr/bin/env bash
echo "
----------------------
NODE & NPM
----------------------
"
# add nodejs LTS ppa (personal package archive) from nodesource
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
// Create a .bat file and put that file at root of workspace directory
// Result: It will remove all `node_modules` directory from current and sub directories.
FOR /d /r . %%d IN (node_modules) DO @IF EXIST "%%d" rd /s /q "%%d"
@KtanPatel
KtanPatel / production-nodejs-mongodb-server-setup-ubuntu-20.04.sh
Last active May 4, 2024 05:53
Setup Node.js + MongoDB + PM2 Production Server on Ubuntu 20.04
#!/usr/bin/env bash
echo "
----------------------
NODE & NPM
----------------------
"
# add nodejs LTS ppa (personal package archive) from nodesource
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
@KtanPatel
KtanPatel / change-author-git.sh
Created January 7, 2021 06:10
Change author name and email for multiple commits - GIT
#!/bin/sh
# usage : $ ./change-author-git.sh <old email> <correct email> <correct name>
# example: $ ./change-author-git.sh oldemail@mail.com newemail@mail.com "Ketan Patel"
git filter-branch --env-filter '
OLD_EMAIL=$1
CORRECT_EMAIL=$2
CORRECT_NAME=$3
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@KtanPatel
KtanPatel / tracker-event-bot.py
Last active March 15, 2024 11:01
[Windows] Change screen (Windows screen change [Alt+tab] and tab change [ctrl+tab]), aero key and pageUp + Down Key events for tracking software like upwork, freelancer ...
#!/usr/bin/python
# eg: python tracker-event-bot.py 50 5 0
# syntax: filename total_sec event_sec shutdown_binary_flag
# shutdown_binary_flag => "0 = no", "> 0 = yes & shutdown after that seconds on end of script"
import sys
from time import sleep
import random
import ctypes
import os