Skip to content

Instantly share code, notes, and snippets.

@SeanSith
SeanSith / update_to_cinc.rb
Last active September 23, 2022 18:22
Update Chef-Client to Cinc-Client using chef_client_updater cookbook
node.override['chef_client']['bin'] = '/usr/bin/cinc-client'
node.override['chef_client']['conf_dir'] = '/etc/cinc'
node.override['chef_client']['log_dir'] = '/var/log/cinc'
node.override['chef_client']['log_file'] = 'client.log'
node.override['chef_client']['cron']['log_file'] = "#{node['chef_client']['log_dir']}/#{node['chef_client']['log_file']}"
node.override['chef_client']['run_path'] = '/var/run/cinc'
node.override['chef_client']['file_backup_path'] = '/var/lib/cinc'
node.override['chef_client']['log_rotation']['postrotate'] = 'systemctl reload cinc-client.service >/dev/null || :'
if node[:packages][:chef]
directory '/etc/cinc' do
@lisawolderiksen
lisawolderiksen / git-commit-template.md
Last active May 12, 2024 19:40
Use a Git commit message template to write better commit messages

Using Git Commit Message Templates to Write Better Commit Messages

The always enthusiastic and knowledgeable mr. @jasaltvik shared with our team an article on writing (good) Git commit messages: How to Write a Git Commit Message. This excellent article explains why good Git commit messages are important, and explains what constitutes a good commit message. I wholeheartedly agree with what @cbeams writes in his article. (Have you read it yet? If not, go read it now. I'll wait.) It's sensible stuff. So I decided to start following the

#!/bin/bash
CLEAR='\033[0m'
RED='\033[0;31m'
function usage() {
if [ -n "$1" ]; then
echo -e "${RED}👉 $1${CLEAR}\n";
fi
echo "Usage: $0 [-n number-of-people] [-s section-id] [-c cache-file]"
@hfossli
hfossli / standard.sh
Last active February 8, 2024 05:19
Standard bash script format
#!/bin/bash
CLEAR='\033[0m'
RED='\033[0;31m'
function usage() {
if [ -n "$1" ]; then
echo -e "${RED}👉 $1${CLEAR}\n";
fi
echo "Usage: $0 [-n number-of-people] [-s section-id] [-c cache-file]"
@aerostitch
aerostitch / aws_cleanup_cloudwatch.go
Last active April 28, 2021 17:47
Delete empty log streams or logs streams that have only elements older than 30 days in it
package main
// This script cleans up old LogGroups (empty and olde than 90 days and old
// LogStreams (last event timestamp is over 30 days old or if the logstream
// is empty and has been created over 30 days ago) from AWS Cloudwatch
import (
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/cloudwatchlogs"
"log"
@cjuroz
cjuroz / BUILD
Last active February 4, 2022 12:08 — forked from jarpy/requirements.txt
Serverless Elasticsearch Curator for AWS Lambda using requests-aws4auth to sign requests with AWS ES
# http://docs.aws.amazon.com/lambda/latest/dg/lambda-python-how-to-create-deployment-package.html
pip install elasticsearch-curator -t /path/to/project-dir
pip install requests-aws4auth -t /path/to/project-dir
@kesor
kesor / cloudformation-yaml-to-json.py
Last active January 22, 2019 17:39
Convert CloudFormation YAML format to JSON format
#!/usr/bin/env python
import sys, yaml, json
def funcparse(loader, node):
node.value = {
yaml.constructor.ScalarNode: loader.construct_scalar,
yaml.constructor.SequenceNode: loader.construct_sequence,
yaml.constructor.MappingNode: loader.construct_mapping,
}[type(node)](node)
node.tag = node.tag.replace(u'!Ref', 'Ref').replace(u'!', u'Fn::')
@lucabusin
lucabusin / rd-clean.sh
Last active February 5, 2021 22:07
Shell script to purge Rundeck execution history (extended from @unicolet's script https://gist.github.com/unicolet/af648a97163ce6b44645)
#!/bin/sh
# keep last few executions for each job
KEEP=100
# db connection params
HOST=YOURDBHOST
PORT=YOURDBPORT
USERNAME=YOURDBUSERNAME
PASSWORD=YOURDBPASSWORD
@tomodian
tomodian / firehose-to-athena.js
Created February 28, 2017 15:22
Firehose to Athena
'use strict';
const aws = require('aws-sdk');
const s3 = new aws.S3({ apiVersion: '2006-03-01' });
exports.handler = (event, context, callback) => {
const key = decodeURIComponent(event.Records[0].s3.object.key);
const meta = key.split('/');
@jlaska
jlaska / .ansible.cfg
Last active March 4, 2019 20:15
Holiday Themed Ansible Cows
[defaults]
cow_selection = random
cow_whitelist = ansible_lights,ansible_reindeer,ansible_tree