This Ansible guide discusses several approaches on how to set different
role default variables
based / depending on the host operating system aka ansible_distribution
/
ansible_facts.distribution
or other variables. For example, a role
variable image_uri
should point to the latest cloud image for the host.
For CentOS 8
or Red Hat Enterprise Linux (RHEL) 8
the default value
should be:
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- src/cxx/lib/io/Xml.cpp 2018-01-05 14:12:25.000000000 -0500 | |
+++ src/cxx/lib/io/Xml.cpp 2018-01-05 14:12:35.000000000 -0500 | |
@@ -168,19 +168,11 @@ | |
if (!tree.empty()) | |
{ | |
unindex(*tree.begin(), treeWithIndexAttributes); | |
-#ifndef WIN32 | |
- boost::property_tree::write_xml(os, treeWithIndexAttributes, boost::property_tree::xml_writer_make_settings(' ', 2)); | |
-#else | |
boost::property_tree::write_xml(os, treeWithIndexAttributes, boost::property_tree::xml_writer_make_settings<std::string>(' ', 2)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.{ Random => JRandom } | |
import java.util.concurrent.atomic.AtomicLong | |
import scala.util.Random | |
val rng = new Random | |
val seedField = classOf[JRandom].getDeclaredField("seed") | |
seedField.setAccessible(true) | |
val seed = seedField.get(rng.self).asInstanceOf[AtomicLong].get |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export SPLIT_header_n=$1 | |
target_size=$2 | |
export SPLIT_input_file=$3 | |
target_wo_header=$(( "$target_size" - "$SPLIT_header_n" )) | |
[[ -n $SPLIT_input_file ]] || { | |
echo "usage: $(basename "$0") SPLIT_header_n target_n SPLIT_input_file" >&2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if git rev-parse --verify HEAD &> /dev/null ; then | |
against=HEAD | |
else | |
against=4b825dc642cb6eb9a060e54bf8d69288fbee4904 | |
fi | |
files=$( | |
git diff-index --cached --name-only $against | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
suppressMessages(library(lintr)) | |
files <- commandArgs(trailingOnly = T) | |
messages <- function(file) { | |
result <- lint(file) | |
print(result) | |
return(length(result)) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -efu -o pipefail | |
# returns staged files | |
function staged.files { | |
if git rev-parse --verify HEAD &> /dev/null | |
then | |
against=HEAD | |
else |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GIT_HOOK_DIR="$0.d" | |
if [[ -d $GIT_HOOK_DIR ]] ; then | |
while IFS= read -r -d $'\0' hook ; do | |
"./$hook" || error="yes" | |
done < <(find "$GIT_HOOK_DIR" -mindepth 1 -print0) | |
[[ -n $error ]] && exit 1 |
NewerOlder