Python

TLDR: Running commands at multiple hosts with Fabric

Published on

TLDR: Running commands at multiple hosts with Fabric
Recently someones asked me how to perform a connection to a server to run the command df -h using ssh to display the disk usage of the machine. After a quick chat, I discovered that the question was more than just a single check to a server. It was to extend that to multiple servers. The answer to the question was quick and came with a “click”. How about to document these quick tips at the blog?

Separating Frontend from Backend with Angular and Django

Published on

Separating Frontend from Backend with Angular and Django
At web development, things evolve and grow in complexity faster than we can follow. That old way of creating websites where the pages were built only with HTML and if you had to change something you had to go through many pages changing the same thing is something rare nowadays. Now, even to create static websites, we use tools to optimize our work. On the last years, we had an increase in javascript frameworks and an excellent evolution on the frontend as a whole.

Exploring pygame 4 - Game of Life

Published on

Exploring pygame 4 - Game of Life
A while ago, I made a post on how to organize a coding dojo that was published right after the Python DF community anniversary dojo where I prepared a challenge to create the game of life from John Horton Conway. To let the challenge more dynamic, I prepared a graphic simulator using pygame so everyone could see the code running visually. The simulator uses all the concepts that we saw on the last posts of this series.

Exploring pygame 3 - Game Loop

Published on

Exploring pygame 3 - Game Loop
Now that we learned how to draw on the screen (previous post) would be good that our game keeps running until someone closes it, and to do that we will use one of the basic concepts of game development with is the Game Loop. Concept The concept of loop is something very common at computing, it is nothing but a sequence of actions and decision makings that repeats inside on a cycle.

Exploring pygame 2 - Drawing on Screen

Published on

Exploring pygame 2 -  Drawing on Screen
During a game lifetime, we are constantly drawing on the screen. Now that we learned how to create a program with pygame it’s time to start to draw. Drawing axis Going back to math classes at high school we were introduced to the Cartesian coordinate system. It is basically one bidimensional plane oriented by the axis x and y where the x values grow from left to right while y grows from bottom to top:

Exploring pygame 1 - Discovering the library

Published on

Exploring pygame 1 - Discovering the library
Game development is one of the most common reasons to start to study programming. With me it was not different, despite not following the game developer path, this was always a field that caught my attention. I’m creating this series of posts to learn more about the game development basics and to share my discoveries with everyone. I’ll use the pygame library as tool and I will start by the most basic principles of game development until the creation of a single player pong like game.

Coding Dojo 101

Published on

Coding Dojo 101
My first Coding Dojo happened right after my first contact with the Python language at college. A classmate (Dirley) that had back from Python Brasil conference where he discovered the concept of Coding Dojo and was excited to put that to practice. That was a really fun day and probably the most important moment that started a spark on me to learn more about Python. In the same way as that brought me to Python and after to the community, Coding Dojo can be an entry door to a lot of people to programming.

Publishing at GitHub Pages with Pelican and Travis-CI

Published on

Publishing at GitHub Pages with Pelican and Travis-CI
First published at: df.python.org.br/blog/github-pages-com-pelican-e-travis-ci I’m making this post to help everyone who want to create their first website at GitHub Pages using Pelican to create the pages and Travis-CI to automate the task of static page generation and publishing. This guide assumes that the reader have an account at GitHub and Travis-CI and have familiarity with the Python environment. The version of Pelican used at this post was 3.6. The images have a little of Portuguese due to the original language publication GitHub Pages GitHub Pages is a feature of GitHub that enables its users to host static content (html, css, js and images) and publish on a github.

Django Generic ManyToMany Relations

Published on

Django Generic ManyToMany Relations
Django’s official documentation nicely covers its generic relationship functionality when you have to make an OneToMany (one-to-many or 1:N) relation, but when you need to implement a generic ManyToMany (many-to-many or N:N) relation, there is not much documentation about it. I recently had to implement an N:N with a generic side, and discovered a library called django-gm2m that was very useful to me in this task, and I will describe here giving tips on how to make this implementation and how to avoid possible headaches.

Static Websites with Lektor

Published on

Static Websites with Lektor
Theres about 4 years that I try to start a blog and during that time I created some for the community but never my own. Using publishing tools like WordPress the problem was the difficulty of customizing it and the amount of tooling that I would never use, plus it’s not Python. Then I discovered GitHub Pages, and at the same time Pelican by indication of Magnun Leno and I started to do a lot things with it.