Skip to content

Instantly share code, notes, and snippets.

View moraisaugusto's full-sized avatar
🎯
Focusing

Augusto Morais moraisaugusto

🎯
Focusing
View GitHub Profile
git checkout master
git checkout -b hotfix_branch
# work is done commits are added to the hotfix_branch
git checkout develop
git merge hotfix_branch
git checkout master
git merge hotfix_branch
@moraisaugusto
moraisaugusto / azureBlobStorage.py
Created June 24, 2019 07:58
Create a Azure Blob Storage Object
#!/usr/bin/env python3
import os, uuid, sys
from azure.storage.blob import BlockBlobService, PublicAccess
def run_sample():
try:
# Create the BlockBlockService that is used to call the Blob service for the storage account
block_blob_service = BlockBlobService(
account_name='ACCOUNTNAME',
@moraisaugusto
moraisaugusto / tabularTableStorage.py
Created June 24, 2019 07:54
Create a Azure Tabular Table storage
#!/usr/bin/env python3
from azure.cosmosdb.table.tableservice import TableService
from azure.cosmosdb.table.models import Entity
def execute():
"""docstring for execute"""
the_connection_string = "DefaultEndpointsProtocol=https;AccountName=MYACCOUNTNAME;AccountKey=ACCOUNTKEY;EndpointSuffix=core.windows.net"
@moraisaugusto
moraisaugusto / dos2unix-file.sh
Created May 23, 2019 14:22
Check if file is dos or unix
# the faster way to check if a file contains CRLF character
dos2unix -ic *.py | xargs dos2unix --info
@moraisaugusto
moraisaugusto / np-where-zero-division.py
Created April 17, 2019 09:15
Prevent np zero division
import numpy as np
x = np.array([[2., 54, 2., 5, 2],
[2, 0, 0.02, 0.00005, 0.0]])
y = [2, 0, 0.02, 0.00005, 0.0]
print(np.where(x[0] > 1e-3, x[0]/(x[1]+(x[1]==0)), 0))