Skip to content

Instantly share code, notes, and snippets.

View a7madgamal's full-sized avatar

Ahmed Hassanein a7madgamal

View GitHub Profile
javascript:(function(){var h,a,f;a=document.getElementsByTagName('link');for(h=0;h<a.length;h++){f=a[h];if(f.rel.toLowerCase().match(/stylesheet/)&&f.href){var g=f.href.replace(/(&|%5C?)forceReload=\d+/,'');f.href=g+(g.match(/\?/)?'&':'?')+'forceReload='+(new Date().valueOf())}}})()
cd /var/www/
sudo chown -R www-data:www-data html
In Terminal, paste the following: defaults write com.apple.finder AppleShowAllFiles YES
Press return
Hold the ‘Option/alt’ key, then right click on the Finder icon in the dock and click Relaunch.
@a7madgamal
a7madgamal / gist:38121322f411edf18a6a
Last active August 29, 2015 14:06
install composer globally
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
#in .bashrc
export PATH="$PATH:~/.composer/vendor/bin"
## Configure eth0
#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
@a7madgamal
a7madgamal / cls
Last active October 27, 2016 12:00
REAL cls for linux
# Use this command to do a terminal clear screen instead of just adding new lines ...
printf "\033c"
# alias it as cls
alias cls='printf "\033c"'
# \033 == \x1B == 27 == ESC
# this becomes <ESC>c which is the VT100 escape code for resetting the terminal.
@a7madgamal
a7madgamal / fstab
Created April 15, 2014 10:25
fstab permissions fix for mounting drives
uid=1000,gid=1000,umask=002 0 0

Installing git on CentOS 5 using yum

Since you're using CentOS 5, the default package manager is yum, not apt-get. To install a program using it, you'd normally use the following command:

$ sudo yum install <packagename>

However, when trying to install git this way, you'll encounter the following error on CentOS 5:

@a7madgamal
a7madgamal / git_push_pull.sh
Last active March 29, 2018 14:45
shell script to commit local git repo,push current branch and pull on remote repo
#!/bin/bash
# usage:
# . /path/to/git_push_pull.sh "/local/git/repo/path" "remote/git/repo/path" "remoteuser@remotehost" "OPTIONAL:remote/source/folder" "OPTIONAL:remote/destination/location"
# it's better to create a separate script and name it project_name.sh for each project with this code:
#. /path/to/git_push_pull.sh "/local/git/repo/path" "remote/git/repo/path" "remoteuser@remotehost" "OPTIONAL:remote/source/folder" "OPTIONAL:remote/destination/location"
#the optional parameters are useful if you need to copy a folder from the repo (after pulling) to another location and not the whole git folder
@a7madgamal
a7madgamal / passwordless_ssh
Last active January 1, 2016 07:29
passwordless ssh connection
# step 1: on local machine
# (for first time only!)
ssh-keygen -t rsa
#copy the result exactly
cat ~/.ssh/id_rsa.pub
# step 2:on remote machine
ssh-copy-id <remote>