Devops

Spelling Is Next to Godliness

Spelling and grammar are very important. However, when in a rush, we tend to neglect these important aspects. Search engines and humans readers usually don’t appreciate content that includes spelling or grammatical errors. This notion also applies to your code repository… As such, let’s automatically spell check and fix our codebase with misspell! Spell Check cd my-code-repository/ ~/bin/misspell -w . git commit -am "fixed spelling" -w: Overwrite file with corrections Note: Be careful with overzealous fixes!

Interprocess Communication with Redis

There are many methods to communicating between processes. Many methods work best when only using a single programming language, while others require custom packets and parsing. Simplicity is key and Redis is an efficient solution. Redis is an open-source in-memory database project implementing a distributed, in-memory key-value store. Start Redis Server We will be using a Docker Redis container to run the Redis server. docker run -d --rm --name my_redis -p 6379:6379 redis -d, --detach: Run container in background and print container ID --rm: Automatically remove the container when it exits --name string: Assign a name to the container -p, --publish list: Publish a container’s port(s) to the host Client Installation This quick tutorial will focus on Python, so let’s install the recommended package.

Testing Python Packages with Docker

Package management is hard. Sometimes in Python package development, your local (development) environment may behave a little differently than a deployment target. Below is a simple method I use to replicate a clean environment and test Python package installs and tests. docker run -v `pwd`:`pwd` -w `pwd` python pip install . docker run -v `pwd`:`pwd` -w `pwd` python python setup.py install docker run -v `pwd`:`pwd` -w `pwd` python python setup.py test First, we bind the current directory to our container (-v) and switch our working directory (-w).

Recursively Git Reset All Submodules

git submodule foreach --recursive git reset --hard This command recursively resets all submodules in a git project. This is especially useful for projects with submodules (and maybe even submodules within submodules) when you want to reset your working copy to a completely clean state.

Start a Simple Web Server

python -m http.server 8000 This will serve index.html in the current working directory.

How to Trigger a Travis CI Build Without Admin Privileges

Sometimes Travis CI builds fail due to sporadic timeouts, network errors, etc. While these non-code errors can be quite annoying, Travis CI has a handy Restart build for when these situations occur, but only users with admin privileges have access to this feature. This limitation becomes significant when contributing to open-source projects. Given that a well-organized repository will only allow Pull Requests (PR) to be merged upon successful builds, non-code build errors hamper this process.

Issue-Branch Converter