Skip to content

Instantly share code, notes, and snippets.

View MohamedMohsenX2's full-sized avatar

Mohamed Mohsen MohamedMohsenX2

View GitHub Profile
@MohamedMohsenX2
MohamedMohsenX2 / aws-backup-vault-purge.sh
Created March 5, 2021 18:59
Removes all backups (aka recovery points) inside a AWS Backup vault
#!/bin/bash
set -e
echo "Enter the name of the vault where all backups should be deleted"
read VAULT_NAME
for ARN in $(aws backup list-recovery-points-by-backup-vault --backup-vault-name "${VAULT_NAME}" --query 'RecoveryPoints[].RecoveryPointArn' --output text); do
echo "deleting ${ARN} ..."
aws backup delete-recovery-point --backup-vault-name "${VAULT_NAME}" --recovery-point-arn "${ARN}"
@MohamedMohsenX2
MohamedMohsenX2 / doc.adoc
Created November 29, 2019 13:11 — forked from KrustyHack/doc.adoc
proxmox-ubuntu-cloud-howto

Cloud-Init Support

Cloud-Init is the defacto multi-distribution package that handles early initialization of a virtual machine instance. Using Cloud-Init, one can configure network

@MohamedMohsenX2
MohamedMohsenX2 / cors-nginx.conf
Created June 15, 2019 00:02 — forked from alexjs/cors-nginx.conf
Slightly tighter CORS config for nginx
#
# Slightly tighter CORS config for nginx
#
# A modification of https://gist.github.com/1064640/ to include a white-list of URLs
#
# Despite the W3C guidance suggesting that a list of origins can be passed as part of
# Access-Control-Allow-Origin headers, several browsers (well, at least Firefox)
# don't seem to play nicely with this.
#
@MohamedMohsenX2
MohamedMohsenX2 / nginx.conf
Created June 4, 2019 14:35 — forked from CSRaghunandan/nginx.conf
Nginx configuration for serving mp4 videos
#user nobody;
worker_processes 4;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
STORAGE = 'thumbor.storages.redis_storage'
# ALLOW_UNSAFE_URL = True
AUTO_WEBP = True
DETECTORS = [ 'thumbor.detectors.face_detector', 'thumbor.detectors.feature_detector' ]
OPTIMIZERS = ['thumbor.optimizers.jpegtran', 'thumbor.optimizers.gifv']
MAX_AGE = 30 * 24 * 60 * 60
FFMPEG_PATH = '/usr/bin/avconv'
## Insert private stuff next:
@MohamedMohsenX2
MohamedMohsenX2 / thumbor-instructions.md
Created May 31, 2019 04:52 — forked from pengkong/instructions.md
Thumbor Server on AWS

Update AWS Instance

Launch and SSH to AWS Instance
Type sudo su
Type yum update -y
Type yum groupinstall "Development Tools" -y
Type pip install --upgrade pip (pip resides at /usr/local/bin/pip, pip version 8.0.2, python version 2.7.10)

Install Thumbor Dependencies

Type yum install libjpeg-turbo-devel libjpeg-turbo-utils libtiff-devel libpng-devel pngcrush jasper-devel libwebp-devel libcurl-devel cmake -y
Type /usr/local/bin/pip uninstall pycurl

@MohamedMohsenX2
MohamedMohsenX2 / run-xtrabackup.sh
Created May 15, 2019 13:37 — forked from jmfederico/run-xtrabackup.sh
Script to create full/incremental backups with xtrabackup.
#!/bin/sh
TMPFILE="/tmp/xtrabackup-runner.$$.tmp"
USEROPTIONS="--user=${MYSQL_USER} --password=${MYSQL_PASSWORD} --host=${MYSQL_HOST}"
BACKDIR=/srv/mysql-bak
BASEBACKDIR=$BACKDIR/base
INCRBACKDIR=$BACKDIR/incr
FULLBACKUPCYCLE=604800 # Create a new full backup every X seconds
KEEP=1 # Number of additional backups cycles a backup should kept for.
START=`date +%s`
@MohamedMohsenX2
MohamedMohsenX2 / yii2-server-config.md
Created May 5, 2019 05:37 — forked from yidas/yii2-server-config.md
Yii2 Server Configuration for Nginx & Apache (Subdirectory)

Yii2 Server Configuration for Nginx & Apache (Subdirectory)

It's easy to configurate a Yii2 server site with directory protection:

Yii2 Web Server Configuration

Sub Directory Site Application

With using Sub Directory for Yii2, you could set sub-directory path into yii2's config:

@MohamedMohsenX2
MohamedMohsenX2 / install_nano_v4.0_on_mac.sh
Created March 29, 2019 10:16 — forked from fevangelou/install_nano_on_macos_without_homebrew.sh
Install Nano Editor v4.0 (with syntax highlighting) on the Mac
#!/bin/bash
# Install Nano Editor (https://www.nano-editor.org) with syntax highlighting on the Mac
# Version 4.0 ("Thy Rope of Sands") released March 24th 2019
cd ~/
wget https://www.nano-editor.org/dist/v4/nano-4.0.tar.gz
tar -xvf nano-4.0.tar.gz
mv nano-4.0 .nano
cd .nano/
@MohamedMohsenX2
MohamedMohsenX2 / nginx.conf
Created March 26, 2019 21:12 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048