Skip to content

Instantly share code, notes, and snippets.

View MParvin's full-sized avatar

Mohammad Parvin MParvin

View GitHub Profile
@MParvin
MParvin / docker-dns-bridge-fix.sh
Last active March 18, 2024 22:21
Resolve docker dns problem, with remove bridge and restart docker, I used this answer: https://serverfault.com/a/642984
#!/bin/bash
install_brctl_in_debian(){
apt update && apt install -y bridge-utils && \
}
install_brctl_in_rhell(){
yum makecache && yum install -y bridge-utils && \
}
@MParvin
MParvin / mysql_dump.sh
Last active November 6, 2022 09:40
MySQL dump with telegram failure notification
#!/bin/bash -x
# database credentials
db_user=""
db_pass=""
db_name=""
db_host="" # e.g 127.0.0.1 or localhost
# FTP credentials
ftp_url="" e.g ftp://ftp.example.com
@MParvin
MParvin / todo_finder.sh
Created December 28, 2020 00:00
Very Simple Todo finder for Python written in Bash
#!/bin/bash
# Show one line before (-B 1) and one line after (-A 1) matched
# .venv excluded
# Used -n to show line number
# -s for prevent displaying error messages
# -r for recursive, in some versions of grep -r doesn't exists
grep 'TODO' -B 1 -A 1 --color --exclude-dir=.venv -nsr ./
events{}
rtmp {
server {
listen 1935;
application live {
live on;
interleave on;
hls on;
hls_path /tmp/hls;
@MParvin
MParvin / nginx_rtmp_hls.conf
Created August 27, 2020 09:57
Nginx config for rtmp and hls
daemon off;
error_log logs/error.log;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935; # Listen on standard RTMP port
chunk_size 4000;
application show {
@MParvin
MParvin / touchpad_manger.sh
Created August 7, 2020 10:29
Easy disable and enable touch pad from Bash
#!/bin/bash
showUsage() {
echo -e "Usage is /scripts/tochpad.sh [OPTIONS]\n\t-e To enable touch pad\n\t-d For Disable touch pad\n\t-h for this Help"
}
if [ "$#" -eq 0 ]
then
showUsage
exit 1
fi
@MParvin
MParvin / Upgrade_Debian_9_to_10.sh
Created January 27, 2020 12:26
Simple bash scripts
#!/bin/bash
# First upgrade current packages
apt update | grep upgradable && apt upgrade -y
# Change debian repository to 10 (Buster)
sed -i 's/stretch/buster/gm' /etc/apt/sources.list
# Upgrade packages with Debian 10 repository
apt update && apt upgrade -y