Skip to content

Instantly share code, notes, and snippets.

View mbainter's full-sized avatar

Mark Bainter mbainter

View GitHub Profile
@mbainter
mbainter / low_battery_alert.yaml
Last active May 31, 2022 23:20
Homeassistant Blueprints
blueprint:
name: Low battery level detection & notification for all battery sensors
description: Regularly test all sensors with 'battery' device-class for crossing a certain battery level threshold and if so execute an action.
domain: automation
source_url: https://gist.github.com/mbainter/e621073433e277f7bcb1448d94c75b36#file-low_battery_alert-yaml
# Blueprint Inputs
input:
threshold:
@mbainter
mbainter / base-policy
Created July 10, 2019 18:36
Example Policyfiles
name 'base'
default_source 'supermarket'
cookbook 'my-audit', '=1.0'
run_list 'my-audit'
@mbainter
mbainter / vmware-void-fix
Created April 26, 2019 03:44 — forked from misuchiru03/vmware-void-fix
Fix for vmware installs on voidlinux runit and vmmon module
#!/bin/bash
# must run as root
if [ $UID != 0 ]; then
echo "You must be root."
exit 0
fi
# soft link vmware's init.d scripts to void's runit directory
ln -s /etc/init.d/vmware* /etc/runit/
@mbainter
mbainter / drone-drawers.lua
Last active January 3, 2019 03:20
drone-drawers
local range = 32
local function proxyFor(name, required)
local address = component and component.list(name)()
if not address and required then
error("missing component '" .. name .. "'")
end
return address and component.proxy(address) or nil
end
@mbainter
mbainter / 0xD77610FD26110F0C
Created August 25, 2018 21:47
GPG Public Keys
-----BEGIN PGP PUBLIC KEY BLOCK-----
mQINBFiiJYEBEAC12D6jRJYOSi8Zx6DubfNV43gTv41Ku+YyUQ/0dmmnMc8zLSHX
6jCj+Uz5vyPXwj34nJfVX7HRB0V6vuvmAyP10AqWFQJpyCUDRw/EYmTg26cc2uSz
Ini2DpA/x7rOov2BZsxnIsE1uURstQ94Plb0gHINvDopjaZWAPLLk7V0moqtPjx6
C9qt1Z53m9tTlaJH2NwYFxbjzs3T2LOoTcN7mR0UI4WSWkvr6phvpdTZP2CKxQ/E
NHB3mxN2dFjoD6F1f7qp92k3htjEOgwmIJHB/TZ0517kTTCwISuQ8FuXzIHpi3Js
IUYwcaFCAD7gfXHOewYLUlPL5h6N1mV3+AcLoKOIzp7HzsiyeqLsnCylpOV8YO2i
fK9PGpQQvP8DwloLE+Qc+K+8yXdLPcID23a51UqxPKL4DxdRYTO1W/Cl0TNtlcqC
dzdCaRqXhe4qTDyEx8kSpA0oTIS2lFU0dSExhH/OOKFTtZ7Uugfw6XgnmHZeYmoY
@mbainter
mbainter / gist:1887d969c68915a49aaa8cb74da8a078
Created May 14, 2018 16:48
Platform example with attribute search
platforms:
- name: ubuntu-14.04
driver:
image_search:
owner-id: 099720109477
state: available
architecture: x86_64
virtualization-type: hvm
root-device-type: ebs
name: "*ubuntu/images/hvm/ubuntu-trusty-14.04-amd64-server-*"
#!/usr/bin/env python
# This is a trick, to output the bash commands we need to run in shell, and just execute this script inside an eval within our shell, so it imports what we need
# Possibly tie this in with https://gist.github.com/mbainter/b38a4cb411c0b5c1bae6 for MFA support
# Will need to durably store MFA access tokens, possibly in some other env vars
# Could also store all different keys/info in different vars, to reuse as needed (lots of env vars though, file may be better)
import os
import sys
import getpass
@mbainter
mbainter / aws_config.fish
Last active February 24, 2024 15:51
Fish shell function to set your AWS credentials with MFA for use with Terraform
function aws_config
if not fgrep -q "[$argv]" ~/.aws/credentials
echo "Please specify a valid profile."
else
set -e AWS_ACCESS_KEY
set -e AWS_SECRET_KEY
set -g -x ATLAS_TOKEN (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"atlas_token\") { print \$3 }}" ~/.aws/credentials)
set account (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"account_id\") { print \$3 }}" ~/.aws/credentials)
set username (awk "/\[$argv\]/,/^\$/ { if (\$1 == \"username\") { print \$3 }}" ~/.aws/credentials)
set mfarn "arn:aws:iam::$account:mfa/$username"

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real

@mbainter
mbainter / keybase.md
Created November 20, 2014 16:32
Keybase Github Verification for Mark Bainter

Keybase proof

I hereby claim:

  • I am mbainter on github.
  • I am mbainter (https://keybase.io/mbainter) on keybase.
  • I have a public key whose fingerprint is 023D 145A B40D 2F8A 8808 E418 6B9F 6F94 BA29 B937

To claim this, I am signing this object: