Skip to content

Instantly share code, notes, and snippets.

View slint's full-sized avatar

Alex Ioannidis slint

View GitHub Profile
@slint
slint / test.py
Last active March 10, 2017 16:34
test gist
Traceback (most recent call last):
File "/Users/lnielsen/envs/ils/lib/python3.6/site-packages/invenio_pidstore/models.py", line 579, in next
db.session.add(obj)
File "/Users/lnielsen/envs/ils/lib/python3.6/site-packages/sqlalchemy/orm/session.py", line 567, in __exit__
self.rollback()
File "/Users/lnielsen/envs/ils/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py", line 60, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/Users/lnielsen/envs/ils/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 187, in reraise
raise value
@slint
slint / zenodo_example.py
Created April 10, 2017 09:16
Zenodo Search Request Example
import requests
records_api_url = 'https://zenodo.org/api/records'
search_query = 'type:dataset AND creators.affiliation:("University A" OR "Cambridge")'
res = requests.get(records_api_url, params={'q': search_query, 'size': 100, 'page': 1})
# <Response [200]>
res.json()
# { ...JSON response containing search results... }
res.links
# { 'next': 'https://zenodo.org/api/records?q=...&size=100&page=2', ... }

Keybase proof

I hereby claim:

  • I am slint on github.
  • I am slint (https://keybase.io/slint) on keybase.
  • I have a public key whose fingerprint is 5CEA 89A5 F86F B946 C490 8478 F4B3 BE9C 3F20 9D40

To claim this, I am signing this object:

import requests
params = {'access_token': '<your-access-token>'}
# Create the deposit resource
url = "https://sandbox.zenodo.org/api/deposit/depositions"
headers = {"Content-Type": "application/json"}
res = requests.post(
url,
def profile(f):
@wraps(f)
def decorated(*args, **kwargs):
profiler = Profile()
result = None
try:
result = profiler.runcall(f, *args, **kwargs)
finally:
stats = pstats.Stats(profiler)
stats.sort_stats('cumtime').print_stats(200)
with open(config.get_deposition_file()) as f:
deposition_id = f.read()
# create a new deposition version with different deposition_id from the existing deposition
r = requests.post(config.url + '/api/deposit/depositions/' + deposition_id + '/actions/newversion',
params={'access_token': config.access_token})
# You have to use the new version's deposit link
newversion_draft_url = r.json()['links']['latest_draft']
@slint
slint / overview.md
Last active February 26, 2018 15:57
JS Hackathon Overview
#!/bin/bash
# TODO: Parse arguments...
GITLAB_PIPELINE_TRIGGER_URL=https://gitlab.cern.ch/api/v4/projects/33605/trigger/pipeline
SERVICE_NAME=asclepias
if [ ! -z $BRANCH_NAME ]; then
# run commands to checkout a branch
echo "Checkout branch ${BRANCH_NAME}"
git checkout $BRANCH_NAME;
{
"date_detection": false,
"numeric_detection": false,
"properties": {
"$schema": {
"type": "string",
"index": "not_analyzed"
},
"grants": {
"type": "object",
@slint
slint / sushi-swagger.json
Created July 23, 2018 09:44
SUSHI-Lite Swagger Schema
{
"swagger": "2.0",
"info": {
"title": "COUNTER_SUSHI-Lite API",
"description": "The COUNTER_SUSHI-Lite API represents a RESTful implementation of SUSHI automation intended to returns COUNTER reports and snippets of COUNTER usage in JSON format",
"termsOfService": "",
"contact": {
"name": "NISO SUSHI Standing Committee",
"url": "http://www.niso.com/workrooms/sushi",
"email": "nisohq@niso.com"