Skip to content

Instantly share code, notes, and snippets.

View BRMatt's full-sized avatar

Matt Button BRMatt

View GitHub Profile
@BRMatt
BRMatt / tf-multitaint
Last active August 6, 2018 11:28
A small utility for tainting a bunch of terraform resources in one go `terraform state list | grep launch_configuration | tf-multitaint`
#!/usr/bin/env ruby
resources = $stdin.readlines.map(&:split).flatten.map do |resource|
{
module: resource.scan(%r{module\.([a-z0-9\-_]+)}).to_a.join("."),
identifier: resource.match(%r{(?:module\.[a-z0-9\-_]+\.)*(.*)$}).captures.first,
}
end
resources.each do |resource|
{
"x_axis": {
"labels": [
"2000",
"2001",
"2002",
"2003",
"2004",
"2005"
]

Keybase proof

I hereby claim:

  • I am brmatt on github.
  • I am thatmatt (https://keybase.io/thatmatt) on keybase.
  • I have a public key ASCzUvNoJaxPkxvJVoltLkDSfhTvX6CmR-9V0V5ulm4CXgo

To claim this, I am signing this object:

require 'oauth2'
client = OAuth2::Client.new(
'client_id',
'client_secret',
:site => 'https://workshop.memberful.com',
:authorize_url => '/oauth'
)
redirect_to client.auth_code.authorize_url
SELECT "posts".*, "authors".*
FROM "posts"
LEFT JOIN "authors" ON ("posts"."author_id" = "authors"."author_id");
@BRMatt
BRMatt / bug.rb
Last active November 21, 2020 08:03
# Activate the gem you are reporting the issue against.
gem 'activerecord', if ENV['RAILS_3'] then '3.2.19' else '4.1.6' end
require 'active_record'
require 'minitest/autorun'
require 'logger'
# Ensure backward compatibility with Minitest 4
Minitest::Test = MiniTest::Unit::TestCase unless defined?(Minitest::Test)
# This connection will do for database-independent bug reports.
<?php
add_filter('memberful_wp_after_sign_in_url', 'my_after_sign_in_url');
function my_after_sign_in_url() {
return 'http://gohere.com';
}
<?php
// This will dump information about all plans the currently signed in member has access to
var_dump(memberful_wp_user_plans_subscribed_to(wp_get_current_user()->ID));
// This will print all downloads the currently signed in member has access to, including those granted by a subscription
var_dump(memberful_wp_user_downloads( wp_get_current_user()->ID ));
// You can also pass the id of a specific user to get the plans for that specific user. E.g
#!/usr/bin/env ruby
require "openssl"
require 'digest/sha2'
require 'base64'
# We use the AES 256 bit cipher-block chaining symetric encryption
alg = "AES-256-CBC"
# We want a 256 bit key symetric key based on some passphrase
digest = Digest::SHA256.new