Skip to main content

Posts

Find UUID

How to find UUID of iPhone using on ubuntu?? This is very easy and can be done by using following command on terminal lsusb-s :`lsusb | grep iPhone | cut -d ' ' -f 4 | sed 's/://'` -v | grep iSerial | awk '{print $3}' This will give you forty 40 charactors long string

How to create virtual host on ubuntu apache2

How to create virtual host on ubuntu? create conf file under /etc/apache2/sites-available/ name it as vhosts.conf and put following contents <VirtualHost 127.0.0.3:80> ServerAdmin webmaster@test.dev ServerName test.dev ServerAlias www.test.dev DocumentRoot /var/www/html/projects/test ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost> run following command to enable site sudo a2ensite vhosts.conf run following command to restart apache service sudo service apache2 restart run following command to enable rewrite mode sudo a2enmod rewrite and thats it

GIT Commands

Here some general GIT Commands How to get/show remote URL of cloned repository git remote show origin How to add all changes to git git add -A How to commit changes with message git commit -m "message here" How to push changes to master branch git push origin master How to find difference in file git diff app/helpers.php How to git export git archive master --format=zip --output=/home/jaffarhussain/citytwig_dev.zip How to delete files from git git rm -f *.DS_Store How to show log history git log -p -2

Get Specific Zone Time

Get Specific Zone DateTime from server time function getdateTimeByZone($serverZone , $userZone = 'UTC', $serverDateTime){     //$serverDateTime must be with time     $serverDateTime = date('Y-m-d H:i:s',strtotime($serverDateTime));     $schedule_date = new DateTime($serverDateTime, new DateTimeZone($serverZone));     $schedule_date-&gt;setTimeZone(new DateTimeZone($userZone));     $convertedTime =  $schedule_date-&gt;format('Y-m-d H:i:s');     return $convertedTime; } echo getdateTimeByZone('America/Los_Angeles' , 'Asia/Karachi', '2015/08/20 04:27 AM');

General linux commands

When I have started working on linux platform, i was unable to work. And I m writing this myself actually so that i can get help form this post to know about particular command and this post can also help others. I will be covering all below questions. How to find pid of program like firefox? How to find out the current running kernel version? How to find a file with .txt extension in particular directory? How to find a file containing word 'hello' in particular directory? How to change ownership recursively? How to change permissions on directory recursively? How to login using ssh? How to check if package is installed Let for example if we want to check if apache is installed? How to check for processes listening on port 80? How to check for a procesess files are located? How to Zip a folder in linux? How to remove directory in linux? How to find pid of program like firefox? ps -aux | grep firefox How to find out the current running kernel version? cat /...

Reduce Page Speed

Enable gzip compression <IfModule mod_deflate.c>     AddOutputFilterByType DEFLATE image/png image/gif image/jpeg image/jpg text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript application/json </IfModule> AddType font/ttf .ttf AddType font/eot .eot AddType font/otf .otf AddType font/woff .woff AddType font/svg .svg Leverage Browsing Cache <IfModule mod_expires.c>     ExpiresActive On     ExpiresDefault "access plus 10 days"     ExpiresByType image/png "access plus 10 days"     ExpiresByType image/gif "access plus 10 days"     ExpiresByType image/jpeg "access plus 10 days"     ExpiresByType image/jpg "access plus 10 days"     ExpiresByType text/css "access plus 10 days"     ExpiresByType application/javascript "access plus 10 days"     ExpiresByType applicati...

Regular Expression For Javascript

For Email :   /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/ For Name (Only For Alphabetic) : /^[-_ a-zA-Z]+$/ For Phone Number (Atleast 5 characters,With (+) Sign) : /^[+ 0-9]{5,15}\s*$/ For Textarea or Message : /^[a-zA-Z][;,-_ a-zA-Z0-9]+$/ For Alpha Numeric (Not Allowed Integer) : /^(?![0-9]*$)[-_ a-zA-Z0-9]+$/ For Test: You can store above regression in variable and then check it is valid or not.For example... var letters = /^[-_ a-zA-Z]+$/; if(letters.test(name)) {        return true; }else{       return false; }