Skip to content

Instantly share code, notes, and snippets.

@dubcl
dubcl / megacli.md
Last active January 21, 2025 08:00
megacli command guide
@geerlingguy
geerlingguy / ansible-role-test.sh
Last active December 14, 2024 17:13
Ansible Role Test Shim Script
#!/bin/bash
#
# Ansible role test shim.
#
# Usage: [OPTIONS] ./tests/test.sh
# - distro: a supported Docker distro version (default = "centos7")
# - playbook: a playbook in the tests directory (default = "test.yml")
# - role_dir: the directory where the role exists (default = $PWD)
# - cleanup: whether to remove the Docker container (default = true)
# - container_id: the --name to set for the container (default = timestamp)
@soxofaan
soxofaan / README.md
Last active January 19, 2024 17:48
Simple pretty CSV and TSV file viewer.
@JonasGroeger
JonasGroeger / sync-projects
Last active March 3, 2025 12:06
Gitlab: Clone / Pull all projects in a group
#!/usr/bin/env bash
# Documentation
# https://docs.gitlab.com/ce/api/projects.html#list-projects
NAMESPACE="YOUR_NAMESPACE"
BASE_PATH="https://gitlab.example.com/"
PROJECT_SEARCH_PARAM=""
PROJECT_SELECTION="select(.namespace.name == \"$NAMESPACE\")"
PROJECT_PROJECTION="{ "path": .path, "git": .ssh_url_to_repo }"
@lukechilds
lukechilds / get_latest_release.sh
Created August 9, 2016 19:43
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@hartwork
hartwork / clean-all-but.py
Created June 16, 2016 09:02
Small tool to do poor-man's logrotate and update a "latest" symlink
#! /usr/bin/env python2
# Copyright (C) 2016 Sebastian Pipping <[email protected]>
# Licensed under AGPL v3 or later
from __future__ import print_function
import argparse
import errno
import os
import re
@andreicristianpetcu
andreicristianpetcu / ansible-summary.md
Created May 30, 2016 19:25
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@simonw
simonw / how-to.md
Last active March 20, 2025 19:28
How to create a tarball of a git repository using "git archive"
@spiette
spiette / jinja_variables_types.yml
Created March 3, 2016 14:52
Test the variables types in jinja2 templates, used here with ansible
---
- hosts: all
gather_facts: no
vars:
string: "string"
list:
- item1
- item2
dict:
key1: value1
@hijonathan
hijonathan / example.html
Last active February 12, 2024 01:30
Generate a unique id in a Jinja template.
<!-- Jinja Unique ID Generator -->
{% macro random_int(len) -%}
{% for n in range(len) %}
{{ [0,1,2,3,4,5,6,7,8,9]|random }}
{% endfor %}
{%- endmacro %}
{% macro unique_id(count_groups=5, group_len=6, separator='-') -%}
{% set parts %}