Skip to content

Instantly share code, notes, and snippets.

View ddolcimascolo's full-sized avatar
😃
Coding

David DOLCIMASCOLO ddolcimascolo

😃
Coding
View GitHub Profile
@seb26
seb26 / A_one_line_formula.md
Last active December 16, 2024 15:54
This formula can be used in Google Sheets to take a value in bytes and then represent it in a human-readable format with binary units (KiB, MiB, GiB, and so on).
=ROUND( A2/(1024)^(FLOOR(log(A2)/log(1024))), 2) & " " & SWITCH( FLOOR( log(A2) / log(1024) ) ,0,"Bytes",1,"KiB",2,"MiB",3,"GiB",4,"TiB")
@rkrzr
rkrzr / auto_tags.py
Last active August 14, 2024 16:36
Automatically generate ansible tags of the same name for each role in a playbook
"""
This module implements an Ansible plugin that is triggered at the start of a playbook.
The plugin dynamically generates a tag for each role. Each tag has the same name as its role.
The advantage of this is that it saves you some boilerplate, because you don't have to wrap
all tasks of a role in an additional block and assign a tag to that.
Additionally, it works automatically when you add new roles to your playbook.
Usage is exactly the same as without this plugin: