Daniel 'MaTachi' Jonsson

Category Archives: Internet

Cloaked Chatter – Bot that automatically posts links to tech news on /r/technology

One week ago I wrote a bot that automatically posts links to tech news on Reddit’s subreddit /r/technology. The bot is written in Python and is called Cloaked Chatter. The code is licensed under the FOSS license Mozilla Public License 2.0 and the source code is available on Github at:

As a back-end I use TechHeat which lists the most popular tech news in social media.

I only ran the bot for a few days, but it is fairly successful at grabbing and posting links. On the following screenshot from the other day you can see it snatching place 1, 9, 13, 14 and 20 of the most popular news in /r/technology:

reddit_technology

The link “NASA trailer reaches crowdfunding goal, will be shown before ‘Star Trek: Into Darkness’” got the following incredible stats:

3,418 points (55% like it), 16,825 up votes, 13,407 down votes

On this screenshot you can see it on place #2 on /r/all:

reddit_all

I don’t know if it ever reached #1, but my account was awarded with the trophy “Best link”:

reddit_user

The problem is that the my account KanemotoYokose seems to have been blocked since then. I can still login on it, but new posts won’t appear any longer under the ‘new’ tab in /r/technology for other people. Neither can other people see my account page, instead it says “page not found, the page you requested does not exist”.

I may have gotten my account blocked since I had one cronjob set to run the script once every hour, and one to run it once every second hour. So basically I were posting 36 links a day. I can see how this could be interpreted as a little spammy, but I never intended to write a spam bot. My goal was to write a bot that would post good links that people would upvote.

Anyway, the code is open source, it was a fun and educative experiment, and I got to write and learn some more Python.

Got my first bitcents

I have known about Bitcoin for about two years. But the recent growth made me want to try it out, play a bit with it and see how it works. It’s a really fascinating currency which is revolutionizing payment.

To purchase my bitcents I used the Swedish Bitcoin trading site Kapiton. I transferred 60 SEK (~9 USD), which took about a day until it showed up on my Kapiton account. I got 0.05869422 BTC for that which I then transferred to my own maintained wallet.

There is a really cool website called blockchain.info where it’s possible to see all transactions made in the Bitcoin network. Here is a link to my public address where the transfer is visible:

I have spent a lot of time reading questions and answers on Stack Exchange’s Q&A site dedicated to Bitcoins, and there is really a lot of interesting technical details to learn about. I highly recommend checking out that site.

For Reddit users there is an active Bitcoin subreddit which is pretty fun to read.

I also stumbled upon a cool site where it’s possible to see the Bitcoin exchange rate in real-time:

In my opinion Bitcoins aren’t very useful today since not many sites take them. But it feels like it could be Internet’s equivalent to cash, because it makes it really easy for private persons, artists and smaller developers etc. to accept payment, instead of fiddling with Paypal and such solutions. With Bitcoins you can transfer money to anybody across the whole globe in about only 10 minutes for a really small transaction fee. That’s incredible, so I hope it takes off.

Can’t Specify Root Folder on Your Shared Web Host?

If you are using the PHP framework Zend, you have to set /public as the root folder. And if you are using Symfony, it’s instead /web. But if you can’t set which folder that will act as the site’s root folder, add these files to the site’s root folder:

.htaccess

RewriteEngine On
RewriteRule .* index.php

index.php

Symfony:

<?php require_once 'web/app.php';

Zend:

<?php require_once 'public/index.php';

Now you will be able to use yoursite.com instead of yoursite.com/web/app.php or yoursite.com/public.

Fix Symfony asset paths

If images, CSS and JS aren’t displayed with Symfony2, add this to your /app/config/config.yml file:

framework:
    #..
    templating:
        engines: ['twig']
        assets_base_urls: /web/

How to Set Up a Virtual Host on Ubuntu

Add a new site:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/mysite.local

Then configure the site to fit your needs:

sudo vim /etc/apache2/sites-available/mysite.local

Don’t forget to add this line to the VirtualHost element:

ServerName mysite.local

Enable the site:

sudo a2ensite mysite.local

Reload Apache:

sudo service apache2 reload

Update your hosts file:

sudo vim /etc/hosts

Add the following line to the file:

127.0.0.1 mysite.local

Open a browser and visit mysite.local. Make sure that you don’t precede the URL with www..

If the browser doesn’t show what you are expecting, start with checking Apache’s error log:

cat /var/log/apache2/error.log | tail

Podcasts I Listen To

I thought I should list podcasts that I’m following and listen to.

