Archive for March, 2016

Joe – A .gitignore magician in your command line.

March 14, 2016 Leave a comment

A .gitignore magician in your command line. Joe generates .gitignore files from the command line for you.



Categories: git, Interesting, python Tags: ,

Christophe Pettus – PostgreSQL Proficiency for Python People – PyCon 2015

March 13, 2016 Leave a comment

Interesting reads: is Christophe Pettus’ software development blog. It has an rss feed.

Categories: postgresql, python

Python Tutor

March 12, 2016 Leave a comment

Python Tutor, created by Philip Guo, helps people overcome a fundamental barrier to learning programming: understanding what happens as the computer executes each line of a program’s source c…

Source: Python Tutor

Categories: python

Using Dnsmasq and nginx

March 11, 2016 Leave a comment

How to point a localhost to a different name. Eg localhost -> for use in local development?

One solution was dnsmasq. Simply updating /etc/hosts was not working for me. I think there was something else I was missing out on. Following the instructions on the website listed in the source section worked for me.


DigitalOcean – How To Structure Large Flask Applications

March 10, 2016 Leave a comment

There are many methods and conventions for structuring Python web applications. Although certain frameworks are shipped with tools (for scaffolding) to automate — and ease — the task (and the headaches), almost all solutions rely on packaging / modularizing applications as the codebase gets distributed [logically] across related files and folders.

The minimalist web application development framework Flask, has its own – blueprints.

Read the full article in the link below:

Categories: flask, python Tags: ,

Java Family Crisis

March 9, 2016 Leave a comment
Categories: funny Tags: ,

Terminal Whispering Talk by Thomas Ballinger

March 8, 2016 Leave a comment

The terminal emulators we run so many of our programming tools in are more powerful than we remember to give them credit for, and the key to that power is understanding the interface. This talk will cover terminal colors and styles, writing to arbitrary portions of the screen, handling signals from the terminal, determining the terminal’s dimensions and scrollback buffer behavior.

Also have a look at:

Running a pypi mirror on your laptop with devpi-server

March 7, 2016 Leave a comment

I got tired of having to repeatedly run devpi-server every now and again. Figured it was about time I just had a dedicated box running on my laptop.


$ mkdir /home/user/devpi_mirror
$ cd devpi_mirror
$ vagrant init "ubuntu/trusty64"

Edit your Vagrantfile and make the following changes:

  1. Uncomment the forwarded port mapping part. Note the new ports.
  2. Uncomment the private_network section. Note the IP address.
$ less Vagrantfile 
 22   # Create a forwarded port mapping which allows access to a specific port
 23   # within the machine from a port on the host machine. In the example below,
 24   # accessing "localhost:8080" will access port 80 on the guest machine.
 25 "forwarded_port", guest: 3141, host: 3141

 27   # Create a private network, which allows host-only access to the machine
 28   # using a specific IP.
 29 "private_network", ip: ""

Start up virtual box and devpi-server

