Skip to content

Instantly share code, notes, and snippets.

View jalavik's full-sized avatar

Jan Åge Lavik jalavik

  • BankID BankAxept AS
  • Bergen, Norway
View GitHub Profile
@jalavik
jalavik / 0_reuse_code.js
Created July 8, 2016 08:51
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
@jalavik
jalavik / workflow_sample.py
Created March 30, 2015 14:17
workflow sample in Celery
"""
Install deps:
$ pip install workflow
$ pip install celery[redis]
Run worker to listen to jobs:
$ cd path/to/this/file/
$ celery -A workflow_sample worker --loglevel=info
@jalavik
jalavik / pos_example.xml
Created January 29, 2015 12:47
PoS example in format pos-ext_dc
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd">
<responseDate>2015-01-29T13:44:13Z</responseDate>
<request verb="ListRecords" metadataPrefix="pos-ext_dc" set="conference:LATTICE 2013">
http://pos.sissa.it/cgi-bin/oai/oai-script-spires-extended.cgi
</request>
<ListRecords>
<record>
<header>
<identifier>oai:pos.sissa.it:LATTICE 2013/001</identifier>
@jalavik
jalavik / api_games.py
Created August 1, 2014 09:37
Playing with INSPIRE API
from invenio.invenio_connector import InvenioConnector
# 1. Connect to INSPIRE testing node
inspire = InvenioConnector(url="http://inspireheptest.cern.ch")
# 2. Do a search which returns a list of ids with the phrase "ellis"
res = inspire.search(p="ellis", of="intbitset")
# We asked for an intbitset, which is a comes over the wire as
# binary format - which means we convert it back to a proper intbitset
@jalavik
jalavik / match_on_recid.py
Last active August 29, 2015 14:04
How to match incoming records on recid in 035
def attempt_record_match(recid):
""" Tries to find out if the record is already in Inspire """
return perform_request_search(p="035:CDS and 035:%s" % (recid,), of="id")
for record in records:
# Step 1: Attempt to match the record to those already in Inspire
try:
recid = record['001'][0][3]
res = attempt_record_match(recid)
@jalavik
jalavik / reinstall_inspire_fabric_invenio_v1
Created May 16, 2014 11:15
Reinstalling an INSPIRE instance with fabric (only Invenio v.1.x)
cd ~/src
git clone lxplus.cern.ch:/afs/cern.ch/project/inspire/repo/inspire-scripts.git
cd inspire-scripts
fab test makeinstall:myopsbranch,myinspirebranch -k
@jalavik
jalavik / inspire_reset_test_ui
Created May 16, 2014 11:07
How to reset TEST UI on INSPIRE with Invenio v.1.x
ssh inspirevm06
cd /path/to/inspire/sources
git checkout master
git pull origin master
sudo -u apache make reset-test-ui
sudo service httpd restart
@jalavik
jalavik / inveniomanage_collect
Created May 15, 2014 11:31
Error output after inveniomanage collect
This file has been truncated, but you can view the full file.
Collect static from blueprints
apple-touch-icon-72-precomposed.png is already present!
apple-touch-icon-144-precomposed.png is already present!
favicon.ico is already present!
apple-touch-icon-57-precomposed.png is already present!
apple-touch-icon-114-precomposed.png is already present!
css/mejs-invenio.css is already present!
css/base.css is already present!
css/bootstrap-tagsinput.css is already present!
css/token-input-facebook.css is already present!
@jalavik
jalavik / unicode_to_latex.py
Created May 17, 2011 11:04 — forked from beniwohli/unicode_to_latex.py
Map to convert unicode characters to their respective LaTeX representation
# original XML at http://www.w3.org/Math/characters/unicode.xml
# XSL for conversion: https://gist.github.com/798546
unicode_to_latex = {
u"\u0020": "\\space ",
u"\u0023": "\\#",
u"\u0024": "\\textdollar ",
u"\u0025": "\\%",
u"\u0026": "\\&amp;",