Annoying a Reddit user

I’ve bought some digital goods on a suspicious subreddit. I forgot the old saying If it’s too good to be true, then it probably is. I ended up with a few dollars short, the seller stopped replying and completely ignored me. But that did not stop him from selling/scamming other people. At first, I wanted to forget about it and never repeat the same mistake again. But when I saw posts from other people, complaining that they were scammed, I quickly wrote a small python script. It’s far from pretty but it gets the job done.

Clone the script with git clone After an initial configuration, the script will keep an eye out on the scammer. After he posts a comment or starts a new thread, the script will comment on it. Use a VPS, a Raspberry Pi or your own computer – just put the script in cron and run it every 10 minutes or so.

That way, other users will be warned to avoid purchasing anything. I will never get my money back, but I might help others from repeating my mistake. It will also annoy the hell out of the scammer. He or she will probably register a new account sooner or later. Just update the script accordingly and you can resume harassing him.

Read the full description and how to –


How to stop new user registration spam

I’m currently in the process of finishing up an e-commerce website, which runs on WooCommerce. As soon as it went live, there were five new accounts registered in a couple of hours. Each of them with a suspicious email. Pretty sure none of them wanted to do any purchases.

After some digging, I was able to find out that these spammers visit the following url: If there’s no captcha and if registrations are allowed, they register a new account. By default, these accounts are assigned the Customer role. So they probably can’t cause any damage but still. It’s really annoying to get emails that a new person registered to the site and it’s a spammer.

The solution? There are lots of plugins that take care of this, but I wanted to solve this problem without any additional plugins (I’m using too many already!). The domain DNS is pointed to Cloudflare, which takes care of a lot of useful things. In Firewall, I created a new rule and assigned a name to it. For the first field, I selected Uri Full. I did not touch the operator field, by default it was set to equals. On Value, I pasted the whole URL – The most important part comes last – under Then, I selected Challenge(CAPTCHA). After saving the new rule, I tested it out. As soon as I visited the URL, I was presented with a nice CAPTCHA.

Ever since I set this rule, I had no new spam accounts!

Back to Ireland

We’ve just returned from our second trip to Ireland. Last year was great, but we felt that we missed so many things that we just had to return. The return trip was twice as long and just great! I can’t drive on the left, so my girlfriend drove me more than 3000 kilometers around the whole island.

This time, we’ve seen almost all the best attractions, ranging from scenery landscapes and castles to old cities. There were so many things to see and do, but I probably most enjoyed the Bogside history tours. Our guide Paul has been living in Derry his whole life and had seen the Troubles first hand. Sadly, his father was one of the people murdered in Bloody Sunday. He took us on a walk through Derry and explained the meanings of beautiful murals, pointed out where innocent protesters were shot and answered all our questions. Sad story but well worth hearing it told by Paul. A must do if you’re in Derry!

I’ve been in several museums, but Cobh Titanic Museum is a bit different. You get a ticket from a real passenger that boarded the Titanic. It displays the person’s name, class and other details. Then they take you on a tour and tell you lots of unknown facts. All the time you’re wondering – what happened to my passenger? Well, in the end, you can see for yourself. By typing in your passenger’s name, you see if this person was able to get out alive or not.

The nicest surprise was Smithwicks brewery in Kilkenny. I was not expecting such a nice guided tour and I did not think I’d fall for their beer. Their tour has a hologram of sorts, that explains how the brewery started. It’s first owner John Smithwick was not allowed to own a company, so he had to get help from an Englishman who officially owned the brewery. Several decades later the laws changed and his one of his descendants could finally officially own the brewery. I just hope I can get a hold of some Smithwicks Red here in Slovenia. Great stuff!

I skipped loads of other sights that we visited like Cork Gaol, Newgrange, Dublin Gaol and many many many others. You just have to go see for yourself!


Raspberry Pi backup – easy and efficient

Creating Raspberry Pi backups is extremely important, have you backed up your Raspberry Pi lately? No? Well, that are you waiting for! I admit, I have messed up my Raspbian system several times and had to start fresh. It was not a problem in the beginning because I was able to learn lots of new things. As time went on, my Pi had more and more features (security camera, web server, flight radar, Raspberry Pi Weather station, etc). It would take a really long time to set everything again. That’s why it’s really important to do regular backups.

Everyone recommends that you use Win32 disk manager. Don’t get me wrong, it is a great tool for making backups. Some time ago I had bought a new SD card, and tried to restore the image, created by Win32 disk manager. It did not work, because the SD cards were not exactly the same size, although both were marked as 32GB cards. I got a message “Not enough disk space”. The second disadvantage is the image size, which is exactly the same as the SD card.

