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 / 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
@vankesteren
vankesteren / utr_house.R
Last active November 22, 2021 12:51
Where do people living in Utrecht look for a house?
# load packages
library(tidyverse)
library(sf)
# read data
flow <- read_csv("https://data.mendeley.com/public-files/datasets/rtn8t47t6j/files/7f85a66d-a80d-4e3d-ada8-694a9c6e0a28/file_downloaded")
gem <- st_read("WFS:https://geodata.nationaalgeoregister.nl/wijkenbuurten2018/wfs?&request=GetCapabilities&service=WFS",
"wijkenbuurten2018:gemeenten2018")
# clean gemeente dataset
@lebrice
lebrice / arxiv_id_to_name.py
Last active September 13, 2023 06:55
A simple tool to add the name of downloaded paper pdf's in front of the id. Also removes duplicate downloads of the same arxiv paper.
"""A simple tool to add the name of downloaded paper pdf's in front of the id.
(Written by fabrice.normandin@gmail.com)
If there are multiple downloads of same paper, replaces the original with the
latest download. This can be useful in a downloads folder filled with copies.
For instance:
"""
import glob
@chrisjsimpson
chrisjsimpson / dms2dec.py
Created April 1, 2019 12:17 — forked from jeteon/dms2dec.py
Convert coordinates in DMS notation to decimal in Python.
#!/env/python
# coding=utf8
"""
Converting Degrees, Minutes, Seconds formatted coordinate strings to decimal.
Formula:
DEC = (DEG + (MIN * 1/60) + (SEC * 1/60 * 1/60))
Assumes S/W are negative.
@33eyes
33eyes / jupyter_notebook_w_nohup.md
Last active April 9, 2024 08:56
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;
@joelbecker
joelbecker / 2017-11-22-fusion-pullreq-usage.py
Last active November 26, 2017 20:56
A recordlinkage data fusion example.
from datetime import datetime
from random import randrange
import recordlinkage as rl
import recordlinkage.algorithms.conflict_resolution as cr
from recordlinkage.datasets import load_febrl4
dfA, dfB = load_febrl4()
# Adapt dataset for example
@inventionate
inventionate / install-r.sh
Last active August 31, 2023 18:27
Install R with OpenBLAS via Homebrew
# Stat Installation
# XCode CLT
xcode-select --install
# Update Homebrew
brew update
# Check for broken dependencies and/or outdated packages
brew doctor
@fgilio
fgilio / axios-catch-error.js
Last active April 11, 2024 19:02
Catch request errors with Axios
/*
* Handling Errors using async/await
* Has to be used inside an async function
*/
try {
const response = await axios.get('https://your.site/api/v1/bla/ble/bli');
// Success 🎉
console.log(response);
} catch (error) {
// Error 😨
@jakechen
jakechen / aws_jupyter_tunnel.md
Last active December 11, 2023 18:11
Creating and connecting to Jupyter Notebooks in AWS EC2

Introduction

This quick guide describes how to create a Jupyter Notebook in AWS EC2 then how to access it remotely using SSH tunneling. This method is preferred since you do not open any additional ports besides 22, requires little-to-no configuration, and is generally more straight-forward.

Pre-requisites

This current version assumes basic familiarity with cloud computing, AWS services, and Jupyter Notebook. Mostly because this version won't have images and won't dive too deep into each individual step.

Steps

Spin-up EC2 instance with "Deep Learning" AMI

  1. Log into EC2 console and click "Launch Instance" button.
  2. Inside "AWS Marketplace", select the "Deep Learning AMI" from AWS. I use this AMI because most of the stuff you'll need is installed already.