Skip to content

Instantly share code, notes, and snippets.

View a7madgamal's full-sized avatar

Ahmed Hassanein a7madgamal

View GitHub Profile
@a7madgamal
a7madgamal / apparix.sh
Last active January 1, 2016 07:29
path bookmarks for terminal,"sudo apt-get install apparix" then append the gist code to the ~/.bashrc file =========================================== syntax: cd /very/long/bath/to/very/deep/folder/ >bm notsolong now wherever you are,this command takes you to your bookmark >to notsolong
function to () {
if test "$2"; then
cd "$(apparix "$1" "$2" || echo .)";
else
cd "$(apparix "$1" || echo .)";
fi
pwd
}
function bm () {
if test "$2"; then
@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>
@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

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 / fstab
Created April 15, 2014 10:25
fstab permissions fix for mounting drives
uid=1000,gid=1000,umask=002 0 0
@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.
## 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 / 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"
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.
cd /var/www/
sudo chown -R www-data:www-data html