Skip to content

Instantly share code, notes, and snippets.

@rkrzr
rkrzr / auto_tags.py
Last active April 10, 2024 11:14
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:
@bikram990
bikram990 / createUser.sh
Created July 26, 2017 04:12
Create a daemon user in macOS
#!/bin/bash
if (( $(id -u) )) ; then
echo "This script needs to run as root"
exit 1
fi
if [[ -z "$1" ]] ; then
echo "Usage: $(basename $0) [username] [realname (optional)]"
exit 1
@tnarihi
tnarihi / .screenrc
Created December 23, 2014 22:39
My GNU Screen setting
# Filename: $HOME/.screenrc
# Purpose: Setup file for program "(GNU) screen"
# Latest change: Mon Jan 26 10:51:50 CET 2004
# Author: Michael Prokop / <online@michael-prokop.at> / www.michael-prokop.at
# ===============================================================
#
# ===============================================================
# SEE ALSO:
# ===============================================================
# SCREEN Pages:
@davidcelis
davidcelis / pagination.rb
Created June 30, 2013 20:14
Consuming Link header pagination in Ruby
# Link: <http://example.com/resources?page=2>; rel="next", <http://example.com/resources?page=5>; rel="last"
links = {}
headers['Link'].split(',').each do |link|
link.strip!
parts = link.match(/<(.+)>; *rel="(.+)"/)
links[parts[2]] = parts[1]
end