Skip to content

Instantly share code, notes, and snippets.

View mcantelon's full-sized avatar

Mike Cantelon mcantelon

View GitHub Profile
cd ~/delete_index
python del.py
mapping = {
"_default_" : {
"type": "string"
}
}
conn.put_mapping("aip", {"_all" : {"enabled" : True}, "properties": mapping}, ["aips"])
@mcantelon
mcantelon / elasticSearchIndexProcessAIP.py
Created August 24, 2012 21:14
elasticSearchIndexProcessAIP.py
#!/usr/bin/python -OO
# This file is part of Archivematica.
#
# Copyright 2010-2011 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
@mcantelon
mcantelon / elasticSearchIndexProcessTransfer.py
Created August 24, 2012 21:16
elasticSearchIndexProcessTransfer.py
#!/usr/bin/python -OO
# This file is part of Archivematica.
#
# Copyright 2010-2011 Artefactual Systems Inc. <http://artefactual.com>
#
# Archivematica is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
@mcantelon
mcantelon / es-rebuild
Created August 28, 2012 01:09
es-rebuild
#!/usr/bin/env python
import sys, MySQLdb, cPickle, base64
sys.path.append("/usr/lib/archivematica/archivematicaCommon")
import databaseInterface
sys.path.append("/usr/lib/archivematica/archivematicaCommon/externals")
import pyes
def index_documents_from_database(index, type):
indexed = 0
@mcantelon
mcantelon / gist:3990484
Created October 31, 2012 22:54
Check if index exists
conn = pyes.ES('127.0.0.1:9200')
indexes = conn.get_indices()
if 'fpr_file' not in indexes:
# Grab relevant FPR data from the DB
results = get_fpr_table()
# Setup indexing for some Elastic Search action.
for row in results:
conn.index(row, 'fpr_file', 'fpr_files')
1) Use one of the task files as guidance… for example:
lib/task/import/csvAuthorityRecordImportTask.class.php
2) Some code to create a repo:
<?php
$repo = new QubitRepository();
$repo->authorizedFormOfName = 'My Repository';
Part I
1. Why the Web needs Node
2. Getting started with Node
3. Asynchronous programming
Part II
4. Building Node web applications
5. Storing Node application data
@mcantelon
mcantelon / sword-diag.py
Created February 26, 2013 00:20
Diagnose Qubit-SWORD issus
sudo apt-get install curl
curl https://raw.github.com/artefactual/archivematica/master/src/archivematicaCommon/lib/utilities/sword-diagnose.py | python
@mcantelon
mcantelon / gist:5094314
Last active December 14, 2015 13:38
Django dynamic form:
forms.py:
class ProcessingForm(forms.Form):
def __init__(self, *args, **kwargs):
if 'extra' in kwargs:
extra = kwargs.pop('extra')
super(ProcessingForm, self).__init__(*args, **kwargs)
if 'extra' in locals():
for i, question in enumerate(extra):