Setup Golang on Fedora 24 (and other Linux distributions)

This guide will be how I usually setup and get started with Go development environment on Linux. By the end of this document, we will have seen how to:

  • Install the Go compiler and other tools (gofmt, for eaxmple), collectively referred to as go tools
  • Setup Go workspace
  • Working with ...
more ...

Presentation slides with Jupyter Notebook

I presented at the PyCon 2016 Education Summit on "Doing Math with Python" day before yesterday and a lightning talk yesterday. This is the first time, I prepared a slide deck using Jupyter Notebook + Reveal.js. I was pleased with the content creation process and the end result. So, here ...

more ...


runC and libcontainer on Fedora 23/24

In this post, I will post my notes on how I got runC and then using libcontainer on Fedora. The first step is to install golang:

$ sudo dnf -y install golang
$ go version
go version go1.6 linux/amd64

We will set GOPATH=~/golang/ and then do the following:

$ mkdir ...
more ...



Did your Fedora live cd build fail?

Update: Changed the Koji URL to reflect the change to livemedia

As the Fedora Scientific maintainer, I have to make sure I look into whether the nightly build is failing so that I can look into the why. So far I have been doing that by going to the koji ...

more ...

Replacing boto S3 mocks using moto in Python

Let's say you have some Python application code which connects to Amazon S3 which retrieves the keys in a bucket. Very likely, the application would be using boto and the code would like this:

import boto

def get_s3_conn():
    return boto.connect_s3('<aws-access-key', '<aws-secret-key>')

def list_keys():
    s3_conn = get_s3_conn()
    b = s3_conn ...
more ...

tempfile.NamedTemporaryFile() in Python

In Python, when you need to create a temporary file with a filename associated to it on disk, NamedTemporaryFile function in the tempfile module is the goto function. Here are some use cases that I think one might use it for.

Case #1: You simply need a named empty temporary ...

more ...

Mock objects and non-existent attributes/methods in Python

Updated: Fixed typo in the last paragraph.

Today, I was curious to see this behavior of Mock() objects when using mock:

>>> from mock import Mock
>>> m = Mock()
>>> m.i_dont_exist
<Mock name='mock.i_dont_exist' id='139841609578768'>
>>> m.i_dont_exist()
<Mock name='mock.i_dont_exist()' id='139841609106896'>

The above is expected, since I have ...

more ...