Skip to content

Instantly share code, notes, and snippets.

View brandones's full-sized avatar

Brandon Istenes brandones

View GitHub Profile
@brandones
brandones / bib_rename.py
Created December 12, 2024 17:13
A gist to rename Markdown files from their Zotero PDF filenames to their citekey (and embed some metadata)
import bibtexparser
import pandas as pd
from pathlib import Path
import os
import re
from datetime import datetime
import yaml
def load_bibtex(bib_path):
"""Load bibtex file and convert to DataFrame."""
@brandones
brandones / update-translations.yml
Created September 1, 2021 21:13
GitHub Action to download translations from Transifex
name: Update translation files from Transifex
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
build:
@brandones
brandones / link-order.json
Created May 20, 2021 16:17
Config needed for openmrs-spa as temporary solution for ordering links
@brandones
brandones / schema.ts
Last active December 16, 2020 21:21
Config schema for esm-patient-registration
import { Type, validator, validators } from '@openmrs/esm-module-config';
const builtInFields = ['name', 'gender', 'dob', 'address', 'id', 'death']
export const schema = {
sections: {
_type: Type.Array,
_default: ['demographics', 'contact', 'ids', 'death'],
_description: "An array of strings which are the keys from 'sectionDefinitions'",
_elements: {
@brandones
brandones / remove_untranslated.py
Created May 5, 2020 22:57
Remove strings matching the english string from a messages_LL.properties file
#!/usr/bin/env python3
import argparse
import re
def main(lang):
en_strings = properties_to_dict(read_file("en"))
t_strings = properties_to_dict(read_file(lang))
translated = {k: t_strings[k] for k in t_strings if en_strings[k] != t_strings[k]}
@brandones
brandones / array-config.js
Last active November 7, 2019 21:16
Arrays in OpenMRS MF Configurations
// Example 1: Array of primitives
// input
foo: [2, 42, 99]
// schema
{
foo: {
default: [1, 1, 2, 3],
arrayElements: {
Example config:
foo: {
bar: 0,
baz: {
qux: "abc",
quy: "xyz"
}
}
@brandones
brandones / append_roxygen_script_doc_to_readme.sh
Created March 1, 2019 18:09
Appends Roxygen @Package docstring to README.md
#!/bin/bash
#
# Extracts the Roxygen package documentation from each script file in the
# package root directory and appends it to README.md
#
# Documentation that you want included should start on the second line of the script
OUTFILE="README.md"
r_files=( *.R )
@brandones
brandones / odrive-sync.sh
Created November 9, 2018 18:13
Nautilus context menu sync with ODrive
#!/bin/bash
# Put this file in ~/.local/share/nautilus/scripts/
# Remember to `chmod +x` it
IFS='
'
for file in ${NAUTILUS_SCRIPT_SELECTED_FILE_PATHS}
do
if [[ $file == *.cloud ]] || [[ $file == *.cloudf ]]
then
@brandones
brandones / dbexport.py
Created August 14, 2018 22:01
Jython: use Jackcess all the tables from a password-protected MS Access database to CSV
#! /usr/bin/env jython
#
# Based on https://gist.github.com/shapr/507bcbf3e8cfdc5d3549
#
# Install prereqs:
# sudo apt-get install jython libcommons-logging-java libcommons-lang-java
#
# Put the following jars into the same directory as this file:
# jackcess: https://sourceforge.net/projects/jackcess/files/
# jackcess-encrypt: https://sourceforge.net/projects/jackcessencrypt/files/