paragon backup

The solution is: Paragon Backup and recovery free. The free version does exactly what is needed. With it you can create incremental versions of the SD card. The file size is greatly reduced, in my case from 32GB to 8GB! The best thing – this backup can be restored to any SD card. Once a month I power down my Pi and replace the SD card with an old backup. That way I get very little down time. Meanwhile, Paragon takes care of creating a new backup. The files for your Raspberry Pi backup are neatly arranged in a specified folder. After the original SD card is inserted into its place, I immediately restore the created backup to my second SD card.

Granted, the process has a few extra steps compared to Win32 disk manager. But the extra clicks are worth it, the process itself is so simple and straightforward that I’m not even going to write a detailed how-to with loads of screenshots. Install it and give it a go, you will never look back!

Visiting Ireland

I have just returned from Ireland after a nice 10 day long trip. We rented a car for 6 days and stayed the last few days in Dublin. The only thing I hated over there was the driving on the left. Luckily my girlfriend got used to driving on the other side of the road very quickly. She drove more than 1300 kilometres all over the upper half of the Ireland from Dublin, Dundalk, Belfast, Derry, Donegal, down to Sligo, Westport, Galway and Ennis before returning back to Dublin.

The most memorable sights were in Belfast and Derry, because of the political tension that is still present even today. To anyone visiting Belfast, I’d recommend booking a tour with the local Black Taxi Tours. They take tourist trough the Catholic and Protestant areas, showing the murals on the houses. The guide told us all the background stories about the men portrayed, about the life back then. He mentioned helicopters being airborne all the time, patrolling the city. After the peace treaty, the helicopters were put down and lots of people had trouble adjusting to life without their noise. The most surprising thing is the wall that is still being used today to separate two communities. As the guide said several times – the wall is used to keep the peace.

Another pleasant surprise was the Leap Castle (pronounced Lep Castle). It was featured on lots of ghost documentaries and is mentioned in the Lonely Planet book. Its current owner Sean Ryan accepted us to his own castle and told us several stories about it, while we sat at the fireplace. Because of its bloody history, there are certain spirits present at the castle. Almost every weekend spiritualists come to the castle with instruments, doing various experiments. Luckily we did not stumble upon any spirits, but I did feel a bit uneasy while walking on the dark stairway and standing at the top level named Bloody Chapel. To anyone interested – book a visit by calling Sean at +353 868 690 547. In the end he was kind enough to play us some Irish tunes on his fiddle.

The Moher cliffs are really a sight to behold. Especially if walking from the nearby city called Doolin. It’s a nice 8 kilometre trek to get there and you get to see so much more than by driving to the spot. To any fan of such sites, the Slieve league cliffs is also a must see. After climbing stone steps you get to see a magnificent view over the sea. Well worth the climb!

Disable LED lights on Raspberry Pi

Raspberry Pi provides two LED lights – a green and red one. If anything goes wrong you can identify most of the problems by their status – blinking, always turned on etc. My Pi is working perfectly, so I’ve decided to rid myself of these two bright lights. It might even lower the power consumption a little bit. Anyway, the process is really simple. Type in sudo crontab -e and start editing the cron. You need to paste in the following:

@reboot echo 0 >/sys/class/leds/led0/brightness
@reboot echo 0 >/sys/class/leds/led1/brightness


Save changes and reboot in order to try out the new additions. These two commands are run after the Pi boots up, after each restart. The names led0 and led1 are the green and red LED. They still blink during boot, but power off completely when the system is up and running.

Developer console scraping, part two

I wrote a post about scraping Google’s Developer Console a year ago. A site visitor told me about his problems with this solution so I decided to help him out with a different option – a simple python script. It requires less prerequesites to be installed – only mechanize (sudo easy_install mechanize or sudo pip install mechanize).

In case you did not notice, when you log in to the Developer console, you can click on the Reports option and then statistics. There you have to write the name of your application and you will be presenteed with the statistics in zip files. I’m only interested in number of downloads and how many people actually use my application. Right click on Latest monthy install report and copy its url, we will be needing it shortly. For example, in my case the url would look something similar to

As you can see from the url, it contains a time period. The zip file also contains several csv files, that display daily statistics. I’ve made a simple script that downloads current months statistics in a zip file, extracts it and outputs the very last entry. That way I get the number of downloads and how many people have my app installed on their device. The script is available over here.

