This file contains 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, connection | |
""" | |
Haversine formula in Django using Postgres SQL | |
Queries a model for all rows that are within a certain radius (given in meters) of a central point. | |
The 'location_model' placeholder should be raplaced with the name of the table (full name) that includes a latitude and longitude column. | |
The latitude and longitude columns should be decimal fields. |
This file contains 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
# An R script to estimate MQ gas sensors correlation curve and compute Ro, min and max Rs/Ro | |
# | |
# Copyright (c) Davide Gironi, 2016 | |
# | |
# Released under GPLv3. | |
# Please refer to LICENSE file for licensing information. | |
# How to use this script: | |
# 1) set limits as datasheet curve ("xlim" and "ylim") | |
# ex. |
This file contains 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
#!/usr/bin/env bash | |
# | |
# Usage: dev_signed_cert.sh HOSTNAME | |
# | |
# Creates a CA cert and then generates an SSL certificate signed by that CA for the | |
# given hostname. | |
# | |
# After running this, add the generated dev_cert_ca.cert.pem to the trusted root | |
# authorities in your browser / client system. | |
# |
This file contains 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
def retry(times, exceptions): | |
""" | |
Retry Decorator | |
Retries the wrapped function/method `times` times if the exceptions listed | |
in ``exceptions`` are thrown | |
:param times: The number of times to repeat the wrapped function/method | |
:type times: Int | |
:param Exceptions: Lists of exceptions that trigger a retry attempt |