Turn your Raspberry Pi into a fully working torrent box

In this post I’ll show you how to configure a Raspberry Pi to work as a torrent-box that can be even remote controlled: your Raspberry will be able to download torrents all day long if needed!

What I used

  • 320GB USB external hard drive self-powered (labeled “HD320G”), NTFS formatted from Windows. This HDD has a folder named “Transmission” in which we will store completed downloads, and inside there is also a folder called “_part” in which we will store incomplete downloads;
  • Raspberry Pi 2 with a clean official Raspbian release installed

First setup

Let’s set up our Raspbian environment and prepare everything for Transmission!

  • Login. We use “pi” as username and “raspberry” as password;
  • Start the UI. By typing startx after login;
  • Configure useful settings. Let’s type raspi-config in the terminal and set the boot to desktop (Enable boot to Desktop/Scratch -> Desktop login as user ‘pi’ at the graphical interface), in the Overclock section choos Pi2 or Turbo (to make the torrent client “smoother”), in the Advanced Options enable SSH (a very useful setting that will allow you to control the Raspberry Pi with a terminal of a another local or remote pc);

    raspi-config script allows you to set all your Raspberry's parameters easily

    raspi-config script allows you to set all your Raspberry’s parameters easily

  • External HDD power. If it’s the first time that you play with Raspberry you should know that power is a precious resource, it has only 3A with the adapter! So if your HDD has not an external power source you will problaby face to different freezes or crashes on your RPi: my advice is to use an external powered HDD or a Y cable maybe attached to your router USB port (as I currently do). But you can also try to force your micro-pc to deliver more energy than usual to usb ports: on your Raspberry desktop open the Terminal and let’s modify /boot/config.txt by typing:

    A text editor will show up, let’s edit the file by adding the following line at the end of it and save it.

    If before that our external HDD didn’t even switch on now it’s working but I must advice you that I encountered freezes and crashes when downloading torrents.
  • Installing NTFS utility. Raspbian has not a native support to the NTFS filesystem, so we have to install a specific package. On the terminal:
  • Mounting the HDD. The automount function available on Raspian does not allow us to write on the disk, with the command lsblk on the Terminal we should get to know our disk address:

    In my case I have that my “HDD320G”‘s address is /dev/sda1 , now all we have to do io unmount it and remount with ntfs-3g creating a folder called “hdd_ext”, for example, in media with mkdir:

    Now we can finally write on our disk.

    Obviously we have to execute these commands every time we boot up our Raspberry Pi, so let’s create a bash script in /home/pi for example, called startup.sh and we will write:

    To make this self-starting we can cite it in the file /etc/init.d/rc.local, writing at the end its path:

    Please note that the line 15 is very important (as we will see in this article), lines 3 and 13 will be clear going on.

Installing and configuring Transmission

After setting up the environment we can install Transmission an open-source torrent client. We will install a daemon version, because we have a Raspberry without a display and we want monitor it from remote. Transmission daemon has a good web interface that it will allow us to achieve our purpose.

Installation

Configuration

To proceed with the configuration we have to stop the daemon (we are obliged to do it, otherwise we will lost any changes to the configuration file). Let’s edit /etc/transmission-daemon/settings.json

This is how our setting file will look like, I highlighted important lines:

  • At lines 15 and 23 we write our folders paths
  • at line 24 we enable the incomplete folder
  • at line 47 we enable the web interface
  • at line 45 we set that a password is not required to access to web interface
  • It’s important to set the line 53 on “false” or we won’t be able to access to the web interface

Final operations

  • Give the right permission We have to set that our user identity is the owner of the setting file, let’s do it:
  • Restart transmission
  • Now we can access to our web interface by typing on the browser the IP and the port which transmission will listen to (line 49 of settings.json), for example in my case 192.168.0.7:9091. This is how the interface will look like:
    Transmission's web interface

    Transmission’s web interface

    From here we can manage every torrent.

    IP Blocking

    If you want you can also add a list of bad IP to Transmission, mainly p2p filter. We have to click on wrench then Peers then Enable Blocklist  and add this link

    http://john.bitsurge.net/public/biglist.p2p.gz

    Then Update as in the picture below

    Peers page of Transmission

    Peers page of Transmission

    That’s all!Comment this post with your doubts, thoughs and suggestions!

