• 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


  • Cannot open your terminal ‘/dev/pts/0’ – please check

    script /dev/null


  • Install ERPnext

    Prepare system
    sudo apt-get update && sudo apt-get upgrade
    sudo apt-get install python-minimal

    Make SWAP
    sudo fallocate -l 1G /swapfile
    sudo chmod 600 /swapfile
    sudo mkswap /swapfile
    sudo swapon /swapfile

    Make SWAP permanent
    Edit fstab:
    /swapfile none swap sw 0 0

    If RAM < 1G add line to /etc/sysctl.conf vm.overcommit_memory=1

    Create user with sudoer rights
    adduser <username>
    usermod -aG sudo <username>

    Run commands as user from user home dir
    wget https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
    sudo python install.py --develop

    bench init frappe-bench && cd frappe-bench
    bench get-app erpnext https://github.com/frappe/erpnext
    bench new-site site1.local
    bench --site site1.local install-app erpnext
    bench start

    Optionaly add developer mode before starting bench
    site_config.json
    "developer_mode":1


  • enable cross-origin resource sharing

    htaccess
    Header set Access-Control-Allow-Origin "*"

    Commands

    apachectl -t

    sudo service apache2 reload

    a2enmod headers

    sudo service apache2 restart


  • 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