Skip to content

Instantly share code, notes, and snippets.

View eslam-mahmoud's full-sized avatar

Eslam Mahmoud eslam-mahmoud

  • US
View GitHub Profile
@eslam-mahmoud
eslam-mahmoud / command line
Created August 3, 2016 10:36
git: How to ignore all present untracked files?
//If you instead want to permanently ignore currently untracked files you can, from the root of your project, launch:
$ git status --porcelain | grep '^??' | cut -c4- >> .gitignore
mongoexport -d {db name} -c {collection name} -q '{"_id":1}' --out ./records.json
mongoimport -u {user name} -p {password} --authenticationDatabase {db name} --db {db name} --collection {collection name} --file ./records.json --jsonArray
find . -name '*.sql' | awk '{ print "source",$0 }' | mysql -v -u{user} -p{pass} -f {DB Name} --batch
rsync --rsh='ssh' -av --progress --partial {user}@{domain or IP}:/home/dump.tar.gz ./
tar -xvzf ./dump.tar.gz
#install
sudo apt-get install nginx
#remove default
sudo nano /etc/nginx/sites-available/default
sudo rm /etc/nginx/sites-enabled/default
#create new file
sudo nano /etc/nginx/sites-available/{appName}
server {
listen 80;
#scp -i <keypair> myfile.txt ubuntu@ec2-x-x-x.com/home/ubuntu/myfile.txt
//add your EC2 .pem file to ssh kys
ssh-add ~/aws/mypemfile.pem
//create bare repo on AWS EC2 webserver and deploy on demand
mkdir ~/git/the_project
cd ~/git/the_project
git init --bare
//create local repo and track remote one
cd ~/git/the_project
#export branch to zip file
git archive --format zip --output /full/path/to/zipfile.zip master
#fix GIT issues
#Discarding all local commits on this branch
https://sethrobertson.github.io/GitFixUm/fixup.html#discard_all_unpushed
@eslam-mahmoud
eslam-mahmoud / httpd-vhosts.conf
Last active November 20, 2018 01:50
Apache VirtualHost
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents/appname"
ServerName appname.local
ServerAlias www.appname.local
ErrorLog "/private/var/log/apache2/appname.local.error"
CustomLog "/private/var/log/apache2/appname.local.custom" common
<Directory /Library/WebServer/Documents/appname/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted