Skip to content

Instantly share code, notes, and snippets.

View ahmed-abdelazim's full-sized avatar

Ahmed Abdeazim ahmed-abdelazim

View GitHub Profile
@ahmed-abdelazim
ahmed-abdelazim / README.md
Created November 14, 2024 07:11
Nest project auto deployment with Github actions

Here's a complete tutorial that will guide you through setting up an automated deployment pipeline using GitHub Actions, Docker Compose, and Docker Hub. This will deploy any code pushed to the main branch to a Docker Compose server. Let’s break down the process step-by-step.

Prerequisites

  1. Docker & Docker Compose installed on your server.
  2. Docker Hub account or access to another Docker registry.
  3. GitHub repository containing your application code.
  4. SSH access to your Docker server.

Step 1: Create a Dockerfile

@ahmed-abdelazim
ahmed-abdelazim / readme.md
Last active November 13, 2024 02:21 — forked from Trogvars/readme.md
Centos 7 upgrade to 8, Migrate to Stream or Rocky Linux.

Doing upgrade of Centos 7 server to Centos 8. Step to step guide.

1. Migrating backup of working system to virtual guest or another server.

Preparation of test image. Boot from Centos 7 CD into troubleshoot mode and skip to shell. Prepare disks of guest machine. Make partitions and filesystems.

Sda2 - boot - ext2

@ahmed-abdelazim
ahmed-abdelazim / zimbra-ssl.sh
Last active June 18, 2022 13:03
zimbra update ssl cert
export YourSSLDomain=mail.yourdomain.com
# Renew or generate cert
certbot renew
# Copy cert
cp /etc/letsencrypt/live/$YourSSLDomain/* /opt/zimbra/ssl/letsencrypt
chown zimbra:zimbra /opt/zimbra/ssl/letsencrypt/*
# if first time copy the key to the right place
cp /etc/letsencrypt/live/$YourSSLDomain/privkey.pem /opt/zimbra/ssl/zimbra/commercial/commercial.key
# fix permissions
@ahmed-abdelazim
ahmed-abdelazim / .linode
Created April 10, 2022 09:07
certbot/dns-linode Docker issue certificate and renew
# Linode token
dns_linode_key = YOUR_ACCESS_TOKEN
@ahmed-abdelazim
ahmed-abdelazim / cloudfront.sh
Last active July 31, 2024 13:14
Bash script to update coudfront origin using aws cli
#!/bin/bash
CLOUDFRONT_DISTRIBUTION_ID=E2C3RNL2F4MRMQ
NEW_ORIGIN="origin2-zaid.s3.us-west-2.amazonaws.com"
ETAG=`aws cloudfront get-distribution --id $CLOUDFRONT_DISTRIBUTION_ID | jq -r .ETag`
aws cloudfront get-distribution --id $CLOUDFRONT_DISTRIBUTION_ID | \
jq --arg NEW_ORIGIN "$NEW_ORIGIN" '.Distribution.DistributionConfig.Origins.Items[0].Id=$NEW_ORIGIN' | \
jq --arg NEW_ORIGIN "$NEW_ORIGIN" '.Distribution.DistributionConfig.Origins.Items[0].DomainName=$NEW_ORIGIN' | \
jq --arg NEW_ORIGIN "$NEW_ORIGIN" '.Distribution.DistributionConfig.DefaultCacheBehavior.TargetOriginId=$NEW_ORIGIN' | \
jq .Distribution.DistributionConfig > config.json
aws cloudfront update-distribution --id $CLOUDFRONT_DISTRIBUTION_ID --distribution-config "file://config.json" --if-match $ETAG > /dev/null
@ahmed-abdelazim
ahmed-abdelazim / .htaccess
Created June 3, 2021 12:31
NodeJs htaccess for apache ONLY resources folder
RewriteEngine On
RewriteRule ^$ http://127.0.0.1:3020/ [P,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#RewriteRule ^(.*)$ http://127.0.0.1:3020/$1 [P,L]
RewriteRule ^/?resources/(.*)$ http://127.0.0.1:3020/resources/$1 [L,P]
@ahmed-abdelazim
ahmed-abdelazim / allow.sql
Last active May 29, 2021 17:00
mysql allow root password login
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'the-password';
SELECT user,authentication_string,plugin,host FROM mysql.user;
FLUSH PRIVILEGES;
@ahmed-abdelazim
ahmed-abdelazim / index.html
Created January 25, 2021 11:51
pdf writer
<!doctype html>
<html ng-app="app">
<head>
</head>
<body>
<div ng-controller="LayoutViewController as $ctrl" class="container">
<div class="row">
@ahmed-abdelazim
ahmed-abdelazim / multiprocessing-pool.py
Last active July 3, 2020 15:38
multiprocessing python example
import multiprocessing.pool
import time
def theout(i):
print(i)
time.sleep(1)
pool = multiprocessing.pool.Pool(processes=10)
pool.map(theout, range(100))
@ahmed-abdelazim
ahmed-abdelazim / iptables-fix.sh
Created June 3, 2020 14:45
iptables fix after flush
#!/bin/sh
IPT="/sbin/iptables"
# Set default policies for all three default chains
$IPT -P INPUT ACCEPT
$IPT -P FORWARD ACCEPT
$IPT -P OUTPUT ACCEPT
# Flush old rules, old custom tables