Skip to content

Instantly share code, notes, and snippets.

View tarsil's full-sized avatar
🖖

Tiago Silva tarsil

🖖
View GitHub Profile
@tarsil
tarsil / nginx.conf
Created November 30, 2021 15:49 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@tarsil
tarsil / covalent_prepare_nft_metadata_batch.py
Created December 9, 2021 16:20 — forked from adamwhitakerwilson/covalent_prepare_nft_metadata_batch.py
By using the Covalent APIs, given an NFT contract and chain id, fetch all token ids and prepare an array of urls that call Get External NFT Metadata to be passed into the body for the batch query endpoint.
import requests
import time
import urllib3
def check_internet(url):
try:
req = urllib3.PoolManager().request("GET", url)
if str(req.status) != "500":
if str(req.status) != "404":
@tarsil
tarsil / create-superuser.py
Created January 11, 2022 15:17 — forked from c00kiemon5ter/create-superuser.py
Extend Django's management createsuperuser command to allow non-interactive creation of a superuser with a password.
"""
Extend createsuperuser command to allow non-interactive creation of a
superuser with a password.
Instructions:
mkdir -p path-to-your-app/management/commands/
touch path-to-your-app/management/__init__.py
touch path-to-your-app/management/commands/__init__.py
@tarsil
tarsil / brokers.py
Created January 26, 2022 14:12 — forked from dnmellen/brokers.py
Improved EagerBroker for dramatiq
from dramatiq.brokers.stub import StubBroker
class EagerBroker(StubBroker):
"""Used by tests to simulate CELERY_ALWAYS_EAGER behavior.
https://github.com/Bogdanp/dramatiq/issues/195
Modified by @dnmellen to support pipelines and groups
"""
def process_message(self, message):
@tarsil
tarsil / procedure-to-archive-git-branches.md
Created October 9, 2023 15:00 — forked from zkiraly/procedure-to-archive-git-branches.md
Procedure to archive git branches.