How to get FREE iTunes Store, Google Play and others gift cards [100% Working]

The title of this post seems a sort of publicity stunt but trust me when I say I can give you my guarantee that there are many services on the web that allows you to earn virtual credits used for redeem different kind of gift cards for iTunes, Google Play, PayPal and so on. At the end of this post I will list my preferred services and for each of those you will find a link to a guide that I made to start earning credits immediately. Now let’s see how these systems works in detail.

How they works

earning credits is extremely simple: just download and try apps, suggested apps. Yes, you read right you only need to download and try for 30sec/1min/2min the apps that the system offers you. When you will reach a threshold of 3000/5000/10000 credits (it depends on the services you use) you will be able to redeem gift cards codes. The system is just perfect, because everyone is earning something:

  • Developers earn a public for their apps
  • The service earns with the developers who paid for this sponsorship
  • We earn! Because we redeem gift cards

My guides

Now you can start to earn credits, here’s a list of my tested and working services. In every guide you will also find screenshots from my device:

Services chart

Nome Paypal Steam iTunes GPlay Amazon PSN Xbox Min Credits* Video, Banner**
FeaturePoints $ Y N Y Y Y Y 6000 N
AppBounty N Y Y Y Y Y Y 5000 N

The data in the table are subject to change. They are calculated by selecting “US” country.
* Credits minimum to redeem a 10$ iTunes or Google Play gift card
** possibility to earn point even watching videos or tapping on banners

Compatibility

The above services work with iOS, Android and maybe even with Windows Phone. None of them requires any kind of jailbreak, root or device’s alteration.

What are you waiting for? 😉

There is no way to hack these services, there’s no hack code that will give you million of points, so distrust who promises things like those because he’s deceiving you.

FeaturePoints: iTunes, Steam, Amazon and PayPal free gift cards!

In this guide we will see another service that allows you to gain free gifts cards for iTunes, Google Play, Steam, Paypal and so on. I’m talking about FeaturePoints. As we have already seen, in this post, how these kind of services works and a list of my preferred ones, let’s start!

Requirements

  • An iOS or Android (or Windows Phone? Let me know with a comment if it’s working!) device
  • An internet access
  • About 2 minutes of your time

Let’s start!

  1. First of all you have to open this post on your smartphone, so write this url on your browser (I suggest you to use Safari on iOS, otherwise some offers will not work) or just scan the qr code below:

    bit.ly/fpointstden

    Scan this qr with your smartphone to open this post on your browser

    Scan this qr with your smartphone to open this post on your browser

  2. Then, when you are from your smartphone just tap on this link to start using FeaturePoints with 50 free credits! (Only with that link, if also the service will ask you for an invite code just input this: 4KT3W6 to receive the free points)

    If this page appears let's input the code 4KT3W6 to receive 50 free points

    If this page appears let’s input the code 4KT3W6 to receive 50 free points

  3. Now you’ll be prompted to download the official FeaturePoint app, so let’s click on Download

    Tap download to download the app on the AppStore

    Tap download to download the app on the AppStore

  4. Let’s open the app and We will see the FeaturePoints’ home page: now we can start downloading offered apps by tapping on them gaining points, just try to download your first suggested app!

    FeaturePoints' home page will look like this

    FeaturePoints’ home page will look like this

    If you tap on whatever app you will see how should you do to gain points, in my case I have to use the app for 2 minutes. Tap to “Download App” to start downloading

    FeaturePoint will tell you what should you to gain points after downloading the app

    FeaturePoint will tell you what should you to gain points after downloading the app

  5. I suggest you to enable notification, so you will know when the points will be added to your account and you can close the app (and uninstalling if you don’t like it)

    When notification appears we can close the app

    When notification appears we can close the app

  6. By tapping on “Rewards” we can see every kind of gift card that we can redeem with our points but we have to check that our country is correct, otherwise we won’t able to redeem the card if the currency is different from our account’s one.

    FeaturePoint's reward page

    FeaturePoint’s reward page

AppBounty, Play Store and iTunes gift cards have never been so FREE!

In this post I will show a service that allows you to redeem free iTunes (and other stores like Google Play) gift cards: AppBounty. As we have already seen, in this post, how these kind of services works and a list of my preferred ones, let’s start!

Requirements

  • An iOS or Android (or Windows Phone? Let me know with a comment if it’s working!) device
  • An internet access
  • About 2 minutes of your time

