Skip to content

Instantly share code, notes, and snippets.

@david-caro
david-caro / db_helpers.py
Last active March 23, 2017 10:30
db consistency check
from invenio_db import db
from sqlalchemy import inspect
from sqlalchemy.exc import ProgrammingError
def check_col_seq_consistency(table, col):
seq_id = get_seq_id(table, col)
max_id = get_max_id(table, col)
if max_id is not None and seq_id != max_id:
print 'ERROR: {table}::{col} has a different seq={seq} than max={max}, please check.'.format(
@david-caro
david-caro / 0_reuse_code.js
Created July 8, 2016 08:52
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@david-caro
david-caro / tasklogger
Last active December 8, 2015 19:04
Task logger classes and decorator
#!/usr/bin/env python
import logging
import re
from collections import (
OrderedDict,
deque,
)
from functools import wraps