Skip to content

Instantly share code, notes, and snippets.

lol = log --graph --decorate --oneline
lola = log --graph --decorate --oneline --all
prune-branches = !git remote prune origin && git branch -vv | grep ': gone]' | awk '{print $1}' | gxargs -r git branch -D
list-prunable = !git remote prune origin >&/dev/null && git branch -vv | grep ': gone]' | awk '{print $1}'
commits-on-this-branch-compared-to-master = !git cherry -v master
# Essentially - show me what I changed on this branch vs master
diffmaster = !git diff master...
dm = !git diff master...
#!/usr/bin/perl -w
# Copyright 2008 Amazon Technologies, Inc. Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. You may obtain a copy of the License at:
#
# http://aws.amazon.com/apache2.0
#
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and limitations under the License.
@mrwacky42
mrwacky42 / packer-config
Last active April 7, 2017 01:38 — forked from jjongsma/packer-config
Process YAML and write Packer JSON to STDOUT
#!/usr/bin/python
#
# Usage: packer-config my-template.yaml | packer build -
#
# Constructs a Packer JSON configuration file from the specified YAML
# template file and writes it to STDOUT.
#
# The YAML template format adds some flexibility and readability by
# adding comments and an !include directive, allowing for the
# following template syntax:

See what certificate a site is presenting

openssl s_client -showcerts -connect example.com:443

Disable verification

openssl s_client -verify 0 -showcerts -connect example.com:443

force TLS version

openssl s_client -tls1 -showcerts -connect example.com:443

Examine a local certificate

openssl x509 -noout -in example.com.crt -text | less

Examine a local key

openssl rsa -in example.com.key -noout -text

@mrwacky42
mrwacky42 / module_publish_to_aws_cloudwatch_logs.tf
Created August 11, 2016 22:26 — forked from conorgil/module_publish_to_aws_cloudwatch_logs.tf
Sharing IAM Role Policies between multiple IAM Roles
# AWS Cloudwatch Logs install documentation:
# https://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/QuickStartEC2Instance.html
# By defining this IAM Role Policy in a module, it can be referenced anywhere it is required
# for an IAM Role. This is preferrable to copy/pasting the IAM Policy statement because changes
# made to this role will automatically apply to all IAM Roles referencing this module.
###
# Variables
###
gpgagent=$(type -path gpg-agent)
envfile="$HOME/.gnupg/gpg-agent.env"
if [ -n "$gpgagent" ]; then
agent_pid=$(grep GPG_AGENT_INFO "$envfile" | cut -d: -f 2)
if [[ -e "$envfile" ]] && kill -0 "$agent_pid" 2>/dev/null; then
eval "$(cat "$envfile")"
else
eval "$(gpg-agent --daemon --write-env-file "$envfile")"
fi
fi
def get_queue_stats(queue_metrics):
for queue in get_rabbit_stats():
queue_metrics[metric].labels(hostname, queue['name']).set(queue[metric])
def create_queue_metrics():
metrics = {}
metrics['consumers'] = Gauge('rabbit_consumers_count',
{
"region": "us-west-1",
"metrics": [
{
"aws_namespace": "AWS/S3", "aws_metric_name": "BucketSizeBytes",
"aws_dimensions": ["BucketName", "StorageType"],
"aws_dimension_select": {
"BucketName": ["<redacted>"],
"StorageType": ["StandardStorage"]
}
- job_name: consul_discovery
consul_sd_configs:
- server: 'consul.redacted.com:8500'
services: ["node", "elasticsearch", "rabbitmq"]
relabel_configs:
- source_labels: ['__meta_consul_node']
regex: '(.*)'
target_label: 'instance'
replacement: '$1'
- source_labels: ['__meta_consul_service']
- job_name: node
consul_sd_configs:
- server: 'consul:8500'
services: ['node']
relabel_configs:
- <same stuff>
- job_name: rabbit
consul_sd_configs:
- server: 'consul:8500'