Skip to content

Instantly share code, notes, and snippets.

@wvidana
wvidana / s3_upload.py
Last active March 21, 2018 18:45
Example to upload python string to an S3 bucket with AES256 server side encryption and timestamp in the filename
import time
import boto3
payload = "this is a test"
timestamp = int(time.time())
filename = "dummydeleteme-" + str(timestamp)
s3 = boto3.client('s3')
s3.put_object(
Bucket = 'XXX-MYBUCKETNAME-XXX',
if d.HasChange("access_logs") {
logs := d.Get("access_logs").([]interface{})
# PSUDEOCODE BELOW
if len(logs) == 0 or (len(logs) == 1 and log['enabled'] == false) {
attributes = append(attributes, &elbv2.LoadBalancerAttribute{
Key: aws.String("access_logs.s3.enabled"),
Value: aws.String("false"),
})
} else if len(logs) == 1 {
log := logs[0].(map[string]interface{})
@wvidana
wvidana / movies.rb
Created March 18, 2016 19:43
Movies possible refactor
class MovieMates
class Movie
attr_reader :name
attr_accessor :imdb_rating, :rotten_tomatoes_rating
def initialize(name: )
@name = name
end
def eql?(other)