Skip to content

Instantly share code, notes, and snippets.

View edrisranjbar's full-sized avatar
🏠
Working from home

Edris Ranjbar edrisranjbar

🏠
Working from home
View GitHub Profile
@edrisranjbar
edrisranjbar / currency.js
Created May 5, 2024 11:20
Add commas to currency in JavaScript
const numberWithCommas = (x) => {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
@edrisranjbar
edrisranjbar / djangoAutoBackup.sh
Created January 10, 2023 15:45
automatic django backup script - full backup (database and assets)
#!/bin/bash
printf -v date '%(%Y-%m-%d %H-%M-%S)T'
cd backups
printf "Creating and opening ${date} directory...\n"
mkdir "${date}"
cd "${date}"
# copy assets directory
printf "Copying assets...\n"
cp -R ../../static .
@edrisranjbar
edrisranjbar / SendWhatsappMessage.py
Created August 30, 2022 20:08
Send whatsapp message using python and selenium
from selenium import webdriver
from webdriver_manager.chrome import ChromeDriverManager
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.by import By
driver = webdriver.Chrome(service=Service(
ChromeDriverManager().install()