Skip to content

Instantly share code, notes, and snippets.

View J535D165's full-sized avatar

Jonathan de Bruin J535D165

View GitHub Profile
@J535D165
J535D165 / tasks.json
Last active March 22, 2024 09:46
Start ASReview LAB development environment
{
"version": "2.0.0",
"tasks": [
{
"label": "startBackendServer",
"type": "shell",
"command": "${command:python.interpreterPath}",
"args": ["-m",
"flask",
"run",
@J535D165
J535D165 / keyword_abstract_ris.py
Created October 26, 2022 13:58
Add keywords to the abstract field of a RIS file
import rispy
entries_new = []
with open('test.ris', 'r') as bibliography_file_in:
entries = rispy.load(bibliography_file_in)
for entry in entries:
entry_new = entry.copy()
if "keywords" in entry:
@J535D165
J535D165 / url_from_doi.py
Created August 10, 2022 12:30
Resolve the URL of the DOI
import requests
def get_url_from_doi(doi):
"""Get the url from the DOI.
Arguments
---------
doi: str
The DOI to find the url for.
@J535D165
J535D165 / datapublisher_from_doi.py
Last active August 10, 2022 13:37
Get the publisher (or any variables) from a DOI via DataCite
import xml.etree.ElementTree as ET
import requests
# curl -LH "Accept: application/vnd.datacite.datacite+xml" https://doi.org/10.34894/KEIQRD
def get_datapublisher_from_doi(doi):
"""Get the publisher from the DOI.
Arguments
@J535D165
J535D165 / run_asreview_simulations_v0.sh
Last active May 22, 2022 15:05
Run simulations with ASReview LAB v0 and v1 with different models
DATASET="van_de_schoot_2017"
QUERY_STRATEGIES=('max_random' 'max_uncertainty' 'max' 'uncertainty' 'random')
# ('max_random' 'max_uncertainty' 'max' 'uncertainty' 'random' 'cluster')
for qs in "${QUERY_STRATEGIES[@]}"
do
asreview simulate benchmark:${DATASET} -q $qs --seed 535 --init_seed 535 -s ${DATASET}_${qs}.h5
asreview plot recall ${DATASET}_${qs}.h5 -o ${DATASET}_${qs}_recall.png
@J535D165
J535D165 / gitignore.md
Last active July 28, 2020 08:54
Git clean repo with respect to gitignore

Clean repo with respect to .gitignore file:

git rm -r --cached .
git add . 
git commit -m "Clean with respect to .gitignore"

Configure a global .gitignore file:

git config --global core.excludesfile ~/.gitignore_global
@J535D165
J535D165 / flickr_download.py
Created January 26, 2020 21:23
Simple Python3 script to download all your photos from your Flickr profile
"""Flickr photo downloader.
Get credentials for the Flickr API from
https://github.com/alexis-mignon/python-flickr-api/wiki/Flickr-API-Keys-and-Authentication
# a = flickr_api.auth.AuthHandler()
# perms = "read" # set the required permissions
# url = a.get_authorization_url(perms)
# <rsp stat="ok">
@J535D165
J535D165 / release.sh
Last active October 21, 2019 11:21
Build a release of the latest software version
echo "Give a new version number (without v prefix)"
read version_tag
# create git tag
git tag -a "v${version_tag}" -m "Version ${version_tag}"
git push origin --tags
# reader pdf from markdown README.
pandoc README.md -o README.pdf
@J535D165
J535D165 / jupyter_notebook_w_nohup.md
Created August 12, 2019 12:22 — forked from 33eyes/jupyter_notebook_w_nohup.md
Jupyter notebook with nohup

Running jupyter notebook with nohup

This is helpful when running jupyter notebook on remote server (AWS) and tunneling into it, because with nohup the notebook process continues to run on the server even if you get disconnected from it (any running notebook code continues to run on the server without interruption, and just needs to be re-tunneled into).

Start jupyter notebook on remote server

In the remote server terminal, run:

nohup jupyter notebook &amp;
@J535D165
J535D165 / .gitconfig
Last active November 11, 2019 08:01
Git alias configuration
[alias]
st = status
cm = commit -m
co = checkout
master = checkout master
br = branch
branches = branch -a
remote-tags = ls-remote --tags origin