• download folder from web

    Get only zip files
    wget -A zip -r -l 1 -nd http://url.com/

    Get all files except html etc.
    wget -R html,htm,php,asp,jsp,js,py,css -r -l 1 -nd http://url.com


  • Get file header

    head test2.svn.gz|hexdump -C


  • Ubuntu Perl locale problem

    edit the file
    /etc/environment

    add one line with your LANG, like this

    LC_ALL="en_US.UTF-8"

    save and reboot


  • Create .deb file

    Create a directory to make your package in. The name should be the same as the package name.
    mkdir helloworld_1.0-1

    Pretend that the packaging directory is actually the root of the file system. Put the files of your program where they would be installed to on a system.
    mkdir helloworld_1.0-1/usr
    mkdir helloworld_1.0-1/usr/local
    mkdir helloworld_1.0-1/usr/local/bin
    cp "~/Projects/Hello World/helloworld" helloworld_1.0-1/usr/local/bin

    Now create a special metadata file with which the package manager will install your program…
    mkdir helloworld_1.0-1/DEBIAN
    gedit helloworld_1.0-1/DEBIAN/control

    Put something like this in that file…
    Package: helloworld
    Version: 1.0-1
    Section: base
    Priority: optional
    Architecture: i386
    Depends: libsomethingorrather (>= 1.2.13), anotherDependency (>= 1.2.6)
    Maintainer: Your Name <you@email.com>
    Description: Hello World
    When you need some sunshine, just run this
    small program!

    (the space before each line in the description is important)

    Now you just need to make the package:
    dpkg-deb --build helloworld_1.0-1

    Script files in /DEBIAN/ folder
    Postinst means: "AFTER the files have been Copied To the iDevice, THEN Run this Script."
    Preinst means: "BEFORE the files Get Copied To the iDevice, Run this Script, THEN Copy the files To the iDevice."
    Postrm means: "AFTER the files have been Removed From the iDevice, THEN Run this Script."
    Prerm means: "BEFORE the files Get Removed From your iDevice, Run this Script, THEN Remove the files From the iDevice."

    Sample postinst:
    #!/bin/bash
    cd /var/mobile/Applications/*/Game.app
    mkdir Backups
    cp -a ./Original_File.ext ./Backups/Original_File.bak
    killall Game
    mv -f /var/mobile/Documents/GameMod/Game/* ./
    exit 0


  • Linode Longview stuck

    Open /etc/gai.conf

    Uncomment the following line:

    #
    # For sites which prefer IPv4 connections change the last line to
    # precedence ::ffff:0:0/96 100

    This will allow you to still use IPv6 but sets IPv4 as the precedence so that apt-get won’t get stuck.


  • Virtualmin DNS error

    ‘/etc/dhcp3/dhclient.conf’

    prepend domain-name-servers 127.0.0.1;


  • opened port -> PID


    fuser -n tcp 1024


  • Build debian kernel

    Install required packages

    sudo apt-get install git fakeroot build-essential ncurses-dev xz-utils libssl-dev bc
    sudo apt-get --no-install-recommends install kernel-package
    Download kernel
    wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-4.4.tar.xz
    Unzip
    unxz linux-4.4.tar.xz
    tar xvf linux-4.4.tar
    Copy your config file and configure
    cd linux-4.4
    $ cp /boot/config-$(uname -r) .config

    make menuconfig
    Compile
    make-kpkg clean
    fakeroot make-kpkg --initrd --revision=1.0.myname kernel_image kernel_headers -j 4
    Install
    sudo dpkg -i ...


  • dmesg erroru meklēšana

    dmesg | more
    dmesg | egrep -i --color 'error|critical|failed'


  • opcache

    opcache.enable=1

    opcache.memory_consumption=128

    opcache.max_accelerated_files=4000

    opcache_revalidate_freq = 240

    sudo php5enmod opcache

    sudo service apache2 restart