Skip to content

Instantly share code, notes, and snippets.

@cd060
cd060 / find files
Created October 30, 2025 10:31
Function for finding files with a specific name pattern in directories and sub directories
def find_files(base, end_pattern, sub_name=None):
'''
Searches for files with a specific name pattern
in directories and subdirectories
params:
base : str
strat directory
end_pattern : list
list of strings, patterns to find filenames
sub_name : str
@cd060
cd060 / text_to_en.py
Last active March 6, 2024 21:10
translates strings to english
import googletrans
from googletrans import *
def text_to_en(text):
translator = googletrans.Translator()
translation = translator.translate(text, dest='en')
return translation.text
@cd060
cd060 / getGNDidFromVIAF.py
Created March 6, 2024 09:54
takes a VIAF ID as argument and returns the link to GND dataset
import requests
import json
def get_gnd_from_viaf(viafid):
url = f'https://www.viaf.org/viaf/{viafid}/viaf.jsonld'
response = requests.get(url)
if response.status_code == 200:
data = response.json()