Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env ruby
# Use this script if you have 3 or more Chef Organizations
# and wish to speed up restores by using parallelism.
require 'fileutils'
require 'optparse'
CONCURRENCY = 1
BACKUP_LOG = "restore_#{Time.now.strftime('%m%d%Y%H%M')}.log".freeze
#!/usr/bin/env ruby
# Use this script if you have 3 or more Chef Organizations
# and wish to speed up restores by using parallelism.
require 'fileutils'
require 'optparse'
CONCURRENCY = 1
BACKUP_LOG = "restore_#{Time.now.strftime('%m%d%Y%H%M')}.log".freeze
--------
POST http://localhost:8151/derive_policy_pubkey/ethdenver2019
post body: {}
return 200: {"result": {"policy_encrypting_key": "02c18c026169690658dcf93e5a0c7d19cff79cb6e7d02106ef3b62984a2157405e"}, "version": "0.1.0-alpha.14"}
--------
POST http://localhost:5151/encrypt_message
post body:
{
"message":"dGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2c="
}
@itmustbejj
itmustbejj / gist:65386017ea34a919ab006fce32678e85
Last active September 21, 2018 02:05
parallel-restorev3.rb
#!/usr/bin/env ruby
require 'fileutils'
require 'optparse'
CONCURRENCY = 1
BACKUP_LOG = "restore_#{Time.now.strftime('%m%d%Y%H%M')}.log".freeze
SCRIPT_OUTPUT = 'chef-restore-by-org.sh'.freeze
ARGV << '-h' if ARGV.length != 6
@itmustbejj
itmustbejj / 05-a2-forwarder.conf
Created March 6, 2018 18:34
A logstash filter that posts raw documents to A2 using inline ruby.
filter {
ruby {
init => "
require 'net/http'
require 'uri'
require 'json'
require 'openssl'
"
code => "
automate_url = 'https://a2.mychef.co/data-collector/v0'
#!/usr/bin/env ruby
require 'fileutils'
require 'optparse'
ARGV << '-h' unless [6,8].include? ARGV.length
$options = {
sql_host: 'localhost'
}
#!/bin/bash
usage="
This is a script used to configure your logstash tunables through delivery.rb, and to scale the number of \n
logstash processes running on your Automate server.\n
\n
You can specify the following options:\n
--workers The number of filter workers per logstash process. Defaults to number of virtual cores.\n
--total-procs The number of total logstash processes to run. Defaults to 2.\n
--heap-size The heap size allotted to each logstash process. Defaults to 2g.\n
function bump_cookbook {
#export BUMP_TYPE=${1:-p}
declare -A bump_types
#bump_types=(["patch"]="p" ["minor"]="m" ["major"]="M")
bump_types["patch"]="p"
export SV=`grep -o '\([0-9]*\.[0-9]*\.[0-9]*\)' metadata.rb`;
sed -i -e "s/$SV/`eval increment_version -$1 $SV`/g" metadata.rb }
unset SV
alias bcma="bump_cookbook mmajor;git add metadata.rb"
function bump_cookbook {
#export BUMP_TYPE=${1:-p}
declare -A bump_types
#bump_types=(["patch"]="p" ["minor"]="mi" ["major"]="ma")
bump_types["patch"]="p"
export SV=`grep -o '\([0-9]*\.[0-9]*\.[0-9]*\)' metadata.rb`;
sed -i -e "s/$SV/`eval increment_version -$1 $SV`/g" metadata.rb }
unset SV
alias bcma="bump_cookbook mmajor;git add metadata.rb"
[user]
....
[core]
editor = vim
pager = less -R
[merge]
tool = meld
[diff]
tool = meld
[alias]