• Div add remove example using jquery using plus minus button

    
         var experience=2;
        $( "#addBtn" ).click(function() {
          $('#experience-1')
              .clone()
              .attr('id', 'experience-'+ experience)
              .insertAfter($('[id^=experience]:last'));  
     $("#experience-"+experience).find('span').attr('onclick', 'myfun("experience-'+experience+'")');
              experience++;    
    });
    function myfun(sid)
    {
     $('#'+sid).remove();
    }
        
  • create copy of div using jquery
    Goodbye
    Hello
    $( ".hello" ).clone().appendTo( ".goodbye" );
    
    Hello
    Goodbye
    Hello
  • Function to optimize website
    /*****Function to optimize website*****/
    
    function remove_cssjs_ver( $src ) {
    if( strpos( $src, '?ver=' ) )
     $src = remove_query_arg( 'ver', $src );
    return $src;
    }
    add_filter( 'style_loader_src', 'remove_cssjs_ver', 10, 2 );
    add_filter( 'script_loader_src', 'remove_cssjs_ver', 10, 2 );
    
    remove_action( 'wp_head', 'rsd_link' ) ;
    
    remove_action('wp_head', 'print_emoji_detection_script', 7);
    remove_action('wp_print_styles', 'print_emoji_styles');
    remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
    remove_action( 'admin_print_styles', 'print_emoji_styles' );
    
    remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
    
    function disable_embed(){
    wp_dequeue_script( 'wp-embed' );
    }
    add_action( 'wp_footer', 'disable_embed' );
    
    add_filter('xmlrpc_enabled', '__return_false');
    
    remove_action( 'wp_head', 'wp_generator' ) ;
    
    remove_action( 'wp_head', 'wlwmanifest_link' ) ;
    
    function disable_pingback( &$links ) {
     foreach ( $links as $l => $link )
     if ( 0 === strpos( $link, get_option( 'home' ) ) )
     unset($links[$l]);
    }
    add_action( 'pre_ping', 'disable_pingback' );
    
    add_action( 'init', 'stop_heartbeat', 1 );
    function stop_heartbeat() {
    wp_deregister_script('heartbeat');
    }
    
    
  • how to check zombie process in ubuntu

    Find the zombie

    $ ps aux | grep 'Z'

    What you get is Zombies and anything else with a Z in it, so you will also get the grep:

    USER       PID     %CPU %MEM  VSZ    RSS TTY      STAT START   TIME COMMAND
    usera      13572   0.0  0.0   7628   992 pts/2    S+   19:40   0:00 grep --color=auto Z
    usera      93572   0.0  0.0   0      0   ??       Z    19:40   0:00 something
    

    Find the zombie’s parent:

    $ pstree -p -s 93572

    Will give you:

    init(1)---cnid_metad(1311)---cnid_dbd(5145)

    kill process ubuntu

    sudo kill -9 process_id

    $ sudo kill -1 7667
    $ sudo kill -9 1317

    Kill all processes you can kill.

     $ sudo  kill -9 -1

    working your way up to -9

  • conntrack

    Connection tracking (“conntrack”) is a core feature of the Linux kernel’s networking stack. It allows the kernel to keep track of all logical network connections or flows, and thereby identify all of the packets which make up each flow so they can be handled consistently together.