Archive

Author Archive

MkDocs – Project documentation with Markdown.

November 2, 2017 Leave a comment

MkDocs is a fast, simple and downright gorgeous static site generator that’s geared towards building project documentation. Documentation source files are written in Markdown, and configured with a single YAML configuration file.

http://www.mkdocs.org/

Advertisements
Categories: Interesting

Semantic Versioning 2.0.0

October 30, 2017 Leave a comment

Summary

Given a version number MAJOR.MINOR.PATCH, increment the:

MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.

Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.

http://semver.org/

Categories: Interesting

Building and Packaging a Python command-line tool for Debian

October 27, 2017 Leave a comment

Python packaging has a chequered past.

Distutils was and still is the original tool included with the standard library. But then setuptools was created to overcome the limitations of distutils, gained wide adoption, subsequently stagnated, and a fork called distribute was created to address some of the issues. Distutils2 was an attempt to take the best of previous tools to support Python 3, but it failed. Then distribute grew to support Python 3, was merged back in to setuptools, and everything else became moot!

Unfortunately, it’s hard to find reliable information on python packaging, because many articles you might find in a Duckduckgo search were created before setuptools was reinvigorated. Many reflect practices that are sub-optimal today, and I would disregard anything written before the distribute merge, which happened in March 2013.

While which packaging tool to use was ambiguous in the past, it’s now much easier to recommend one. At the time of writing (September 2016), you should use setuptools. It’s what most packages use, is fully supported by pypi and pip, and works pretty well. For a summary of the subject of python packaging tools, this page summarises them all very well. For an authoritative reference, see packaging.python.org.

https://blog.al4.co.nz/2016/09/building-packaging-python-command-line-tool-debian/

Categories: debian, Interesting, python

find command examples

October 24, 2017 Leave a comment

Problem:
I needed to clean up after running tests

Solution:
Using find

$ tree
.
├── bin
│   └── hello
├── hello
│   ├── hello.py
│   └── __init__.py
├── requirements.txt
├── setup.py
└── tests
    ├── __init__.py
    └── test_hello.py

3 directories, 7 files
$ python3 setup.py test                                            
running test
running egg_info
creating hello.egg-info
writing dependency_links to hello.egg-info/dependency_links.txt
writing top-level names to hello.egg-info/top_level.txt
writing hello.egg-info/PKG-INFO
writing manifest file 'hello.egg-info/SOURCES.txt'
reading manifest file 'hello.egg-info/SOURCES.txt'
writing manifest file 'hello.egg-info/SOURCES.txt'
running build_ext
test_print_hello (tests.test_hello.TestHello) ... ok

----------------------------------------------------------------------
Ran 1 test in 0.014s

OK

Now more files are created.

$ tree
.
├── bin
│   └── hello
├── hello
│   ├── hello.py
│   ├── __init__.py
│   └── __pycache__
│       ├── hello.cpython-35.pyc
│       └── __init__.cpython-35.pyc
├── hello.egg-info
│   ├── dependency_links.txt
│   ├── PKG-INFO
│   ├── SOURCES.txt
│   └── top_level.txt
├── requirements.txt
├── setup.py
└── tests
    ├── __init__.py
    ├── __pycache__
    │   ├── __init__.cpython-35.pyc
    │   └── test_hello.cpython-35.pyc
    └── test_hello.py

6 directories, 15 files

To delete the *.pyc files and the __pycache__ and hello.egg-info folders, run the following commands.

$ find . -type d -name "hello.egg-info" | xargs rm -rf
$ find . -type d -name "__pycache__" | xargs rm -rf
$ find . -name "*.pyc" | xargs rm -f

Note:

$ find --version                                                   
find (GNU findutils) 4.7.0-git
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by Eric B. Decker, James Youngman, and Kevin Dalley.
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION FTS(FTS_CWDFD) CBO(level=2) 

Source:
https://superuser.com/questions/736272/using-unixs-find-command-to-find-directories-matching-name-but-not-subdirectori#736275

Categories: bash Tags: ,

vagrant-hostmanager

October 13, 2017 Leave a comment

vagrant-hostmanager is a Vagrant plugin that manages the hosts file on guest machines (and optionally the host). Its goal is to enable resolution of multi-machine environments deployed with a cloud provider where IP addresses are not known in advance.

https://github.com/devopsgroup-io/vagrant-hostmanager

Categories: Interesting

Getting vagrants ubuntu user password (ubuntu/xenial64)

October 13, 2017 Leave a comment

Problem:
Needed to have the ubuntu user password.

Solution:

less /home/rodnee/.vagrant.d/boxes/ubuntu-VAGRANTSLASH-xenial64/20170721.0.0/virtualbox/Vagrantfile

# Front load the includes
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)

Vagrant.configure("2") do |config|
  config.vm.base_mac = "02824597EBF4"
  config.ssh.username = "ubuntu"
  config.ssh.password = "e0a41beeab17f069b9c4c452"

  config.vm.provider "virtualbox" do |vb|
     vb.customize [ "modifyvm", :id, "--uart1", "0x3F8", "4" ]
     vb.customize [ "modifyvm", :id, "--uartmode1", "file", File.join(Dir.pwd, "ubuntu-xenial-16.04-cloudimg-console.log") ]
  end
end

Source:
https://bugs.launchpad.net/cloud-images/+bug/1569237/comments/43
https://stackoverflow.com/questions/41337802/vagrants-ubuntu-16-04-vagrantfile-default-password#41828919

Categories: vagrant Tags:

Create a VM instance on Google cloud

October 5, 2017 Leave a comment

Google cloud platform aka GCP is a cloud offering from Google. GCP frees you from the overhead of managing infrastructure, provisioning servers and configuring networks. To let innovators innovate and let coders, well, just code. In this blog post, we’ll get to know how to create a VM instance on GCP. First of all, you’ll need […]

via Create a VM instance on Google cloud — mohitgoyal.co

Categories: Interesting