• Mail from CMD

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


  • 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'


  • find file

    find /home/john -iname "something"


  • Clone drive linux

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


  • icecast on 80

    iptables -A PREROUTING -t nat –dst 8.8.8.8/32 -p tcp –dport 80 -j DNAT –to 8.8.8.8:8080

    iptables -A INPUT -p tcp -m state –state NEW –dport 80 –dst 8.8.8.8/32 -j ACCEPT


  • htaccess

    izveidot jaunu
    htpasswd -c /home/pwww/.htpasswd jerry
    labot esošo
    htpasswd /home/pwww/.htpasswd-users tom


  • bash lame convertor

     

    #!/bin/sh
    # name of this script: wav2mp3.sh
    # wav to mp3
    
    for i in *.wav; do
     if [ -e "$i" ]; then
       file=`basename "$i" .wav`
       lame -h -b 192 "$i" "$file.mp3"
     fi
    done

     


  • NGINX Random Error Page

    Ja jāšķiro pēc ip adresēm tad – $remote_addr

    http {
    split_clients $echo_request_uri $c_host {
    50% c1;
    50% c2;
    }

    server {
    location /data/ {
    error_page 404 = /data/$c1.html;
    error_page 403 = /data/$c1.html;
    }


  • sshfs mount

    sshfs root@10.233.10.212:/ /mnt/ssh/


  • Configure hostname

    You should double confirm the system hostname if it looks good. For example if this host is www.example.com, the /etc/hostname can be:
    host.example.com
    The /etc/hosts should also be:
    127.0.0.1 localhost
    127.0.1.1 host.example.com host

    Now reboot your system, and check the system hostname with command:
    hostname
    Ensure all APT source enabled

    By default some of your APT source may be disabled, so let’s enable them with:
    sed -i 's/^#\s*deb/deb/g' /etc/apt/sources.list
    Install Virtualmin with GPL installation script (not available yet on 2012-04-30)

    Just simply access http://www.virtualmin.com/download.html and download the Virtualmin installation script with wget:

    cd /tmp
    wget http://software.virtualmin.com/gpl/scripts/install.sh
    /bin/bash /tmp/install.sh