• Background Video

    <video autoplay loop poster="polina.jpg" id="bgvid">
    <source src="polina.webm" type="video/webm">
    <source src="polina.mp4" type="video/mp4">
    </video>

    video#bgvid {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    -webkit-transform: translateX(-50%) translateY(-50%);
    transform: translateX(-50%) translateY(-50%);
    background: url(polina.jpg) no-repeat;
    background-size: cover;
    }

    @media screen and (max-device-width: 800px) {
    body { background: url(polina.jpg) #000 no-repeat center center fixed; }
    #bgvid { display: none; }
    }

    http://demosthenes.info/blog/777/Create-Fullscreen-HTML5-Page-Background-Video


  • Mail from CMD

    mail -a "Content-type: text/html;" -s Test address@example.com < mail_html.html


  • ISPConfig 3 SpanAssassin autolearn

    ou can start out by creating a new file in /bin. For example sa_learn.
    nano /bin/sa_learn

    Now once you are in that file you can paste the following:
    #!/bin/bash
    /usr/bin/sa-learn --spam /var/vmail/*/*/.Junk/*/*
    /usr/bin/sa-learn --ham /var/vmail/*/*/cur/*

    The first part to this code is the directory of the SpamAssassin learning script, when putting in the –spam it learns it as spam, and –ham learns it has “good” messages. The second part to this code is the directory to your clients’ spam folders. So once this is all done, you can learn all spam in your customers’ spam folders.
    After you have saved that file by clicking ctrl x, you will want to make it executable by doing the following command:
    chmod o+x /bin/sa_learn

    And then now from the command prompt you can simply type
    sa_learn

    and it will learn spam and ham!


  • Network usage satistics

    iptraf
    bmon
    tcptrack -i eth1


  • Windows XP remote

    Interaktīvais logs
    shutdown -i

    net use \\hostname\ipc$


  • MySQL tuning

    key_buffer_size

    An important variable setting is key_buffer_size; a good value is the 20% of total RAM.

    Here it is a sample:

    key_buffer_size = 820M

    max_connections

    Also, the max_connections variable could be safely lowered from its default value. Take a look at your Max used connections status variable; you can safely set the max_connections to Max used connections x 5, with a minimum of 40.

    Sample:

    max_connections = 85

    tmp_table_size and max_heap_table_size

    Finally, it’s important to take a look to tmp_table_size and max_heap_table_size. You can get a good value for them by dividing the available RAM by the max_connections variable.

    Sample:

    # Total RAM: 4GB; Mysql supposed available RAM: 3GB; Max_connections: 85;
    # Good Value = 3GB / 80 = 35MB
    tmp_table_size = 35M
    max_heap_table_size = 35M


  • FLAC to MP3

    sudo apt-get install flac
    sudo apt-get install lame

    for f in *.flac; do flac -cd "$f" | lame -b 320 - "${f%.*}".mp3; done

    alias flac2mp3='for f in *.flac; do flac -cd "$f" | lame -b 320 - "${f%.*}".mp3; done'


  • Category latest posts menu

    Put in functions.php

    // Front end only, don't hack on the settings page
    if ( ! is_admin() ) {
    // Hook in early to modify the menu
    // This is before the CSS "selected" classes are calculated
    add_filter( 'wp_get_nav_menu_items', 'display_lasts_ten_posts_for_categories_menu_item', 10, 3 );
    }

    // Add the ten last posts of af categroy menu item in a sub menu
    function display_lasts_ten_posts_for_categories_menu_item( $items, $menu, $args ) {

    $menu_order = count($items); /* Offset menu order */
    $child_items = array();

    // Loop through the menu items looking category menu object
    foreach ( $items as $item ) {

    // Test if menu item is a categroy and has no sub-category
    if ( 'category' != $item->object || ('category' == $item->object && get_category_children($item->object_id)) )
    continue;

    // Query the lasts ten category posts
    $category_ten_last_posts = array(
    'numberposts' => 10,
    'cat' => $item->object_id,
    'orderby' => 'date',
    'order' => 'DESC'
    );

    foreach ( get_posts( $category_ten_last_posts ) as $post ) {
    // Add sub menu item
    $post->menu_item_parent = $item->ID;
    $post->post_type = 'nav_menu_item';
    $post->object = 'custom';
    $post->type = 'custom';
    $post->menu_order = ++$menu_order;
    $post->title = $post->post_title;
    $post->url = get_permalink( $post->ID );
    /* add children */
    $child_items[]= $post;
    }
    }
    return array_merge( $items, $child_items );
    }


  • find file

    find /home/john -iname "something"


  • Clone drive linux

    dd if=/dev/sda of=/dev/sdb