Skip to content

Instantly share code, notes, and snippets.

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

Anil Prajapati anil3a

🏠
Working from home
View GitHub Profile
@anil3a
anil3a / docker-compose.yml
Last active April 30, 2024 04:43
Query Immich Postgres database for all assets to find any missing images in upload path
services:
# ... existing containers from immich docker-compose.yml
debug:
image: python:3.11.9-bullseye
container_name: immich_debugger
command: tail -f /dev/null
env_file:
- stack.env
@anil3a
anil3a / gitchecker.sh
Created February 9, 2021 02:34
Linux or Mac Bash script that checks GIT folders inside one parent folder to get git status for file changes and git branch name
#!/bin/bash
### Usage
### gitchecker.sh Parent_Folder_With_GIT_Folders
DIR=$(PWD)/$1
for R in $DIR/*; do
cd $R
if `git status | grep -q "nothing to commit"`;
@anil3a
anil3a / backup_db_script.sh
Created January 21, 2021 02:08
Create Database backup script and check file is older than 10 days if yes delete
#!/bin/bash
MY_HOME="/var/www/prajapatianil.com.np/backupdb/"
case $1 in
"backup")
cd $MY_HOME
mysqldump -h localhost -u 'usermysql' -p'passwordmysql' databasename > websitedb$(date +%Y%m%d_%H).sql
tar -zcvf websitedb$(date +%Y%m%d_%H).tgz websitedb$(date +%Y%m%d_%H).sql
rm websitedb$(date +%Y%m%d_%H).sql;;
*) echo "Others";;
esac
@anil3a
anil3a / backup_script.sh
Created January 21, 2021 01:21
Linux Bash script to backup file to Amazon AWS S3 bucket with S3cmd command
#!/bin/bash
# Usage
# ./backup_script.sh
# logger used for adding log to syslog
# CONSTANT
###################
ROOT_DIR=/var/www/prajapatianil.com.np/
UPLOAD_FOLDER=$ROOT_DIR/public_html/uploads
MEDIA_FOLDER=$ROOT_DIR/public_html/media
@anil3a
anil3a / .gitconfig
Created July 16, 2020 05:47
Git config name and email based on Folder directory ( i use in windows 10 )
[includeIf "gitdir:**/htdocs/mycompany-paypal/"]
path = .gitconfig-mycompany-paypal # filename where your custom git credential is saved for that particular folder
# This is Git's per-user configuration file.
# This will be used as global if you use.
[user]
# Please adapt and uncomment the following lines:
# name = unknown
# email = Anil@Anil(none)
@anil3a
anil3a / delete-mail-containing-email.sh
Created February 6, 2020 02:59
Delete email queue from linux mailq - Postfix - ubuntu - Linux
#!/bin/bash
# Usage
# ./delete-mail-containing-email.sh anil@github.com
EMAILADDY=$1
if [ -z "$EMAILADDY" ]
then
echo "Usage: $0 <email adres>"
import os.path
from os import path
# This script is used for my personal project in codeigniter to check if file exist and line of text exist.
# It is running from applications folder in the project
def verify_if_file_content_text(filepath,content_to_find):
content_exist = False
if( path.exists( filepath ) and os.path.isfile( filepath ) ):
with open(filepath) as fp:
[ req ]
default_bits = 2048
default_keyfile = server-key.pem
distinguished_name = subject
req_extensions = req_ext
x509_extensions = x509_ext
string_mask = utf8only
[ subject ]
@echo off
set /p domain="Enter Domain: "
set OPENSSL_CONF=../conf/openssl.cnf
if not exist .\%domain% mkdir .\%domain%
..\bin\openssl req -config cert.conf -new -sha256 -newkey rsa:2048 -nodes -keyout %domain%\server.key -x509 -days 365 -out %domain%\server.crt
echo.
echo -----
#!/bin/sh
#title :AnilPrz's Life with GIT & REACT
#description :This script helps to do everyday / every 3/4 hour git push or npm run build or git pull
#author :Anil Prajapati
#date :20181012
#version :1
#usage :bash gitpush.sh /home/anil/myrepo/ MyBranchName MyReactFolder
#notes :This is a personal script to make my life easier. It works for any GIT repo with REACT folder just inside the GIT repo. You can Skip react if you dont have
#bash_version :4.1.5
#==============================================================================