English podcasts

  • Linux Action Show: Weekly video show about Linux from Jupiter Broadcasting. Chris Fisher and Bryan Lunduke were for long the hosts for this show, but nowadays do Chris host it along with Matt Hartley. One of my favorite podcasts.
  • TechSNAP: Another podcast from Jupiter Broadcasting, with Chris Fisher and Alan Jude. This is about computer and Internet security for tech interested people and sysadmins.
  • TuxRadar: Podcast from the people who are doing the magazine Linux Format. Another really great Linux podcast.
  • Ubuntu UK Podcast: Podcast from the Ubuntu UK LoCo team.
  • Pure Decking: From Galaxy 15 Radio that covers technology, Internet and privacy news. Not very serious but nonetheless very entertaining.
  • Shoot The Noise: Also from Galaxy 15. This is very, very non-serious but also entertaining. Dunno really what its overall topic is, but the typically make fun of and rant on technology related news.
  • mintCast: “The podcast by the Linux Mint community for all users of Linux.”. I haven’t used Linux Mint for over a year, but they talk about a lot more than only Mint related stuff. Sometimes they cover topics like audio on Linux, how rolling distros work etc.
  • Off The Hook: Radio show that is aired in New York City every week and later put online on their website. Most often they talk about security, privacy and Internet news.
  • Stuff You Should Know: Podcast about how different stuff works and such from HowStuffWorks. Every episode has its own topic that they explain and talk about. I’m not following this very heavily, but I listen when they cover anything of interest.
  • TechStuff: Another podcast from HowStuffWorks. However, this one covers only tech related topics. Not following this very heavily either.
  • Hanselminutes: The episodes are very often about Windows related topics, which don’t really interest me. But once in a while there are other episodes, like this one where Jono Bacon is interviewed about his book The Art Of Community.
  • Giant Bombcast: Gaming podcast. The episodes are regularly about 3 hours long and they hosts are pretty slow/derail a lot, so I do only listen to it when I have a lot of silent time and nothing more interesting to listen to.
  • Blender Podcast: I’m not a Blender user, but I find this one pretty interesting. They often interview Blender people who have worked on Elephants Dream, Big Buck Bunny, Sintel and/or other open video projects. Occasionally they also talk with Blender developers.

Swedish podcasts

  • Slashat: Podcast that covers the last 7 days of tech news. Most often are the picked news items about Google, Facebook, Microsoft, Apple etc.
  • Cocktailpartyeffekten: This doesn’t come out very regularly and the hosts have told themselves that they don’t want to reveal what the podcast is all about. But they are most often speculating and philosophizing about games.
  • Overkligt: A newly started podcast about unreal stuff, such as games, TV series and movies. The hosts are the well-known people Victor Leijonhufvud, Christer Engström and Johan Hallstan.
  • Tack För Kaffet: Comedy podcast. Three dudes who do their best to entertain and talk a lot of trash. It’s often very hard not burst out laughing.
  • Obiter Dictum: This one covers popular culture.
  • Skillpod: Skillpoint is a small Swedish gaming site, and they put out a variety of podcast episodes about the site, indie games and such.

How to Set Up Egit with Github in Eclipse

When I the other day tried to set up Egit in Eclipse Indigo with Github I had major problems with guides not working. Two of the tutorials I tried where:

I got many errors and such… :/

But I found a really good post describing how to set it up in a current version of Eclipse:

2. In eclipse, configure the remote push
a. Window > Show View > Git > Git Repositories will add a repository explorer window.
b. In the repository window, select the repository and expand and right-click Remotes and choose Create Remote.
c. Copy the github repository URI from the github repository page and paste this in the URI box.
d. Select ssh as the protocol but then go back to the URI box and add “git+” at the beginning so it looks like this: git+ssh://git@github.com/UserName/ProjectName.git
e. In the Repository Path box, remove the leading slash
f. Hit next and cross your fingers. If your get “auth fail” restart eclipse and try step 5 again.
g. When you get past the authentication, in the next dialog select “master” for source ref, click “Add all branches spec” and “Finish”.

Now try a push to github. This worked for me but with all the fiddling around I’m not sure these instructions are perfect….

Link to the post: http://www.eclipse.org/forums/index.php/mv/msg/200890/648905/#msg_648905

Guide to Make Your Computer Automatically Start and Download Torrents on Linux

Today I managed to install and configure software to make my computer automatically start and download torrents. So now my computer will by itself download episodes from series I have specified as soon as they are released. What you basically need (for my solution) is the torrent client Deluge, the application FlexGet and a RSS feed where the torrents are indexed.

Hereunder follow descriptions of what you have to do to get this working (on Arch Linux with Gnome, but most of the steps should work on any distribution. However some commands may differ and such).

Deluge

  1. First, download Deluge from your Linux distribution’s repository, if you don’t already have it installed. On Arch Linux, type the following in the terminal: sudo pacman -Sy deluge
  2. Open the Preferences window under the Edit menu in Deluge. Then navigate to the Interface tab and make sure that Classic Mode isn’t enabled, which I think it’s by default. You have to disable Classic Mode to be able to run the Deluge daemon, which is Deluge without the GUI, in the background.
  3. Next time you start Deluge (I think) it will ask you to start the daemon to make Deluge able to run. Under Edit > Connection Manager in Deluge you can reopen this window.
  4. Then you have to reopen the Preferences window, and under the Downloads tab choose where the torrents (the downloaded content) should be downloaded to.
  5. You can also start the daemon by typing deluged in the terminal. More information about the daemon can be found here: http://dev.deluge-torrent.org/wiki/Faq#Daemon. To see if it’s running, type ps -A | grep deluged in the terminal.

