Skip to content

Instantly share code, notes, and snippets.

Avatar

Matt Button BRMatt

View GitHub Profile
@BRMatt
BRMatt / tf-multitaint
Last active Aug 6, 2018
A small utility for tainting a bunch of terraform resources in one go `terraform state list | grep launch_configuration | tf-multitaint`
View 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|
View bar-chart.json
{
"x_axis": {
"labels": [
"2000",
"2001",
"2002",
"2003",
"2004",
"2005"
]
View keybase.md

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:

View example.rb
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
View gist:8032846a8d06e667fa0a
SELECT "posts".*, "authors".*
FROM "posts"
LEFT JOIN "authors" ON ("posts"."author_id" = "authors"."author_id");
View bug.rb
# 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.
View plugin.php
<?php
add_filter('memberful_wp_after_sign_in_url', 'my_after_sign_in_url');
function my_after_sign_in_url() {
return 'http://gohere.com';
}
View example.php
<?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
View gist:9336810
#!/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