This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import csv | |
MAPS_KEY='YOUR_API_KEY' # Get API_key & Enable Places_API on GCP | |
MAPS_RADIUS='3000' #3KM radius | |
MAPS_KEYWORD='PHYSIOTHERAPY' # What are you looking for | |
CITIES = [ | |
{'name': 'madrid', 'cord': '40.416586, -3.703884'}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server_tokens off; | |
server { | |
listen 80; | |
listen [::]:80; | |
server_name example.com; | |
return 301 https://$server_name$request_uri; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
from botocore.exceptions import ClientError | |
import json | |
import os | |
ACL_RD_WARNING = "The S3 bucket ACL allows public read access." | |
PLCY_RD_WARNING = "The S3 bucket policy allows public read access." | |
ACL_WRT_WARNING = "The S3 bucket ACL allows public write access." | |
PLCY_WRT_WARNING = "The S3 bucket policy allows public write access." | |
RD_COMBO_WARNING = ACL_RD_WARNING + PLCY_RD_WARNING |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from datetime import datetime | |
import Pet, Car | |
# Reference: https://docs.djangoproject.com/en/2.2/ref/models/fields/#choices | |
COUNTRIES = ( | |
('ES', 'SPAIN'), | |
('FR', 'FRANCE'), |
NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.
If you are not into long explanations, see [Paolo Bergantino’s answer][2].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from threading import Thread | |
from queue import Queue | |
class Worker(Thread): | |
""" | |
Thread executing tasks from a given tasks queue | |
http://code.activestate.com/recipes/577187-python-thread-pool/ | |
""" | |
def __init__(self, tasks): |
NewerOlder