FlexGet

  1. Download and install FlexGet. There are installation instructions in their Wiki: http://flexget.com/wiki. However, if you are on Arch and have a wrapper for pacman and the AUR installed, like Yaourt, type the following in the terminal: yaourt -Sy flexget. (On Arch you probably will need to do some button smashing to install all dependences, since many of them can be found in the AUR too.)
  2. When you have installed FlexGet, create the folder .flexget in your home folder and in it create a file called config.yml. Now you should read a bit on FlexGet’s wiki to learn how you should construct the config file. Especially read the Configuration page. Here is how (a part of) my config file looks like:
    feeds:
      tokyotosho:
        rss: http://www.tokyotosho.info/rss.php?filter=1&entries=450
        series:
          - Fate/Zero
        deluge: yes

    Note the last line: deluge: yes. It’s necessary for making Deluge start the torrents. Also note that you have to specify a RSS-feed where FlexGet should look for new torrents to download.

  3. Now FlexGet should be able to check the RSS feed(s), find the series/content you want to download and make Deluge download them. To test run FlexGet, run flexget –test in the terminal. Of course you can run flexget –help to find more possible commands. But to do a regular check in the RSS feeds, download, and all that stuff, just run flexget. Note that you don’t have to be running Deluge to download the torrents, only deluged is needed.

Start deluged with Gnome

  1. Open a terminal and run gnome-session-properties if you are on Gnome. In the window that pops up you should add an additional startup program – in this case deluged. Just type that in both the Name field and the Command field. If you are using another desktop environment you sadly have to figure out this step by yourself (Google).

Make FlexGet run once every hour automatically

FlexGet only checks the RSS feeds when you run flexget in the terminal. So what we want to do is to schedule the computer to run it once every hour.

  1. Start with adding the following two lines to the .bashrc file in your home folder:
    EDITOR=nano
    export EDITOR

    This will make the next terminal application use the text editor nano instead of whatever alien editor it uses by default. :)

  2. Close all terminal windows and open a new one to apply the change.
  3. Run crontab -e in the terminal.
  4. Add 0 * * * * flexget to the file, and then save and close it with Ctrl + Shift + X. You can find more schedule options here: https://wiki.archlinux.org/index.php/Crontab. Please don’t make it run once every minute or something crazy like that, since that would use a lot of the server’s bandwidth where your RSS feed is hosted.
  5. To see everything you have scheduled, type crontab -l.

Done!

Now your computer should be able to automatically download torrents for you. I hope you found this guide helpful. If you have any wonders or problems, please leave a comment below, and maybe I can help you get it sorted out.

How to Try the New YouTube Interface Cosmic Panda

Yesterday at school I heard from a classmate that there is a new Youtube interface called Cosmic Panda which you are able to try out.

To activate it, you have to visit the following page:

As I’m writing this, I have only watched a single video with this interface. But it looked pretty slick on that video. ;) The profile pages have also been updated.

Check it out if you are interested. You can always deactivate it by visiting the page and pressing a button.

I also saw that they have a page dedicated to testing stuff:

How to Search Encrypted on Google

Google has a pretty clumsy URL for searching with SSL, like Wikipedia. However, the encrypted version of Google Search is currently only in beta, so it may be the reason behind it. Anyway, here is the URL to it:

To change to your country’s version, replace the last two letters en to something more fitting. In my case sv since I’m from Sweden.

With the Firefox add-on Add to Search Bar you should be able to add an entry for this version to your search bar. And as with all other search fields in Firefox, it’s possible to add a keyword for the search field by right clicking the field and pressing “Add a Keyword for this Search…”.

However, if you care about your privacy, don’t forget to check out DuckDuckGo. Click here to read my short introduction to the search engine.

How to Browse Facebook Encrypted

As far as I know will only the Account Settings page on Facebook encrypt your connection if you haven’t changed the default settings. Not even the login page seems to connect over SSL by default, which seems a bit strange for such a large site. Maybe they don’t really care about the users’ security.

However, on the Account Settings page there is an option below Account security that asks you if you want to browse Facebook on a secure connection. I can’t see a reason to not use it, so I advise you to go in there and update your account. :) I have done it myself on all my accounts, and I haven’t experienced any problems.

The flaw with this is that you have to be logged in to make Facebook realise that you want to use an encrypted connection. Therefore doesn’t the login page use SSL by default, so you have to manually add an s to http in the URL.

By using https will you be protected from applications like FireSheep, even if you are on a unencrypted network. And you will also protect your data from being read by others on the way between you and the server.