This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import logging | |
import re | |
from collections import ( | |
OrderedDict, | |
deque, | |
) | |
from functools import wraps | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# encoding: utf-8 | |
import json | |
import re | |
import time | |
import logging | |
import click | |
from elasticsearch import Elasticsearch | |
from elasticsearch.helpers import reindex |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from invenio_db import db | |
seqs = [ | |
res[0] | |
for res in db.engine.execute( | |
"select relname from pg_class where relkind='S';" | |
) | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from invenio_oaiharvester.models import OAIHarvestConfig | |
new_conf = OAIHarvestConfig( | |
name='pos', | |
metadataprefix='pos-ext_dc', | |
setspecs='', | |
baseurl='https://pos.sissa.it/cgi-bin/oai/oai-script-spires-extended.cgi', | |
) | |
from invenio_db import db | |
db.session.add(new_conf) | |
db.session.commit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import os | |
from invenio_db import db | |
from invenio_workflows import workflow_object_class, ObjectStatus, workflows | |
from inspirehep.modules.records.utils import open_url_or_path | |
SITE_NAME = 'labs.inspirehep.net' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from invenio_db import db | |
from invenio_workflows import workflow_object_class, ObjectStatus, workflows | |
def has_name(task, task_name): | |
return ' ' + task_name + ' ' in str(task) | |
def get_task_index(workflow, task_name): | |
if callable(workflow): | |
if has_name(workflow, task_name): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from invenio_db import db | |
def get_indexes_info(): | |
return list(db.engine.execute(''' | |
SELECT | |
pg_class.relname, | |
pg_size_pretty(pg_class.reltuples::BIGINT) AS rows_in_bytes, | |
pg_class.reltuples AS num_rows, | |
COUNT(indexname) AS number_of_indexes, | |
CASE WHEN x.is_unique = 1 THEN 'Y' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This file has been auto-generated by i3-config-wizard(1). | |
# It will not be overwritten, so edit it as you like. | |
# | |
# Should you change your keyboard layout some time, delete | |
# this file and re-run i3-config-wizard(1). | |
# | |
# i3 config file (v4) | |
# | |
# Please see http://i3wm.org/docs/userguide.html for a complete reference! |
OlderNewer