Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View cescoferraro's full-sized avatar
🏠
Working from home

cesco cescoferraro

🏠
Working from home
View GitHub Profile
@cescoferraro
cescoferraro / __init__.py
Last active August 29, 2015 14:21 — forked from anonymous/__init__.py
Flask (with factory_app) + Celery integration
# Empty
if __name__ == '__main__':
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = sock.connect_ex(('127.0.0.1', 8080))
if result == 0:
from flask.ext.migrate import Migrate, MigrateCommand
from app import db
migrate = Migrate(app, db)
@cescoferraro
cescoferraro / Angular ng-click with ng-show, two buttons.markdown
Created May 22, 2015 12:39
Angular ng-click with ng-show, two buttons

This is a quick guide on installing HTTPie for Mac OS X systems. This is also useful if you want the python package management utility pip. An installed copy of Homebrew is a prerequisite.

HTTPie

# install the python package provided with homebrew
brew install python

# install HTTPie with the pip utility
pip install httpie
@cescoferraro
cescoferraro / gist:dd5318a2085fb10f5254
Last active August 29, 2015 14:27
FLASK SOCKETIO V1.0 APP FACTORY PROBLEM
websocket/socket_controllers
SAME AS THE EXAMPLE, APART FROM THE OBJECT NAME (CESCO)
websocket/__init__.py
from flask import Blueprint
websocketio = Blueprint('websocket', __name__, url_prefix="/socket")
import app.websocket.socket_controllers
@cescoferraro
cescoferraro / ThymeLeaf Upgrading
Created November 2, 2015 18:10
ThymeLeaf ERROR
2015-11-02 15:52:18.161 ERROR 22254 --- [ main] o.s.boot.SpringApplication : Application startup failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'viewResolver' defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafViewResolverConfiguration': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.thymeleaf.spring4.SpringTemplateEngine org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration$ThymeleafViewResolverConfiguration.templateEngine; nested exception is org.springframework.beans.factory.BeanCreationException: E
@cescoferraro
cescoferraro / Multiple PhotoSwipe galleries on pagea.markdown
Created November 9, 2015 10:28
Multiple PhotoSwipe galleries on pagea
@cescoferraro
cescoferraro / How to create a Vagrant Box to run Ansible against on OSX
Last active January 7, 2016 15:14
nearly empty playbook to trigger vagrant to create a valid Ansible inventory and keys
* create a folder, here we call it /tmp/ansible-vagrant
* paste this two files inside
run:
$ vagrant up && vagrant provisioning
* this will create those both files that you will need to run ansible againt the box
/tmp/ansible-vagrant.vagrant/machines/default/virtualbox/private_key
/tmp/ansible-vagrant.vagrant/provisioners/ansible/inventory/vagrant_ansible_inventory
ansible-playbook --private-key=.vagrant/machines/default/virtualbox/private_key \
-u vagrant \
@cescoferraro
cescoferraro / __init__.py
Created January 18, 2016 16:55
Import all files inside a package
import importlib
import os
for module in os.listdir(os.path.dirname(__file__)):
if module != '__init__.py':
if not str(module).endswith('.pyc'):
path= "scripts.%s"% module
# This is doing "import `file`" instead of "from `file` import *"
importlib.import_module(str(os.path.splitext(path)[0]))