Skip to content

Instantly share code, notes, and snippets.

Install RabbitMQ

sudo apt-get install rabbitmq-server

Install Celery

pip install celery

Django Project

@axeliodiaz
axeliodiaz / django_heroku_steps.rst
Last active August 4, 2017 17:58
Step by step to configure django heroku

Login in heroku: :

heroku login

Add Procfile file: :

web: gunicorn project.wsgi --log-file -; python manage.py collectstatic --noinput

Add cat runtime.txt: :

for link in ENLACE; do wget -m --recursive --page-requisites --html-extension --convert-links --restrict-file-names=windows --domains domains.com --force-html --base $link --no-parent $link; done
@axeliodiaz
axeliodiaz / sources.list
Last active June 21, 2017 15:51
Debian Repository
deb http://ftp.us.debian.org/debian/ stretch main contrib non-free
deb-src http://ftp.us.debian.org/debian/ stretch main contrib non-free
# deb http://ftp.es.debian.org/debian/ sid main contrib non-free
# deb-src http://ftp.es.debian.org/debian/ sid main contrib non-free
deb http://ftp.us.debian.org/debian/ stretch-backports main contrib non-free
deb-src http://ftp.us.debian.org/debian/ stretch-backports main contrib non-free
deb http://security.debian.org/ stretch/updates main contrib non-free
@axeliodiaz
axeliodiaz / messages_and_errors_django_template.html
Created April 15, 2017 18:16 — forked from adamghill/messages_and_errors_django_template.html
Show messages and errors in Django templates. Useful to just throw in a base template.
{% if messages %}
{% for message in messages %}
<div class="alert {% if message.tags %} alert-{{ message.tags }}{% endif %}">{{ message|safe }}</div>
{% endfor %}
{% endif %}
{% if form.errors %}
<div class="alert alert-error">
<h4>Please fix the following errors</h4>
<ul>
@axeliodiaz
axeliodiaz / logger.py
Last active December 23, 2016 15:31
Logger config to save SQL trace in a file log
DEBUG = True
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters': {
'standard': {
'format': "%(sql)s",
},
},
'handlers': {
import sendgrid
from datetime import datetime
SENDGRID_API_KEY = "S3NGR1D_AP1_K3Y"
TEMPLATE_ID = 't3mpl4t3_1d'
sg = sendgrid.SendGridClient(SENDGRID_API_KEY)
date_time = datetime.now()
sender = "Axel Díaz <correo@example>"
subject = "[AXELIO] Test Sendgrid [{}]".format(date_time)
@axeliodiaz
axeliodiaz / math_script.py
Last active March 22, 2016 02:28
Math excercises
LIMITE = int(input("Ingrese el límite de la evaluación: "))
result = []
resultado = 0
stop = False
archivo = open('resultados.txt', 'w')
for q in range(0, LIMITE):
# Si no es par
if not (q % 2 == 0) and not (q % 3 == 0):
@axeliodiaz
axeliodiaz / gource.sh
Last active March 10, 2016 18:30
Source git animation with video save/convertion (commented)
sudo aptitude install gource
cd DIRECTORY_GIT_PROJECT
gource \
-s .06 \
-1280x720 \
--auto-skip-seconds .1 \
--multi-sampling \
--stop-at-end \
--key \