Before running it, you will need to do a few things first though. As stated before, install mechanize first. Get a hold of your dev_acc – it should be in the url you copied before. Take a look at the line that starts with (should be number 22). Replace my dev_acc id with yours. Also replace the example package name with your application package name. Definitively replace the email and password with an account that has access to the developer console. I’m using /home/peter/production/scrape/ folder to hold  the downloaded zip and csv files. Change that according to your needs.

Now you can give it a go! The script first opens the url to the zip file that contains all of the statistics for the current month. It cannot, because it’s not authorised – it then logs in to the Developer console. In a moment the zip file is saved to the path you want. The file that ends with overview.csv is opened, because it’s the only one that contains the neeeded statistics. With the help of tail and cut, the needed information is parsed out. Then you can do what you want with it.

Sardinia in May

I have just returned from a nice little vacation from Sardinia. The tourist season does not start until June, so the timing was great. There were almost no people, no crowds at sights and the parking meters were also not yet installed. It was pretty windy though for a few days, otherwise the weather was great.

We stayed for a week, travelling around the top half of the island, visiting major and less known sights. Thanks to my personal travel guide and her copy of Lonely planet book, we had no problems navigating and deciding on which places to see. In some aspects, Sardinia is similar to Slovenia. In an hour or two, you can go from a nice beach to a pretty high mountain or a canyon. Lots of options for different people – biking, hiking, swimming, kiting or laying about on beaches.

We stayed at several hotels/hostels. All of them were booked via, which is a really good site for finding places to stay. One of our hosts gave us a nice tip for saving money when booking places. The site takes around 15% provision, so the prices are a bit higher than usually. The site displays all possible contacts, so if you contact the providers directly you can avoid and save some money.

A few pictures are available on my Google+ album.



Cmder in TotalCommander

My co-worker recently stumbled upon Cmder. It’s a replacement for the default command prompt in Windows. Cmder itself is based on ConEmu, but has some extra features and is much better looking. One of the integrated tools is git, tail, grep, etc. It has other things as well, but this is one tools that I used most.


I have been trying to integrate it with TotalCommander in order to completely replace the default cmd. I was successful to a certain point. By following the next steps, you will add a button to TotalCommander. When pressed, it opens a new window of Cmder with the current path. Its okay, but I still need to figure out how to do the same by typing cmd in command line.

Download Cmder, extract it somewhere and put its path to the environmental variables. That way you can run Cmder from anywhere (make sure it works before continuing). In Cmder folder, find the map vendor and edit init.bat. Scroll down to the end and paste cd “%p%” > nul. This command tells cmder to cd to the directory saved in the %p% argument. All output is sent to nul.

On top of TotalCommander (below Start) right click and select Change. Click add and add %p to the parameters field. For command type in cmder. If you want, you can also add Cmder icon by clicking on >> next to icon field. Navigate to Cmder folder and click on exe file. That’s it, you are done. Test by clicking the newly created icon and see where it takes you.

Developer console scraping

Google Play has a nice Developer console, which displays various information ranging from download stats to crash reports. It provides a great insight how the app is used. I wanted to automate getting the most important information from the apps I have published. I’m mostly interested in download stats and ratings. Tried several tools and even tried to make a simple python script. Because the site uses lots of javascript, there was no luck in creating my own solution. After some googling, I did stumble upon Google Dev scraper. It has been running on my Raspberry Pi for almost 4 months and it is truly working great!


It needs some prerequisites such as Ruby and RubyGems. After these two are installed, clone the latest version from github. Because I want to get these information on a daily basis I’m using a cronjob that runs a bash script. Upon completion it creates a php file that displays the results in a simple manner. To start using the scraper, you need to get your developer Id. Visit the console and copy the numers after “dev_acc=”. Afterwards you need to get the package name for the stats that you want to get. You need to limit the search for the stats, get the publish date and latest displayed date in the statistics displayed in the console. When you have all of this information, issue the following command googleplay_dev_scraper -u [email protected] -p yourPassword -a yourDeveloperID 20130227 20140106 > (replace the last two numbers with the starting and ending date in the same format!).

If you replaced all the data with your own login information, package name and correct dates, you should end up with a zip file. It contains lots and lots of statistics in csv format. Now it’s all upon you to decide which information you need and automate it with a bash script.  In general, my script does the following. Everyday at noon the starting command is issued to get statistics in a zip file. This file is then unpacked and removed.  Then the app.package.name_overall_installs.csv is read for the latest download number and ratings. Afterwards you can simply email them or display them in your website. Truly an amazing tool!

Page 1 of 3 123