Skip to content

Instantly share code, notes, and snippets.

View marceloandriolli's full-sized avatar

Marcelo Andriolli marceloandriolli

  • Florianopolis, Brazil
View GitHub Profile
@marceloandriolli
marceloandriolli / gist:71f264d26a921444732fb7574ad0fdb7
Last active December 30, 2019 19:45
Conection docker projects by a specific network
# Setup to development testing without touch CMS API:
# /triller_cms/settings/base.py
TRILLER_CMS_OLD_API_URL = 'https://development-social.triller.co/v1.5/'
#TRILLER_CMS_API_URL = 'http://api.staging.triller.co/v1.5/cms-api'
TRILLER_CMS_API_URL = ''
# triller_cms/settings/development.py
#TRILLER_CMS_API_URL = os.getenv('CMS_API_URL', 'https://development-social.triller.co/v1.5/cms-api')
# triller_cms/settings/docker.py
@marceloandriolli
marceloandriolli / code_challenge.py
Last active February 4, 2020 14:16
code challenge
#!/usr/bin/env python3
def count_digits(n, digit):
"""Return the number of times digit appears in the squares of the sequence 1..n.
Example:
count_digits(10, 1) = 4
# 1, 2, 3, 4, ..., 9, 10 --> 1, 4, 9, 16, ..., 81, 100
"""
@marceloandriolli
marceloandriolli / poc_sonoff_mini_diy.html
Last active April 28, 2021 15:39
POC - Sonoff mini DIY - API
<!DOCTYPE html>
<html>
<body>
<h1>Testiong Sonoff mini REST API</h1>
<button id="turnON" type="button">Turn ON</button>
</body>
@marceloandriolli
marceloandriolli / image_dimension_dynamic_validator.py
Last active August 4, 2021 19:54
Django dynamic Image dimension validator
""""
When you wanna validate dynamically different image size in Django forms and model forms
""""
# settings.py
DEFAULT_THUMBNAILS_DIMENSION = (
os.getenv('THUMBNAIL_WIDTH_PX', 300), os.getenv('THUMBNAIL_HEIGHT_PX', 300)
)