Skip to content

Instantly share code, notes, and snippets.

View berttejeda's full-sized avatar

Bert Tejeda berttejeda

View GitHub Profile
@berttejeda
berttejeda / docker-compose.yml
Last active March 12, 2021 20:50 — forked from thelinuxlich/docker-compose.yml
Redis Cluster with Docker Compose v3
version: "3.5"
services:
redis-master-1:
image: redislabs/redis:6.0.6-39
container_name: redis-master-1
command: |-
sh -c "redis-server \
--cluster-enabled yes --appendonly yes \
--cluster-config-file nodes.conf \
@berttejeda
berttejeda / k8s.quotas.jq
Created January 8, 2021 22:37
Use jq to display Limits/Allocation Ratio for a given Kubernetes namespace quota
[ .items[]? |
{
namespace:.metadata.namespace,
quotaname:.metadata.name,
limitsCpu:.status.hard."limits.cpu",
limitsCpu_used:.status.used."limits.cpu",
"limitsCpu_Allocation_Ratio": (
(
(if .status.hard."limits.cpu" | test("Gi") then
(.status.hard."limits.cpu" | rtrimstr("Gi") | tonumber)
@berttejeda
berttejeda / pre-commit
Created October 28, 2020 18:51
git pre-commit hook for validating YAML files
# .git/hooks/pre-commit
# inspired from https://gist.github.com/maciej-lasyk/f73f8aac271b4df4c7839dd425b4f092
FILES_PATTERN='.*\.yml$'
bin_path=$(type -p /usr/{,local/}{,s}bin/python 2>/dev/null)
if [[ ($bin_path == '') && ($(which python 2> /dev/null) == '') ]];then
echo '# Not checking Y.ML files, python not found';
@berttejeda
berttejeda / git.release_notes.sh
Created June 3, 2020 20:05
Generate release notes for your local git project
#!/bin/env bash
usage="""Echo release notes for your git repo
Usage:
${0##*/} --release-name|-R <release_name> --remote-name|-r <Name Of Your Remote Git Repo> --start-tag-or-commit|-s <Tag Name to Start From> --end-tag-or-commit|-e <Tag Name to End At>
Example:
${0##*/} --release-name 'Release 2020-06-03 v1.0.0' --remote-name origin --start-tag-or-commit 74d731e --end-tag-or-commit 86f126d
${0##*/} -R 'Release 2020-06-03 v1.0.0' -r origin -s 74d731e --e 86f126d
"""
@berttejeda
berttejeda / puppet.centos6.7.local.install.sh
Last active February 13, 2017 21:44
Locally install Puppet 3.8.7 and its dependencies on CentOS 6.7
#Locally install Puppet 3.8.7 and its dependencies on CentOS 6.7
#Given:
#Your current directory contains:
#facter-2.4.6-1.el6.x86_64.rpm
#hiera-1.3.4-1.el6.noarch.rpm
#puppet-3.8.7-1.el6.noarch.rpm
#ruby-augeas-0.4.1-3.el6.x86_64.rpm
#ruby-shadow-2.2.0-2.el6.x86_64.rpm
#rubygem-json-1.5.5-3.el6.x86_64.rpm
yum localinstall $(ls | grep 'facter\|hiera\|puppet-\|ruby')
@berttejeda
berttejeda / functions.import
Last active February 28, 2017 17:13
Modular Bash Profile based on git-hosted source files
functions.import() {
local_script_cache_root=~/.src_bash_profile
if ! [[ -d $local_script_cache_root ]];then mkdir $local_script_cache_root || echo "Could not create local script cache ${local_script_cache_root}";fi
f.import () {
flags="${@: -1}"
if [[ $flags != '--update' ]];then echo "Importing cached scripts, specify the --update flag if you want to update cached versions";fi
f_git_url=$1; f_index_file=$2; f_cache_dir=$3
local_script_cache="${local_script_cache_root}/${f_cache_dir}"
if ! [[ -d $local_script_cache ]];then mkdir $local_script_cache || echo "Could not create local script cache ${local_script_cache}";fi
cache_index_file="${local_script_cache}/${f_index_file}"