Let’s start!

  1. First of all you have to open this post on your smartphone, so write this url on your browser (I suggest you to use Safari on iOS, otherwise some offers will not work) or just scan the qr code below:

    bit.ly/appbountytden

    Scan this qr with your smartphone to open this post on your browser

    Scan this qr with your smartphone to open this post on your browser

  2. Then, when you are from your smartphone just tap on this link to start using AppBounty with 50 free credits! (Only with that link, if also the service will ask you for an invite code just input this: fbgleiyq)
  3. We will see the AppBounty’s home page (after downloading the AppBounty app if requested) and now we can start downloading offered apps by tapping on them, just try to download your first suggested app!

    The AppBounty's home page will look like this

    The AppBounty’s home page will look like this

  4. By tapping on “Rewards” we can see every kind of gift card that we can redeem with our points but we have to check that our country is correct, otherwise we won’t able to redeem the card if the currency is different from our account’s one.

    The AppBounty's rewards page

    The AppBounty’s rewards page

Some screen of my first redeem with AppBounty

Determine if tree is AVL in O(n)

The following java method will determine if a binary tree is AVL (and, obviously BST)

Determine max and min root leaf path in a Binary Search Tree (BST)

Let’s view an algorithm that manage to find the minimum and the maximum root-leaf path in a binary search tree. I used three stacks in this algorithm, one is temporary and the other will be filled with the results. Note that if we change:

  • i > maxSeq.size() with i >= maxSeq.size() we get the longest root-leaf path from the right instead of from the left
  • i < minSeq.size() with i <= minSeq.size() we get the shortest root-leaf path from the left instead of from the right

Algorithms on Graphs

Depth-First-Search (DFS)

The first kind of visit in a graph is the DFS and its output is:

  • Generate a spanning forest;
  • Visit every edge and every vertex;
  • Determine if the graph is connected;
  • Calculate the connected components of the graph.

First Part – First Labeling

The first labeling part will initialize the graph. In a non-directed graph we have these statuses:

  • Vertices can be:
    • UNEXPLORED
    • VISITED
  • Edges can be:
    • UNEXPLORED
    • DISCOVERY
    • BACK

Second Part – True Labeling

In the second part we choose visited and discovery edges.

Direct Depth First Search (D-DFS)

In a direct graph

  • Vertices has two fields:
    • int discovery_label – a progessive number 0, 1, 2 … n (if zero vertex is UNEXPLORED)
    • int leaving_label – a progressive number 0, 1, 2, … n
  • Edges can be:
    • UNEXPLORED
    • DISCOVERY/TREE
    • BACK
    • FORWARD
    • CROSS

We also define two methods:

  • getNextLLabel – which generate the next leaving_label progessive number;
  • getNextDLabel -which generate the next discovery_label progessive number.

Strong connected di-graphs

A di-graph is connected if for every pair of vertices A and B we have an oriented path from A to B and from B to A.

Connection test algorithm

We can use the just explained D-DFS in order to understand if a graph is connected, we have to follow these steps:

  1. D-DFS on a graph G. After that we have every vertex and every label assigned, starting from whatever vertex;
  2. Check for UNEXPLORED vertex. If there’s even only one vertex labeled UNEXPLORED the graph isn’t connected;
  3. Transpose the graph to G’. Let’s invert every edge orientation to get a transposed graph;
  4. D-DFS on G’. Another labeling but now on the transposed graph;
  5. Check for UNEXPLORED vertices. As before, if we have no UNEXPLORED vertices the graph G’ is connected and at this point even G is connected.

Calculate the connected components algorithm

Suppose we have a not connected graph. If we try to execute the previous algorithm at the step 5. or 2. it ends telling us that the graph is not connected but.. we have a connected component ready! So could try another D-DFS but starting from an unexeplored vertex but how can we choose it?

We have to note somewhere (an array) the leaving order of the vertex because we will start from the last leaved vertext but unexplored!

Breadth-First-Search (BFS)

Let’s see the breadth-first-search that it’s useful if we have to calculate shortest paths or if we want to visit every discendet of a vertices before go on in the search.

Dijkstra’s shortest path algorithm

Let’s view now a simple example of a Dijkstra’s algorithm for finding the shortest path from a vertex.

Quickselect algorithm

