Skip to content

Instantly share code, notes, and snippets.

CREATE EXTERNAL TABLE cloudtrail_logs (
eventversion STRING,
userIdentity STRUCT<
  type:STRING,
  principalid:STRING,
  arn:STRING,
  accountid:STRING,
  invokedby:STRING,
  accesskeyid:STRING,
userName:STRING,
@jaisingh
jaisingh / encrypt_openssl.txt
Created May 24, 2018 04:34 — forked from crazybyte/encrypt_openssl.txt
File encryption using OpenSSL
For symmetic encryption, you can use the following:
To encrypt:
openssl aes-256-cbc -salt -a -e -in plaintext.txt -out encrypted.txt
To decrypt:
openssl aes-256-cbc -salt -a -d -in encrypted.txt -out plaintext.txt
For Asymmetric encryption you must first generate your private key and extract the public key.

Internet Scale Services Checklist

A checklist for designing and developing internet scale services, inspired by James Hamilton's 2007 paper "On Desgining and Deploying Internet-Scale Services."

Basic tenets

  • Does the design expect failures to happen regularly and handle them gracefully?
  • Have we kept things as simple as possible?
#!/usr/bin/env ruby
require 'redis'
require 'hiredis'
require 'digest/sha1'
require 'benchmark'
def new_digest
Digest::SHA1.hexdigest( Time.now.strftime("%9N").to_s )
end
@jaisingh
jaisingh / file_provider_copy.rb
Created January 27, 2012 06:02 — forked from scottedsa/file_provider_copy.rb
Stick this in a library file...
class Chef
class Provider
class File
class Copy < Chef::Provider::File
def compare_content
checksum(@current_resource.path) == checksum(@new_resource.content)
end
def set_content