Posts

Linux: Copy data from source to destination

Image
  Linux: Copy data from source to destination Example cp -a /var/www/html/source/. /var/www/html/destination/

Count down timer - Javascript

Image
HTML    < div   class = "counter_outer" >                      < ul >                          < li >                              < ul >                                  < li >< span   class = "daysNumber" > 00 </ span ></ li >                                  < li   class = "daysText" > Days </ li >                              </ ul >                          </ li >                          < li >                              < ul >                                  < li >< span   class = "hoursNumber" > 00 </ span ></ li >                                  < li   class = "hoursText" > Hours </ li >                              </ ul >                          </ li >                          < li >                              < ul >                                  < li >< span   cl

Install Node.js in Azamon Linux 2

Image
  Just run the below code in the command Here setup_8.x is your version. You can change your desired version. Example:  setup_8.x,  setup_12.x,  setup_14.x, etc curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash - sudo yum -y install nodejs

Encrypt Dycrypt in php

Image
  PHP Code Now you can make your own PHP encryption-decryption function using PHP Function:      function   my_crypt (  $string ,  $action  =  'e'  ) {           $secret_key  =  'make ur own key' ;           $secret_iv  =  'make your own iv' ;           $output  =  false ;       $encrypt_method  =  "AES-256-CBC" ;       $key  =  hash (  'sha256' ,  $secret_key  );       $iv  =  substr (  hash (  'sha256' ,  $secret_iv  ),  0 ,  16  );       if (  $action  ==  'e'  ) {           $output  =  base64_encode (  openssl_encrypt (  $string ,  $encrypt_method ,  $key ,  0 ,  $iv  ) );      }       else   if (  $action  ==  'd'  ){           $output  =  openssl_decrypt (  base64_decode (  $string  ),  $encrypt_method ,  $key ,  0 ,  $iv  );      }       return   $output ;      }  Used:      // encrypt       echo   my_crypt ( "hello world" ,  "e" );      // output YmVuUEhBdXRHbDNEMm84aTZHQ05jdz09      // decryp

Wordpress: Change profile picture wihout plugin and gravatar

Image
Step 1: go to wp-content/themes/yourtheme/functions.php write:           add_filter (  'get_avatar' ,  'ChangeAdminProfileIfNot' ,  10 ,  5  );          function   ChangeAdminProfileIfNot (  $avatar  =  '' ,  $id_or_email ,  $size  =  96 ,  $default  =  '' ,  $alt  =  ''  ) {              if (  "user_has_uploaded_a_local_avatar" ) {                               $avatar  =  "<img src='your image path' class='avatar avatar-{ $size } photo' height='{ $size }' width='{ $size }'" ;                                           }              return   $avatar ;         } Note:  user_has_uploaded_a_local_avatar This will check user or admin have profile picture If you want to change profile picture only for admin  then write:          add_filter (  'get_avatar' ,  'ChangeAdminProfileIfNot' ,  10 ,  5  );          function   ChangeAdminProfileIfNot (  $avatar  =  '' ,  $id_or_em

Google captcha validation with server side

Image
Create Captcha Credential here HTML:         < form   id = "registration"   name = "registration"   action = "#"   method = "POST" >          < input   type = "text"   name = "name"   placeholder = "Name"   />          < input   type = "email"   name = "email"   placeholder = "Email"   />          < input   type = "number"   name = "number"   placeholder = "Mobile Number"   />          < input   type = "password"   name = "password"   placeholder = "Password"   />          < div   class = "form-group" >              < div   class = "g-recaptcha"   data-sitekey = "6LcWrMQUAAAAAHbCcCs08zYuhGvdeO16D8WXL-Da"   data-callback = "verifyRecaptchaCallback"   data-expired-callback = "expiredRecaptchaCallback" ></ div

Print particular section in Javascript

Image
function   printDiv ( divName ) {   var   date  =  divName . parentElement . parentElement . querySelectorAll ( "td" )[ 0 ]. innerHTML ;   var   senderNameNumber  =  divName . parentElement . parentElement . querySelectorAll ( "td" )[ 1 ]. innerHTML ;   var   accountNumber  =  divName . parentElement . parentElement . querySelectorAll ( "td" )[ 2 ]. innerHTML ;   var   AccountHolderName  =  divName . parentElement . parentElement . querySelectorAll ( "td" )[ 3 ]. innerHTML ;   var   Amount  =  divName . parentElement . parentElement . querySelectorAll ( "td" )[ 4 ]. innerHTML ;   var   Tax  =  divName . parentElement . parentElement . querySelectorAll ( "td" )[ 5 ]. innerHTML ;   var   status  =  divName . parentElement . parentElement . querySelectorAll ( "td" )[ 6 ]. innerText ;   var   data  =  `<table class='table table-bordered'>    <tr>     <th>Sender Name

Add dot dot after 3 line using css

Image
< div   class = "text" >     Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam consectetur venenatis blandit. Praesent vehicula,     libero non pretium vulputate, lacus arcu facilisis lectus, sed feugiat tellus nulla eu dolor. Nulla porta bibendum     lectus quis euismod. Aliquam volutpat ultricies porttitor. Cras risus nisi, accumsan vel cursus ut, sollicitudin     vitae dolor. Fusce scelerisque eleifend lectus in bibendum. Suspendisse lacinia egestas felis a volutpat. </ div >      .text  {          overflow :  hidden ;          text-overflow :  ellipsis ;          display : -webkit-box;          -webkit-line-clamp :  3 ;  /* number of lines to show */          -webkit-box-orient :  vertical ;     }

Window is not defined error in node.js

Image
         const   app  =  express ();          const   PORT  =  process . env . PORT  ||  4000 ;          const   DIST_FOLDER  =  join ( process . cwd (),  'dist/browser' );          const   domino  =  require ( 'domino' );          const   fs  =  require ( 'fs' );          const   path  =  require ( 'path' );          const   template  =  fs . readFileSync ( 'dist/browser/index.html' ). toString ();          const   win  =  domino . createWindow ( template );          global [ 'window' ] =  win ;          global [ 'document' ] =  win . document ;          global [ 'DOMTokenList' ] =  win . DOMTokenList ;          global [ 'Node' ] =  win . Node ;          global [ 'Text' ] =  win . Text ;          global [ 'HTMLElement' ] =  win . HTMLElement ;          global [ 'navigator' ] =  win . navigator ;          global [ 'html2pdf' ] =  win . HTMLEl