Linux adding a new user

useradd -d /home/testuser -m testuser

Fiding domain hosting from root servers

Step 1:

dig +norec @a.root-servers.net. yourdomain.com

Result: Returns list of webservers where more information available. one of them for example is localwebserver.com

Step 2:

dig +norec @localwebserver.com. yourdomain.com

git compare branches

git diff master 0.2
 
git diff 0.1 0.2

php tip not to use count in for iteration

Dont use count() in loops because each iteration will count the number of elements; make a variable $count = count($array) and use the variable instead

php using sorting methods

class Newclass
{
 
public static function compare($a, $b)
{
return strcmp($a["name"], $b["name"]);
}
 
}
 
usort($array_to_srt, array("Newclass", "compare"));
 
 
 
uasort($array_to_srt, array("Newclass", "compare"));
 
The difference between usort and uasort is that uasort keeps the keys, usort resets them and enumerate from scratch.

Git overwrite local branch to match remote branch

git reset --hard origin/master

Git force push to overwrite on remote

git push -f origin myremotebranch
git push -f myprivate master:master
git push -f

Linux how-to delete the first line in text file

tail -n +1 filename.txt > filename.txt.new

Git reset hard to make local as remote branch

git reset --hard origin/master

git http ssl import/export no certificate verify

export GIT_SSL_NO_VERIFY=1