Skip to content

Instantly share code, notes, and snippets.

View LucasRBarbosa's full-sized avatar
:octocat:

Lucas Ramos Barbosa LucasRBarbosa

:octocat:
View GitHub Profile
@LucasRBarbosa
LucasRBarbosa / aws-lambda-unzipper.py
Created February 12, 2021 18:30 — forked from msharp/aws-lambda-unzipper.py
unzip archive from S3 on AWS Lambda
import os
import sys
import re
import boto3
import zipfile
def parse_s3_uri(url):
match = re.search('^s3://([^/]+)/(.+)', url)
if match:
return match.group(1), match.group(2)
@LucasRBarbosa
LucasRBarbosa / CDN.md
Created February 4, 2021 12:41 — forked from vinkla/CDN.md

Upload images to GitHub

  1. Create a new issue on GitHub.

  2. Drag-and-drop an image onto the comment field.

  3. Wait for the upload process to finish.

  4. Copy the URL and use it in your Markdown files on GitHub.

@LucasRBarbosa
LucasRBarbosa / aws_glue_boto3_example.md
Created February 4, 2021 11:12 — forked from ejlp12/aws_glue_boto3_example.md
AWS Glue Create Crawler, Run Crawler and update Table to use "org.apache.hadoop.hive.serde2.OpenCSVSerde"
import boto3

client = boto3.client('glue')

response = client.create_crawler(
    Name='SalesCSVCrawler',
    Role='AWSGlueServiceRoleDefault',
    DatabaseName='sales-cvs',
    Description='Crawler for generated Sales schema',
@LucasRBarbosa
LucasRBarbosa / twitter.json
Created February 1, 2021 02:22 — forked from hrp/twitter.json
Example JSON response from Twitter streaming API
{
"text": "RT @PostGradProblem: In preparation for the NFL lockout, I will be spending twice as much time analyzing my fantasy baseball team during ...",
"truncated": true,
"in_reply_to_user_id": null,
"in_reply_to_status_id": null,
"favorited": false,
"source": "<a href=\"http://twitter.com/\" rel=\"nofollow\">Twitter for iPhone</a>",
"in_reply_to_screen_name": null,
"in_reply_to_status_id_str": null,
"id_str": "54691802283900928",

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@LucasRBarbosa
LucasRBarbosa / benchmark.py
Created January 7, 2021 13:02 — forked from gdamjan/benchmark.py
a script to read db tables in memory, truncate tables, and insert back the data - for stupid performance tests (used sqlalchemy, psycopg2 and python 3.5)
# http://dabeaz.blogspot.mk/2010/02/context-manager-for-timing-benchmarks.html
import time
class benchmark(object):
def __init__(self,name):
self.name = name
def __enter__(self):
self.start = time.time()
def __exit__(self,ty,val,tb):
end = time.time()
print("%s : %0.3f seconds" % (self.name, end-self.start))
@LucasRBarbosa
LucasRBarbosa / assume_role.py
Created January 2, 2021 23:53 — forked from DaisukeMiyamoto/assume_role.py
AWS Boto3 Assume Role example
import boto3
from boto3.session import Session
def assume_role(arn, session_name):
"""aws sts assume-role --role-arn arn:aws:iam::00000000000000:role/example-role --role-session-name example-role"""
client = boto3.client('sts')
account_id = client.get_caller_identity()["Account"]
print(account_id)
@LucasRBarbosa
LucasRBarbosa / git.md
Created July 11, 2020 22:24 — forked from pedronauck/git.md
Terminal commands

Comandos Gerais

Clonar um Repositório

$ git clone 'nome-do-repositório'

Verificar status

$ git status