Skip to content

Instantly share code, notes, and snippets.

from flask import Flask
import flask_admin as admin
from flask_sqlalchemy import SQLAlchemy
from flask_admin.contrib import sqla
# Create application
app = Flask(__name__)
app.config['SECRET_KEY'] = '123456790'
@ix5
ix5 / alchemical_model.py
Created February 19, 2017 20:22 — forked from harvimt/alchemical_model.py
SQLAlchemy to/from PyQt Adapters
#!/usr/bin/env python2
#-*- coding=utf-8 -*-
# © 2013 Mark Harviston, BSD License
from __future__ import absolute_import, unicode_literals, print_function
"""
Qt data models that bind to SQLAlchemy queries
"""
from PyQt4 import QtGui
from PyQt4.QtCore import QAbstractTableModel, QVariant, Qt
import logging # noqa
@ix5
ix5 / detector.md
Created February 1, 2017 19:19 — forked from typehorror/detector.md
Detecting Similar News

Detecting Similar News

The following gist is an extract of the article Detecting Similar News. It exploit data retrieve by a crawler and detect similar article across different domains

Usage

Start by running the crawler to retrieve the data. Crawler takes about 50 minutes to retrieve all the data the first time.

$ python run.py

retrieving url... [techcrunch.com] /

@ix5
ix5 / Flask-SQLAlchemy Caching.md
Created January 21, 2017 19:21 — forked from typehorror/Flask-SQLAlchemy Caching.md
Flask SQLAlchemy Caching

Flask-SQLAlchemy Caching

The following gist is an extract of the article Flask-SQLAlchemy Caching. It allows automated simple cache query and invalidation of cache relations through event among other features.

Usage

retrieve one object

# pulling one User object

user = User.query.get(1)

@ix5
ix5 / reap-dead-tracks.pl
Last active July 18, 2016 00:18 — forked from bitfolk/reap-dead-tracks.pl
Here's a thing to check your Banshee library for files that are no longer present. It tells you which ones it will remove first and asks you if you want to. It's only removing the database entry.
#!/usr/bin/perl
# adapted from https://gist.github.com/bitfolk/6856343
# License: None(none specified in original code)
#
# Usage:
# - install Perl DBI modules:
# - (libdbi-perl, libdbd-sqlite3-perl for ubuntu)
# - Run reap-dead-tracks.pl <database>