Airflow Remove Example Dags

When you start your local airflow based on the official documentation, the airflow will fill the db with a bunch of examples. If you want to remove them, first you need to find the airflow.cfg find under the airflow home directory (usually it is $HOME/airflow) and change the line load_examples = True to load_examples = False. After the change, however, the examples are still in you airflow’s DB. You need to run airflow resetdb to reset the airflow DB. Finally the examples are gone.

Python how to list files under a directgory

There are so many ways, but in python 3 looks the most popular way is using pathlib. Here is an example to list all
files starting with bar under dir /foo

[x.absolute() for x in pathlib.Path("/foo").glob("bar*")]

A Better Feature Branch Naming in Intellij IDEA

Intellij Idea has a very nice feature: you can customize feature branch name. When create a new task, the Intellij IDEA will help you create a new (git) branch. The default name of the branch is the task number, e.g. FOO-1 for Jira, or #1 for gitlab.

However, we can make the branch name better by adding the task summary to it. It will be like FOO-1-add-a-new-feature. To configure it, goes to Preferences->Tools->Task and change the Feature branch name format to {id}-{summary}

Generate Random Numbers from Command Line

On mac or bsd, we can use jot.
jot -r 1 0 10000

jot -r 1 0 0x7fffffffffffffffL

On linux need to install the package athena-jot:
sudo apt-get install athena-jot

Docker How To Delete Everything

Just want fresh restart and delete all containers? Here is the code:

docker stop $(docker ps -a -q) docker rm $(docker ps -a -q)

If you want to delete all images too:
docker stop $(docker ps -a -q) docker rmi $(docker images -a -q)