Skip to content

Instantly share code, notes, and snippets.

View fbidu's full-sized avatar

Felipe Rodrigues fbidu

View GitHub Profile
@fbidu
fbidu / export-eb-env.sh
Last active August 21, 2017 14:23
Export an Elastic Beanstalk environment variables to a bash-compatible env file
eb printenv <environment-name> | tail -n +2 | awk '{print "export " $1 "=\"" $3 "\""}'
@fbidu
fbidu / export-eb-env-docker.sh
Created August 21, 2017 14:32
Export an Elastic Beanstalk env vars to a `docker run` compatible argument list
eb printenv <environment-name> | tail -n +2 | awk '{print "-e \"" $1 "=" $3 "\" \\"}'

Keybase proof

I hereby claim:

  • I am fbidu on github.
  • I am fbidu (https://keybase.io/fbidu) on keybase.
  • I have a public key ASAZ1qsLXXouzhg-0kRH2oiPdV4xXW77OwWEtFoz_ieOSwo

To claim this, I am signing this object:

0x26fc5049bC81986BB3703af70BBe1ef4babb07E1
@fbidu
fbidu / sra_demo.py
Created October 15, 2017 21:08
Rascunho de script para obter IDs de sequencias de DNA/RNA (NGS) armazenadas no SRA (https://trace.ncbi.nlm.nih.gov/Traces/sra/) com base em busca via Entrez
from xml.dom import minidom # Ou qualquer parser XML que você preferir
from Bio import Entrez
def search_sra(query, email='[email protected]'):
"""
Retorna um handler de busca para o SRA
"""
Entrez.email = email
handle = Entrez.esearch(db='sra',
sort='relevance',
@fbidu
fbidu / draft.py
Created August 19, 2018 12:19
A rough draft for a more pythonic AWS client
import boto3
class Cluster:
"""
Class to handle an ECS Cluster
"""
def __init__(self, name, boto3_session):
assert type(boto3_session) == boto3.session.Session, "Please, provide an boto3 Session as argument!"
self.name = name
self.boto3_session = boto3_session
@fbidu
fbidu / export.md
Last active April 26, 2023 19:04
Exports an AWS ECS Task Definition environment variables to a docker run command
  1. Install jq
  2. Run:
aws ecs describe-task-definition \
	--task-definition <task_arn> \
	--query "taskDefinition.containerDefinitions[0].environment[]" |
	jq -r '.[] | "-e \(.name)=\"\(.value)\" \\"'
@fbidu
fbidu / python-bootstrap.md
Last active May 3, 2019 14:19
A simple shell script that bootstraps a basic Python project

Bootstrapping a Python project

Just give me the script!

From inside a new folder run:

pipenv --three
pipenv install --dev --pre pylint black pytest
touch README.md
mkdir tests
class CacheState(Enum):
"""
Enum to diferentiate caches hits and misses for boolean values.
It was created to store OAuth2 token validity in cache. In that
scenario, a cache miss prompts an API call to check the token,
while a cache hit with a False value does not.
VALID and INVALID are bool compatible.
>>> bool(CacheState.INVALID)
@fbidu
fbidu / dados.csv
Last active October 22, 2019 17:21
Dados de exemplo para um exercício de CSV com Python
326.75 39.9 39.92 3.69
333.05 49.75 49.76 3.91
338.45 59.85 59.72 4.09
340.95 64.9 64.86 4.17
343.25 69.81 69.9 4.25
345.35 74.84 74.78 4.31
347.45 79.85 79.93 4.38