$ vagrant up --provider virtualbox 
$ ssh vagrant@
$ sudo apt-get update
$ sudo apt-get install python-pip
$ sudo pip install devpi-server==2.5.0
$ devpi-server --version
$ devpi-server --port 3141 --host
2016-03-02 20:46:39,633 INFO  NOCTX Loading node info from /home/vagrant/.devpi/server/.nodeinfo
2016-03-02 20:46:39,636 INFO  NOCTX generated uuid: e494e5c5156f4c9299339c4298cfd07c
2016-03-02 20:46:39,640 INFO  NOCTX wrote nodeinfo to: /home/vagrant/.devpi/server/.nodeinfo
2016-03-02 20:46:39,649 INFO  NOCTX DB: Creating schema
2016-03-02 20:46:39,656 INFO  [Wtx-1] setting password for user u'root'
2016-03-02 20:46:39,656 INFO  [Wtx-1] created user u'root' with email None
2016-03-02 20:46:39,657 INFO  [Wtx-1] created root user
2016-03-02 20:46:39,657 INFO  [Wtx-1] created root/pypi index
2016-03-02 20:46:39,664 INFO  [Wtx-1] fswriter0: committed: keys: u'.config',u'root/.config'
2016-03-02 20:46:39,665 INFO  NOCTX retrieving initial name/serial list
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. For more information, see
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see
2016-03-02 20:46:50,499 INFO  [Wtx0] fswriter1: committed: keys: u'root/pypi/initiallinks'
2016-03-02 20:46:50,739 INFO  NOCTX Found plugin devpi-server-2.5.0 (/usr/local/lib/python2.7/dist-packages).
2016-03-02 20:46:50,740 INFO  NOCTX Found plugin devpi-server-2.5.0 (/usr/local/lib/python2.7/dist-packages).
2016-03-02 20:46:50,792 INFO  NOCTX devpi-server version: 2.5.0
2016-03-02 20:46:50,793 INFO  NOCTX serverdir: /home/vagrant/.devpi/server
2016-03-02 20:46:50,793 INFO  NOCTX uuid: e494e5c5156f4c9299339c4298cfd07c
2016-03-02 20:46:50,793 INFO  NOCTX serving at url:
2016-03-02 20:46:50,794 INFO  NOCTX bug tracker:
2016-03-02 20:46:50,794 INFO  NOCTX IRC: #devpi on
2016-03-02 20:46:50,794 INFO  NOCTX Hit Ctrl-C to quit.
serving on

On a separate box

$ telnet 3141
Connected to
Escape character is '^]'.

$ sudo pip install -i markdown
Downloading/unpacking markdown uses an insecure transport scheme (http). Consider using https if has it available
  Downloading (412kB): 412kB downloaded
  Running (path:/tmp/pip_build_root/markdown/ egg_info for package markdown

Installing collected packages: markdown
  Running install for markdown
    changing mode of build/scripts-2.7/markdown_py from 644 to 755
    Converting docs/install.txt -> build/docs/install.html
    changing mode of /usr/local/bin/markdown_py to 755
Successfully installed markdown
Cleaning up..

Change you pip.conf to include a link to your local devpi-server. This means that you can now just run “sudo pip install markdown”

$ vim $HOME/.pip/pip.conf
index-url =

I tried this with devpi-server version 2.1.5 and it did not work for me. So if you have a similar issue just move to a higher version before you give up.

If you get plugin errors like the ones below when checking the version of devpi-server then install devpi-web. Hopefully, it will fix your issue.

pluggy.PluginValidationError: Plugin 'devpi-web' hook 'devpiserver_on_changed_versiondata' argument 'projectname' not available plugin definition: devpiserver_on_changed_versiondata(stage, projectname, version, metadata) available hookargs: __multicall__, stage, project, version, metadata

Update 2016-10-28
Use supervisor to run devpi-server
1. Install supervisor.

$ sudo apt-get install supervisor

2. Update supervisor config with devpi server settings.

$ less /etc/supervisor/conf.d/devpi-server-local.conf
[program:devpi-server-local]                              ; Change the program name
command=/usr/local/bin/devpi-server --port 3141 --host  ; Command to start application
user=devpi_server_local                           ; User to run as
stdout_logfile=/var/log/devpi-server/devpi-server.log       ; Where to write log messages

3. Add a user

$ sudo adduser --system --group devpi_server_local
Adding system user `devpi_server_local' (UID 109) ...
Adding new group `devpi_server_local' (GID 115) ...
Adding new user `devpi_server_local' (UID 109) with group `devpi_server_local' ...
Creating home directory `/home/devpi_server_local' ...

4. Create log folder

sudo mkdir /var/log/devpi-server

5. Restart supervisor

$ sudo service supervisor restart
Restarting supervisor: supervisord.

6. Check that devpi-server is running.

$ sudo supervisorctl 
devpi-server-local               RUNNING    pid 5793, uptime 0:00:21
supervisor> exit


Jarrod Taylor – Writing Vim plugins with Python

March 6, 2016 Leave a comment

Jarrod Taylor’s github:

Categories: Interesting, python, vim Tags:


March 5, 2016 Leave a comment
Categories: Interesting Tags: ,