Card image cap

Validate that only one of many parameters was provided in Python

Sometimes, a function or class constructor can take many possible parameters, but only one parameter can have a value at any one time, excluding all others. One way to validate this is included in the Python standard library. Copying from the module:

class UUID:
    def __init__(self, hex=None, bytes=None, bytes_le=None, fields=None,
                       int=None, version=None,
                       *, is_safe=SafeUUID.unknown):
        if [hex, bytes, bytes_le, fields, int].count(None) != 4:
            raise TypeError('one of the hex, bytes, bytes_le, fields, '
                            'or int arguments must be given')

The idea here is that since all five mutually exclusive parameters hex, bytes, bytes_le, fields and int have a default value of None, when one of them is specified during instatiation, there will then be four parameters left with value None.

Image credit: Wicklow Mountains, by Marcus Tan. In the Public Domain. Source.

Card image cap

Apache host configuration for a Django website

This is the Apache virtual host configuration for an older project that I don't use any more.

Read More →
Card image cap

Mount an NTFS disk in Ubuntu

On a system that dual boots Windows and Ubuntu, I use this line in /etc/fstab to have the NTFS Windows disk mounted permanently in Ubuntu:

/dev/disk/by-uuid/1EBB57A121AFC448 /mnt/1TB auto nosuid,nodev,nofail,x-gvfs-show,uid=marios,gid=marios,permissions,dmask=022,fmask=133 0 0

Here's a list of options used in that line:

  • nosuid: this is a security enhancement, preventing execution of files under the files' owner's permissios, from users other than the owner
  • nodev: this prevents the mounted filesystem from containing device files
  • nofail: prevents error reports when the device is missing, but can mask failures
  • x-gvfs-show: makes the device visible in the user interface, in the file explorer
  • uid=marios and gid=marios: assign user and group ownership of new files to a specific user
  • dmask=022 and fmask=133: default permissions for newly created files and directories

Image credit: Library At Trinity College. In the Public Domain. Source.

Card image cap

My .vimrc

This is my pretty basic ~/.virmc. Lines starting with a double quotation mark are comments:

" Make text pop out on dark backgrounds:
set bg=dark

" Always display line numbers:
set number

" TAB width is 4:
set tabstop=4
" ...and so is an INDENT:
set shiftwidth=4
" Make TAB insert an INDENT at the beginning of a line:
set smarttab
" TAB is 4 SPACES instead of one \t:
set expandtab
set modeline

Image credit: Wild Grazing - Sheep grazing on the southwest coast of Ireland. In the Public Domain. Source.

Card image cap

A small web application with Angular5 and Django

Django works well as the back-end of an application that uses Angular5 in the front-end. In my attempt to learn Angular5 well enough to build a small proof-of-concept application, I couldn't find a simple working example of a combination of the two frameworks, so I created one. I called this the Pizza Maker. It's available on GitHub, and its documentation is in the README.

If you have any feedback for this, please open an issue on GitHub.


Dashboard Templates

This is a list of free (an in beer) Dashboard or Admin templates build on Bootstrap4. Some are released under well-known open source licenses (mostly MIT), and some have other restrictions, however all are gratis. These links tend to break over time, but often there are mirrors of the themes elsewhere, at least for the open source ones.

Read More →


Getting Started with Typescript

A series of videos from on getting started with TypeScript.

  1. Welcome
  2. Install Node.js
  3. Configure TypeScript
  4. Classes - Part 1
  5. Classes - Part 2
  6. Getting Started with Typescript - Declaring Variables - let vs var
  7. Getting Started with Typescript - Run & Compile with Webpack
  8. Getting Started with Typescript - TypeScript - Classes - Part 3
  9. PackageJSON - npm init
  10. jQuery, Typings, & npm
  11. Thank you

Try Angular 4

A good series of videos from guiding through the creation of a complete application in Angular 4:

  1. Welcome (2:40)
  2. Getting Started (5:53)
  3. App Module & Component (8:13)
  4. Ng Generate New Component (5:46)
  5. Selectors & Components (2:08)
  6. ngFor and ngIf (7:57)
  7. Mapping Urls with RouterModule (9:17)
  8. Dynamic Routing of Components (7:38)
  9. Safely Embed a Video (8:38)
  10. Pipes & Custom Pipes (9:11)
  11. Rapid Bootstrap 3 Overview (15:14)
  12. Bootstrap for Angular // ngx bootstrap (11:39)
  13. ngx bootstrap carousel (11:56)
  14. Angular Click Events (14:17)
  15. Http Requests (17:02)
  16. Http & Featured (6:22)
  17. Two Way Data Binding (4:22)
  18. ngForm Basics (7:55)
  19. Search Detail (12:09)
  20. Passing Data to Components (12:08)
  21. Video Service (16:47)
  22. Search Video List (8:01)
  23. Video Item Model (7:19)
  24. Router Link & Improved Navigation (4:16)
  25. Improve Styling (11:06)
  26. ngClass (6:49)
  27. ngBuild and Deploy to Heroku (22:16)
  28. Thank You and Next Steps (1:43)

These instructions should get this up and running on Ubuntu:

git clone
cd Try-Angular-v4
npm install
ng serve

Et Cetera

Upload file to S3 Bucket with the AWS CLI

The simplest form of using the AWS CLI to upload a file to an S3 bucket is:

aws s3 cp test.txt s3://bucket-name

A neat trick is that you can pipe the output of a shell command to a file on S3, for example:

find . | aws s3 cp - s3://bucket-name/test.txt


To be able to upload files, you need an IAM role that has at least the following policy:

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "AllowUploadFileToS3Bucket",
            "Effect": "Allow",
            "Action": [
            "Resource": [

Upload file to S3 Bucket using Boto3

How to upload files to S3 using Boto3, either with the high-level s3 resource or the low-level s3 client.

Read More →

Create S3 Bucket with the AWS CLI

The simplest form of using the AWS CLI to create an S3 bucket is:

aws s3 mb s3://bucket-name

You can optionally specify the region:

aws s3 mb s3://bucket-name --region eu-west-1

If you don't specify the region, the default is us-east-1 (N. Virginia).


To be able to create buckets, you need an IAM role that has at least the following policy:

    "Version": "2012-10-17",
    "Statement": [
            "Sid": "AllowCreateS3Bucket",
            "Effect": "Allow",
            "Action": [
            "Resource": [

Hello, I'm Marios Zindilis and this is my website. Opinions are my own. You also find me on LinkedIn and GitHub.

Unless otherwise specified, content is licensed under CC0.