Skip to content

Instantly share code, notes, and snippets.

View tOlorun's full-sized avatar

Oluwaseun Omotosho tOlorun

View GitHub Profile
@tOlorun
tOlorun / audit_mixin.py
Created April 19, 2017 22:51 — forked from techniq/audit_mixin.py
Useful SQLAlchemy Mixins
from datetime import datetime
from sqlalchemy import Column, Integer, DateTime, ForeignKey
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declared_attr
from flask_security import current_user
class AuditMixin(object):
created_at = Column(DateTime, default=datetime.now)
updated_at = Column(DateTime, default=datetime.now, onupdate=datetime.now)
@tOlorun
tOlorun / rebuild_search_indices.py
Created December 7, 2016 03:00 — forked from davebarkerxyz/rebuild_search_indices.py
Rebuild Flask-WhooshAlchemy search indices
#!/usr/bin/env python
import datetime
from app import app, models
import whoosh
import flask_whooshalchemy
"""
Rebuild all Whoosh search indices
@tOlorun
tOlorun / start-celery-for-dev.py
Created April 18, 2016 02:46 — forked from chenjianjx/start-celery-for-dev.py
A python script which starts celery worker and auto reload it when any code change happens.
'''
A python script which starts celery worker and auto reload it when any code change happens.
I did this because Celery worker's "--autoreload" option seems not working for a lot of people.
'''
import time
from watchdog.observers import Observer ##pip install watchdog
from watchdog.events import PatternMatchingEventHandler
import psutil ##pip install psutil
import os
package org.springsource.examples.spring31.web.config;
// ...
@Configuration
@EnableWebMvc
@ComponentScan(basePackageClasses = { ViewController.class, CustomerService.class })
public class WebMvcConfiguration {