What is the point of using NGINX in front of a Django application

Recently, a friend of mine asked me to tell him more about the rationale behind using NGINX with a Django app and how these two work together. It actually makes perfect sense for someone to raise this question: Python has a builtin web server which can render pages, serve static files on its own. So what’s the point of adding one more component to the stack?

PHP Land

When I started to learn programming, my first language was PHP. The only program I needed to run PHP scripts was Apache. My understanding back then was that Apache can serve static…

Configuring a headless Raspberry Pi

Recently, I got my hands on a brand new Raspberry Pi and was asked to make it usable. I didn’t have an HDMI monitor or keyboard, so I decided to configure it as a headless station. I don’t have an Ethernet cable at home but I have a Wi-Fi router. So, the task was to prepare the Raspberry Pi with MacBook Pro (with card reader), Micro USB cable and 4GB SD card. I picked Raspbian as an OS. There are images available for download on the official site. I used Raspbian Jessie Lite, because the full version wouldn’t…

Creating a test environment for Ansible

I’ve been working with Ansible for the last several days. I’ve been testing my Ansible scripts on DigitalOcean. First, I’d create a fresh $5 droplet, run my script a couple of time against this server and soon after the tests were finished, I’d destroy the droplet. But it wouldn’t end with that, I’d often want to make a quick change in the script and test this change, but the environment is already different and I can’t be sure that my script will work the same on the fresh environment, so I would go and create another droplet and repeat the…

Building a simple Scrapy parser

While building my Telegram bot, I was in need to scrap the data from a local website. The last time I scrapped something was metrolyrics.com website. My goal was to build a local database with lyrics — I built that using Ruby. Since, I work mainly with Python nowadays, I decided to give a try to Scrapy. Scrapy is a popular Python framework to build crawlers, parsers and scrapers. Scrapy has several main entities that we’re going to use. I’m going to talk about them in detail now.

Request & Response

Those classes are central to the…

Telegram Bot

I’ve decided to give a try to a Telegram Bot Platform. Initially, I tried to build the bot for a Facebook Messenger, but it turned out that I have to pass a review (for example you must have a logo) before my bot can go public. I had no time and resources to spend on this review process so I decided to stick with Telegram for now, which has a pretty straightforward procedure. In order to create a bot in Telegram you have to chat to another bot. Type /newbot and enter the name of your bot. Then…

Upwork — a freelancer’s paradise

I’ve been working via Upwork since it was oDesk. I started around 2012 and have been an active user since. It wasn’t perfect then — it was ok. Their pricing policy was pretty transparent — 10% of all your earnings and that’s it. oDesk had 2 types of contracts: hourly and fixed-price. Back then oDesk didn’t provide any escrow services for fixed price contracts but still would charge 10%. Recently, this has been changed — now you have escrow for both hourly and fixed-price contracts, which is nice. Now, aside from escrow what else does Upwork provide you with for…

Python — programming is fun again

After many years of programming in PHP, Ruby and Javascript, writing Python code feels like a breath of a fresh air — simple and intuitive interfaces, balance between safety and flexibility, wide range of rock-solid libraries, written in the same manner. Previously, if I needed to create a web application, I picked Ruby on Rails without a second thought, because I’ve been working with it for over 3 years and I can ship stuff quickly with it. But yesterday, I decided to quickly hack a web app using Flask instead. My first thought was — “programming is fun again” (I…

Securing Ubuntu Instance

So, you’ve just launched your brand-new instance and thinking about what to do next. Cool. So, as you probably heard, it is not a good idea to do your tasks using root user account, that’s why we will create a new one. We want this user to have root privileges, but only occasionally, that’s why we will add our new user to sudo group. sudo is a program which allows users to run commands as if they were superusers, asking for a password every time (every 15 minutes) and logging the commands you’ve entered (usually in /var/log/auth.log). In order…