Jan 17, 2012

MySQL create UTF database

The one command that I use very often and I always forget exactly how it was.  So here is how one creates UTF8 database in MySQL:

CREATE DATABASE dbname CHARACTER SET utf8 COLLATE utf8_general_ci;

Jan 14, 2012

Aria2 - awesome command line download manager

Back in my Windows days aka the dark ages, I was very into download managers.  This was probably because those days we had slow Internet like dial-up and cable with speeds up to 128 kbps down / 64 kbps up. So at this kind of speeds it makes more sense to use download managers, mostly  because you are waiting all the time and these managers made you feel that things moved faster even if sometimes that was not the case. Also, IE was very dominant browser at the time and when it crashed  you would have to re-download instead of just continue, that was the biggest reason why I was using FlashGet, Go!Zilla and of course Download Accelerator Plus.
I am still under the impression that most of these programs were "placebo" like, just making you feel that things are moving faster.

Nowadays download speed is rarely the issue, but sometimes we like to automate downloads. Great way to automate is using terminal based download manager. Aria2 has some very interesting features that we can use. Basically aria2 is a lightweight multi-protocol and  multi-source command line download manager. It has support for HTTP/HTTPS, FTP, BitTorrent, and Metalink

There are many other alternatives that come to mind like wget or cURL but with aria2 you can download files from several URIs using different protocols and also if you give aria2 list of files it will download them concurrently.
aria2 download very well: aria2 cancels slow servers and use the faster server to finish the download. In other words, it is very clever and reliable in many different situations and it does most of the downloads in parallel.


You can download it directly from SourceForge. 
I'm using the Linux version, but there are releases of Windows and Android, but I can't say that I have tried them. There are also packages for most of the Linux distributions.

For Debian based (Ubuntu, Linux Mint):

sudo apt-get install aria2 

Arch Linux

sudo pacman -S aria2 
Fedora and yum based
sudo yum install aria2

Few simple examples 
  • Download a file

 aria2c  location-or-URL-of-file

  • Download from multiple sources

 aria2c  location1 location2 location3 ... 

  • Download torrent

 aria2c location-of-file.torrent 

  • List files in a torrent

aria2c -S location-of-file.torrent 

  • Download specific files from torrent

aria2c --select-file=1,2,3... location-of-file.torrent

index of files ( 1,2,3 ) can be  found with -S command
  • Limit speed for upload ( on torrent files, for example )

aria2c --max-upload-limit=200K location-of-file.torrent 

  • Limit speed for download

aria2c --max-download-limit=100K location of file

  • Pause and resume
In order to pause just press Ctrl+C and to resume enter the same command at the same location. Aria2 keeps .aria2 files where it memorizes the current download progress.
  • Download using multiple connections

aria2c -j7 -x2 location-of-file  other-location-of-file...

this way we instruct aria2c to use 7 concurrent connections with max 2 connections per server
  • Download  a list of files from URI provided in a file

aria2c -i file-with-uris.txt 



Follow by Email