Skip to content

Instantly share code, notes, and snippets.

model_id - 5cc72c4a96b2d57bb60ca758
partner_script_id - 5a164fc4f7a57932dd40d9a7
@jezeniel
jezeniel / cheatsheet.md
Last active February 6, 2019 08:03
OpenFaas Local Setup

OpenFaas

export OPENFAAS_URL

# list available templates
faas new --list 

faas new --lang <template name> <function name>

faas build -f 
@jezeniel
jezeniel / app.py
Created February 22, 2018 11:11
Celery Part
from celery import Celery
from flask import Flask, jsonify, request, render_template
def make_celery(app):
celery = Celery(app.import_name,
broker=app.config['CELERY_BROKER_URL'],
backend=app.config['CELERY_RESULT_BACKEND'])
celery.conf.update(app.config)
TaskBase = celery.Task
@jezeniel
jezeniel / app.py
Last active February 22, 2018 10:39
Workshop
from flask import Flask, jsonify, request, render_template
app = Flask(__name__)
@app.route('/page/<name>/')
def page(name):
return render_template('hello.html', name=name)
@app.route('/api/get/')
@jezeniel
jezeniel / error_registry.py
Created September 13, 2017 10:14
Error Registry
class Jug:
def __init__(self):
self.exception_handlers = {}
def errorhandler(self, exception):
def decorator(f):
self.exception_handlers[exception] = f
return f
return decorator
@jezeniel
jezeniel / test_behaviours.py
Created May 24, 2017 11:52
Django Mock Model Test
from django.db import connection
from django.test import TestCase
from ..behaviors import WalletIntegration
class TestModel(WalletIntegration):
class Meta:
app_label = 'test'
@jezeniel
jezeniel / fabfile_cheatsheet.md
Created October 14, 2016 09:32
Fabfile Cheatsheet

Fabric Cheatsheet

Cookbook

The fab command

Change host per task

@jezeniel
jezeniel / django_logging_debug.py
Last active August 25, 2016 10:02
Django logging debug
import logging
# Just a simple way to output or print data on the console's stdout
logger = logging.getLogger('django')
logger.info("TEST")
@jezeniel
jezeniel / ssh_forwarding_cheatsheet.md
Last active November 27, 2023 17:32
SSH Agent Forwarding cheatsheet

Using the ssh agent

The following would show a similar output if a key is already added to your agent, and you are good to go.

$ ssh-add -l
2048 d7:8e:3d:03:9c:4f:f8:9d:04:0f:11:c5:24:e1:2f:3a rsa w/o comment (RSA)

The following will show if no agent is running.