Suppose we want to know the k-th element of the array, how we would do?

  1. We would sort the array, with O(nlogn) for example
  2. Then we will get the element searched

But there’s a faster method using a similar idea of QuickSort. Let’s view the QuickSelect algorithm in pseudocode applied to the problem of find the kth element of an array.Integer KthElement(Sequence S, Integer k)

The idea is:

  1. Choose a random position in the array
  2. Partition the sequence in three sub-set: L of the elements that are Less of the element chosen, G of elements that are Greater and E of elements that are Equal
  3. Then if the L set has just k – 1 elements, in the E set we have the kth element anche we can return it
  4. Else we have other 2 possibilities: L is greater than our k or less, in both cases we run recursively but we will enter only in one of this two ways because if the L set is smaller than k it makes no sense to search the kth element there, so let’s search only on the greater set (setting k passed as parameter opportunely) and vice versa
  5. Finally return the result of the recursive call

Note that this algorithm does not handle the case in which we have repetition in the array, as for example:

In this case the first step will do (chosen 12 for example)

If we want to search for the 8th element of the array the repetition of 2 and 4 in the L set will alter the result because the algorithm at the first step, because L is 7 elements big, will return 12 as the 8th element while if we ordered the array

there’s no 8th element!

Torrent slow or stuck? Try this tracker list 2016

Do you know that trackers are fundamental to index torrent and, as a consquence, of its download speed? Thay also can be decisive if you have a stuck torrent because it had only a few peers or seeds. However if your torrent has been indexed with one or more tracker that I attached to this post it probably will start to download.

How to: add trackers

Trackers obviously work with every client (e.g. Bittorrent, uTorrent and so on) just because they are indispensable to download the files attached to torrents, however the process that allows you to add tracker is very simple because it is very similar for each software.

  1. First, we have to localize the screen that shows torrent’s tracker (usually on the bottom). As every torrent has already some tracker we will a populated list.
  2. Now right click on one of this link and select “Add Tracker

    Una schermata illustrativa tratta da "Bittorrent"

    A screenshot from Bittorrent

  3. Now let’s copy and paste the tracker list atteched to this article in the text area appeared without replace the trackers that are already there and click Ok

Download tracker list zip:

Tracker List

I cannot guarantee that every tracker will work 🙁 but you can help me by commenting below with non-working trackers or with new trackers if you want! 🙂

[UPDATES]

  • 07/11/2013 – Added 36 trackers
  • 02/24/2014 – File revision
  • 08/18/2014 – Removed dead trackers
  • 02/12/2015 – Created zip file, added 5 tracker and removed broken trackers
  • 05/03/2016 – Completely new tracker list

 

Don’t you know what torrent are and how use them? Read this article!

Redirect 301 to change domain name

When you’ve finished  the domain trasfer of out web site as explained in the previous guide , you have to inform all the search engines of the change you made, and to create an automatic redirect from the old site to the new one. The aim that you certainly have is not to lose the Search Engine Optimization (SEO) you had obtained with the previous domain. The way that leads you to success is very easy: you have to create a redirect 301, a permanently moved that redirect the visitors who click on old links, but at the same time it inform the visitor of our site permanent tranfer. Afterwards with Filezilla (that was a matter of the previous guide), you have to visit the old site , search in the site root the file .htaccess and modify it clicking on “View/ Modify“.
The notepad will be launched, now all you have to do is copy and paste the code I have written below, being careful while replacing  “iltuodominio.it”  with your own domain:

[code language=”text”]
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.iltuodominio.it/$1 [R=301,L]
[/code]

Then you can close the notepad and save the changes. To check if your redirect works and gives back the code “301”, you can click here and write your old link. If you made no mistakes, this will be the result:

urltest-1-tuttodinternet

A screenshot from the free url-test program , made by tuttodinternet

Note:
If in the new link you want to remove, for example, “/blog/” , to have a redirect from:

www.iltuodominio.it/blog/post342 –> www.ilnuovodominio.it/post342

so you have to write:

 

[code language=”text”]
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^blog/(.*) http://www.iltuodominio.it/$1 [R=301,L]
[/code]

If, instead, you would like to add “/blog/” to the new domain, you have to write:

[code language=”text”]
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.iltuodominio.it/blog/$1 [R=301,L]
[/code]

 Translated by senzacca