Skip to content

Instantly share code, notes, and snippets.

View brandt's full-sized avatar

J. Brandt Buckley brandt

  • Twilio
  • Denver, CO
View GitHub Profile
@brandt
brandt / chef-expander-role-promotion-bug-demonstration.rb
Last active September 14, 2020 21:09
Demonstration of a bug where a node is incorrectly indexed as having a role that it does not
#!/usr/bin/env ruby
# POC for: https://github.com/chef/chef-server/issues/718
# Demonstration of a bug where a node is incorrectly indexed as having a role that it does not.
#
# 1. chef-expander munges and flattens the node hash
#
# 2. if the node has "role" as a nested keys, it will be promoted and merged with the top
#
From ea988d07c0d3ffb4a36102c71e859d75143a0829 Mon Sep 17 00:00:00 2001
Message-Id: <ea988d07c0d3ffb4a36102c71e859d75143a0829.1380730269.git.jdenemar@redhat.com>
From: Michal Privoznik <[email protected]>
Date: Mon, 30 Sep 2013 20:14:53 +0200
Subject: [PATCH] qemu: Drop qemuDomainMemoryLimit
https://bugzilla.redhat.com/show_bug.cgi?id=1013758
This function is to guess the correct limit for maximal memory
usage by qemu for given domain. This can never be guessed
From 6af58eebeee72ed4c5a5816a6ae64eca280d8fc6 Mon Sep 17 00:00:00 2001
Message-Id: <6af58eebeee72ed4c5a5816a6ae64eca280d8fc6.1357740563.git.jdenemar@redhat.com>
From: Michal Privoznik <[email protected]>
Date: Tue, 8 Jan 2013 18:22:01 +0100
Subject: [PATCH] qemu: Relax hard RSS limit
https://bugzilla.redhat.com/show_bug.cgi?id=891653
Currently, if there's no hard memory limit defined for a domain,
libvirt tries to calculate one, based on domain definition and magic
# Install this with:
#
# mkdir -p ~/.chef/plugins/knife
# curl <this_raw_file> > ~/.chef/plugins/knife/solve.rb
#
# Copyright 2014, Noah Kantrowitz
# Copyright 2015, J. Brandt Buckley
#
# Licensed under the Apache License, Version 2.0 (the "License");
@brandt
brandt / centos-6.log
Created May 11, 2015 09:31
osquery missing library "libcryptsetup" demonstration and fix in Docker
root@osquery-docker-test:~# docker run --rm -it centos:centos6 /bin/bash
[root@b1a7318dbf3c /]# rpm -ivh https://osquery-packages.s3.amazonaws.com/centos6/noarch/osquery-s3-centos6-repo-1-0.0.noarch.rpm
Retrieving https://osquery-packages.s3.amazonaws.com/centos6/noarch/osquery-s3-centos6-repo-1-0.0.noarch.rpm
warning: /var/tmp/rpm-tmp.TSTQpe: Header V4 RSA/SHA1 Signature, key ID c9d8b80b: NOKEY
Preparing... ########################################### [100%]
1:osquery-s3-centos6-repo########################################### [100%]
[root@b1a7318dbf3c /]# yum install osquery
Loaded plugins: fastestmirror
Setting up Install Process
base | 3.7 kB 00:00
@brandt
brandt / rubocop-limited.yml
Created March 26, 2015 18:05
Limited subset of Rubocop auto-correct rules enabled
# Type 'Lint' (36):
# Supports --auto-correct
Lint/BlockAlignment:
Description: Align block ends correctly.
Enabled: false
# Supports --auto-correct
Lint/DeprecatedClassMethods:
Description: Check for deprecated class method calls.
@brandt
brandt / bloom-filter-calculator.rb
Created February 17, 2015 17:19
Calculate the required bloom filter size and optimal number of hashes from the expected number of items in the collection and acceptable false-positive rate
# Optimal bloom filter size and number of hashes
# Tips:
# 1. One byte per item in the input set gives about a 2% false positive rate.
# 2. The optimal number of hash functions is ~0.7x the number of bits per item.
# 3. The number of hashes dominates performance.
# Expected number of items in the collection
# n = (m * ln(2))/k;
n = 300_000
@brandt
brandt / grant-drac-web-privileges.rb
Created November 18, 2014 17:33
Grant a user created with IPMI privileges to login to the Dell DRAC web management interface.
#!/usr/bin/env ruby
# Description:
#
# Quick hack to grant a user the privileges necessary to login to the Dell DRAC web management interface.
#
# This is a workaround for a bug where a user created in IPMI can't login to the Dell DRAC web management portal.
# The user would be denied with error: Login failed. User does not have 'Login to Dell BMC' privilege.
#
# We assume that the default user and password are still enabled (root:root).
@brandt
brandt / keybase.md
Last active August 29, 2015 14:07
keybase.md

Keybase proof

I hereby claim:

  • I am brandt on github.
  • I am brandt (https://keybase.io/brandt) on keybase.
  • I have a public key whose fingerprint is 2BB3 3104 E95E 7F40 201C ED32 D983 4D42 37F9 8C50

To claim this, I am signing this object:

@brandt
brandt / symlinks-test.sh
Last active August 29, 2015 13:59
Symlinks Big File Handling Test