Skip to content

Instantly share code, notes, and snippets.

View manishprajapatidev's full-sized avatar
😊
Full Stack Developer - India

MANISH PRAJAPATI manishprajapatidev

😊
Full Stack Developer - India
View GitHub Profile
@manishprajapatidev
manishprajapatidev / export.sql
Last active April 7, 2022 09:50
Export Small or Large Database into Single SQL file
#1. Export Database
mysqldump --host=YOUR_HOST --port=3306 --default-character-set=utf8 --user=YOUR_USERNAME --protocol=tcp --column-statistics=FALSE --skip-triggers "DB_NAME"
#Enter Password
#2. Export Database in Zipped Format if your database is too large.
mysqldump -h YOUR_HOST --set-gtid-purged=OFF -u YOUR_USERNAME -p DB_NAME | gzip > DB_NAME.sql.gz
#Enter Password
@manishprajapatidev
manishprajapatidev / delete_all_ejabberd_users
Last active August 5, 2021 09:43
Delete all users in one command line (except admin):
/opt/ejabberd-20.12/bin# ./ejabberdctl registered_users localhost | sed -n '/admin/!p' | xargs -n 1 -I {} bash -c 'sudo ./ejabberdctl unregister {} localhost'
@manishprajapatidev
manishprajapatidev / ejabberd.yml
Created February 12, 2021 10:33
ejabberd with mysql instead of mnesia. #mnesia #ejabberd
###
###' ejabberd configuration file
###
### The parameters used in this configuration file are explained at
###
### https://docs.ejabberd.im/admin/configuration
###
### The configuration file is written in YAML.
### *******************************************************
### ******* !!! WARNING !!! *******
@manishprajapatidev
manishprajapatidev / meterConversion.js
Created December 10, 2020 09:23
meterConversion, converts meter to km, and km to meter
var meterConversion = (function() {
var mToKm = function(distance) {
return parseFloat(distance / 1000);
};
var kmToM = function(distance) {
return parseFloat(distance * 1000);
};
return {
mToKm : mToKm,
kmToM : kmToM
@manishprajapatidev
manishprajapatidev / kill_windows_port.md
Created July 6, 2020 07:06
kill the process currently using a port on localhost in Windows

Step 1:

netstat -ano | findstr :PORT_NUMBER

Step 2:

taskkill /PID PID /F
@manishprajapatidev
manishprajapatidev / apache.conf
Created June 5, 2020 06:06
Allow access to phpmyadmin from localhost only
<Directory /usr/share/phpmyadmin>
Require ip 127.0.0.1
Options FollowSymLinks
DirectoryIndex index.php
</Directory>
@manishprajapatidev
manishprajapatidev / countries.json
Created May 15, 2020 04:41
Country List with id,slug,country name, a2 code, dial code
[
{
"id":1,
"slug":"afghanistan",
"country":"Afghanistan",
"a2_code":"AF",
"dial_code":93
},
{
"id":2,
@manishprajapatidev
manishprajapatidev / bitbucket-pipelines.yml
Last active April 7, 2020 12:53
SonarCloud bitbucket-pipelines for Angular JS, React Js or other Framwork.
image: feeni/node-chrome:latest
clone:
depth: full # SonarCloud scanner needs the full history to assign issues properly
definitions:
caches:
sonar: ~/.sonar/cache # Caching SonarCloud artifacts will speed up your build
services:
docker:
@manishprajapatidev
manishprajapatidev / date_is_between_start_end_date.js
Created March 5, 2020 06:39
Check Current Date is between start date and end date
var start_date = 'YOUR_START_DATE';
var end_date = 'YOUR_END_DATE';
var today = moment().local().format("YYYY-MM-DD");
var start_date_to_match = moment(start_date).local().format("YYYY-MM-DD");
var end_date_to_match = moment(end_date).local().format("YYYY-MM-DD");
if (moment(today).isBetween(start_date_to_match, end_date_to_match, null, '[]')) {
console.log('Current Date is between start and end date');
} else {
console.log('Sorry!! Current Date is not between start and end date');
}
@manishprajapatidev
manishprajapatidev / loan-emi-calculator.js
Created March 4, 2020 19:48
EMI Calculator for Loans, Monthly breakdown of EMI in Principal and Interest components - www.koffeewithkode.com
/*
By: Manish (www.koffeewithkode.com)
*/
function calculateEMI(principal, rate_percent, time_in_months, precision) {
var EMI;
var rate_per_month = (rate_percent / 12) / 100; //divide the rate by 100 and 12
var numr = Math.pow((1 + rate_per_month), time_in_months);
var denr = (Math.pow((1 + rate_per_month), time_in_months) - 1);