Skip to content

Instantly share code, notes, and snippets.

View heitorlessa's full-sized avatar

Heitor Lessa heitorlessa

View GitHub Profile
@heitorlessa
heitorlessa / example_minio_boto3.py
Created August 30, 2016 14:18
Minio with python boto3
# Sample as to how to initialize s3 client to work with Minio API compatible - https://github.com/minio/minio
# AWS CLI counterpart - https://docs.minio.io/docs/aws-cli-with-minio
import boto3
s3 = boto3.resource('s3',
endpoint_url='http://<minio_IP>:9000',
config=boto3.session.Config(signature_version='s3v4')
)
@heitorlessa
heitorlessa / .gitconfig
Created November 18, 2016 16:49
codecommit http config
[credential]
helper = !aws --profile "aws_profile_name" codecommit credential-helper $@
UseHttpPath = true
@heitorlessa
heitorlessa / presign_url.py
Created January 11, 2017 16:11
Quick and dirty S3 Presign URL using Python Boto3 and Click
import boto3
import click
@click.command()
@click.argument("bucket")
@click.argument("key")
@click.option("-e", "--expiration", default=3600, type=int, help="How long this presigned URL will live for")
def presign_s3(bucket, key, expiration):
""" Simple utility to generate presigned URL on S3 (Default 1 hour expiration)
@heitorlessa
heitorlessa / simple_encrypt.py
Created January 11, 2017 16:16
Simple CLI to encrypt/decrypt data in KMS with or without context
import boto3
import base64
import click
import random
kms = boto3.client('kms')
@click.group()
def main():
""" Simple utility to encrypt/decrypt data via AWS KMS
@heitorlessa
heitorlessa / README.md
Last active February 8, 2017 20:30 — forked from rcknr/README.md
Using Let's Encrypt certificates with Amazon API Gateway

##Using Let's Encrypt certificates with AWS API Gateway

Before starting off with API Gateway set up it's worth mentioning that certificate configuration for this particular service is so far isn't well integrated, therefore different from other AWS services. Despite it using CloudFrount to serve on custom domains it won't let you customize distributions it creates, however all the limitations of CloudFront naturally apply to API Gateway. The most important in this case is the size of the key, which is limited by 2048 bit. Many tutorials provide ready to use terminal commands that have the key size preset at 4096 bit for the sake of better security. This won't work with API Gateway and you'll get an error message about certificate's validity or incorrect chain which won't suggest you the real cause of the issue. Another consideration is that to add a custom domain to API Gateway you have to have a certif

# Download curses wheel package
http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses
# Install curses via pip
pip install python -m pip install Downloads/curses-2.2-cp27-none-win_amd64.whl
# Run bpython-curses instead of bpython
bpython-curses
@heitorlessa
heitorlessa / Makefile
Created July 11, 2018 14:24
Latest Makefile
#########################################################
# #
# EXPERIMENTAL - Only use if you know what you're doing #
# #
#########################################################
BASE := $(shell /bin/pwd)
CODE_COVERAGE = 72
@heitorlessa
heitorlessa / App.vue
Last active March 24, 2023 14:33
AWS Amplify JS with Quasar Framework
<template>
<div id="app">
<router-view/>
</div>
</template>
<style>
</style>
<script>
@heitorlessa
heitorlessa / README.md
Last active April 25, 2023 09:01
Webpack+SAM+Typescript example

Thread: https://twitter.com/heitor_lessa/status/1137361365818060800

  • Local prototyping with hot-reloading and step through debugging: npm run watch
  • Bundle, minify and valid structure for SAM package/deploy: npm run build

TL;DR

  • Webpack is instructed to dynamically look up for index.ts within src folder -- (src/function1/index.ts, src/function2/index.ts)
  • Webpack builds a bundle per function to build/function1/index.js, build/function2/index.js...
  • SAM CodeUri is set to the build folder build/function1
@heitorlessa
heitorlessa / appsync_axios.js
Created August 9, 2019 12:58
axios_appsync_snippet
const user = {
credentials: rootState.profile.user.signInUserSession.accessToken.jwtToken,
id: rootState.profile.user.attributes.sub
}
const fetchLoyaltyQuery = `query getLoyalty_status($cust_id: ID!) {
getLoyalty_status(cust_id: $cust_id) {
cust_id
points
tier