Skip to content

Instantly share code, notes, and snippets.

View gnzandrs's full-sized avatar

Gonzalo Vergara gnzandrs

View GitHub Profile
@williamtsoi1
williamtsoi1 / lake-s3-object-take-ownership.js
Last active September 1, 2020 07:48
a lambda function to automatically take ownership of any objects written into an s3 bucket. Inspired by https://gist.github.com/joech4n/953c1cd6a36698c5d120
console.log('Loading event');
var aws = require('aws-sdk');
var s3 = new aws.S3({apiVersion: '2006-03-01'});
var sqs = new aws.SQS({apiVersion: '2012-11-05'});
exports.handler = function(event, context, callback) {
s3.listBuckets(function(err,data) {
if (err) {
console.log('ERROR: Problem getting list of buckets. This should have something to do with incorrect IAM permissions for the lambda.');
errorMessage = 'ERROR: Error from S3: '+err;
@yocontra
yocontra / aoe2hd.md
Last active June 9, 2023 18:28
Age of Empires II HD - For Mac OSX
# Here is my Python implementation of the hash table data structure.
# And here's my video where I talk about it in depth: https://youtu.be/sfWyugl4JWA
class Hashtable:
# Assumption: table_length is a prime number (for example, 5, 701, or 30011)
def __init__(self, table_length):
self.table = [None] * table_length
## An internal search function.
# If it finds the given key in the table, it will return (True, index)
# If not, it will return (False, the index where it would be inserted)