Skip to content

Instantly share code, notes, and snippets.

View mdutt247's full-sized avatar
๐Ÿ 
Working from home

Madhavendra Dutt mdutt247

๐Ÿ 
Working from home
View GitHub Profile
To send an email notification whenever a file or directory changes in multiple watch directories while excluding certain subdirectories,
you can use inotifywait (from inotify-tools) along with mail or sendmail.
sudo apt update
sudo apt install inotify-tools mailutils -y
Here
inotify-tools: Monitors filesystem changes.
mailutils: Enables email sending (for mail command).
@mdutt247
mdutt247 / nginx-wordpress.conf
Created January 20, 2024 19:24 — forked from nfsarmento/nginx-wordpress.conf
Harden wordpress security nginx
############ WordPress ####################
# Disable logging for favicon and robots.txt
location = /favicon.ico {
try_files /favicon.ico @empty;
access_log off;
log_not_found off;
expires max;
}
@mdutt247
mdutt247 / Update Laravel Application
Created November 27, 2023 11:00
Laravel command to update the application (git pull and composer install) using Laravel scheduler.
# Author: M. Dutt ([email protected])
# Date: 27/11/2023
# Purpose: Laravel command to update the application (git pull and composer install) using Laravel scheduler.
#
# Running The Scheduler
# The schedule:run Artisan command will evaluate all of your scheduled tasks and determine if they need to run based on the server's current time.
# Create a cron job in your server
# * * * * * cd /path/to/project && php artisan schedule:run >> storage/logs/cron.log 2>&1
#
# Directory structure
@mdutt247
mdutt247 / Laravel File Permission
Last active July 7, 2025 17:09
Correct way to set up file and directory permissions in Laravel
# Author: M. Dutt ([email protected])
# Date: 20/11/2023
# Purpose: Correct file and directory permissions of Laravel project.
#
Change the owner and group of your Laravel project.
sudo chown -R developer:www-data /var/www/project
OR
sudo chown -R developer:apache /var/www/project
@mdutt247
mdutt247 / clamscan_daily.sh
Created November 19, 2023 06:39
Clamav daily scan
#!/usr/bin/env bash
# Author: M. Dutt ([email protected])
# Date: 19/11/2023
# Purpose: Clamav daily scan.
#
# chmod +x /path/to/script/clamscan_daily.sh
#
# 01 * * * * /path/to/script/clamscan_daily.sh
#
@mdutt247
mdutt247 / clamscan_hourly.sh
Last active November 19, 2023 07:05
Clamav hourly scan
#!/usr/bin/env bash
# Author: M. Dutt ([email protected])
# Date: 19/11/2023
# Purpose: Clamav hourly scan.
#
# chmod +x /path/to/script/clamscan_hourly.sh
#
# 01 * * * * /path/to/script/clamscan_hourly.sh
#
@mdutt247
mdutt247 / whatsapp-button.html
Created November 5, 2023 12:57
WhatsApp button at bottom of website
<style>
.float {
position: fixed;
width: 60px;
height: 60px;
bottom: 40px;
right: 40px;
background-color: #25d366;
color: #FFF;
border-radius: 50px;
@mdutt247
mdutt247 / daily_backup.sh
Last active November 4, 2023 08:47
Shell script to backup all specified directories using cron job
#!/usr/bin/env bash
# Author: M. Dutt ([email protected])
# Date: 28/10/2023
# Purpose: Backup all specified direcories.
# License: This shell script is released under GPL v2.
#
########################
# REQUIREMENTS
########################
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Coming soon</title>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/1.18.4/TweenMax.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery.downCount/1.0.0/jquery.downCount.min.js"></script>
@mdutt247
mdutt247 / Population.java
Created July 4, 2021 13:35
Java class to print the population of the country at the end of each year from 2001 to 2007
/*The population of a country in a particular year can be calculated by:
p*(1+r/100) at the end of year 2000, where p is the initial population and r is the
growth rate.
Write a program by using a class to find the population of the country at the end of each year from 2001 to 2007. The Class has the following specifications:
Class name โ€” Population
Data Members โ€” float p,r