Skip to content

Instantly share code, notes, and snippets.

@kiri-thornalley
kiri-thornalley / keywords.py
Created June 24, 2025 12:43
Assign keywords for papers through named entity recognition
from datetime import datetime, timedelta
import requests
import spacy
import scispacy
from scispacy.linking import EntityLinker
# Load the NLP model. Smaller, therefore faster, but potentially at the expense of accuracy
nlp = spacy.load("en_core_sci_sm")
# Add the EntityLinker - map entities to those found in MeSH.
@kiri-thornalley
kiri-thornalley / animation.py
Created May 6, 2025 09:21
Figure to animated gif
import imageio.v2 as imageio
import os
import cv2
# Load and sort PNG files
image_folder = "path/to/image/folder"
images = sorted([os.path.join(image_folder, file) for file in os.listdir(image_folder) if file.endswith(".png")])
# Read the first image to get dimensions
first_image = cv2.imread(images[0])
@kiri-thornalley
kiri-thornalley / .bashrc
Last active May 4, 2025 14:06 — forked from bashbunni/.zshrc
CLI Pomodoro for Linux (modified for WSL2 on Windows 10)
# Requires https://github.com/caarlos0/timer to be installed.
# Requires Burnt Toast to be installed in Powershell. (https://github.com/Windos/BurntToast/tree/main)
# Modifcations from original gist (https://gist.github.com/bashbunni/3880e4194e3f800c4c494de286ebc1d7) by @bashbunni
# 1. spd-say removed and replaced with Burnt Toast for pop-up and audio notifications via Powershell.
# 2. Original pomodoro() function replaced with one that loops between work block and long/short break.
declare -A pomo_options
pomo_options["work"]="50"
pomo_options["break"]="10"