Skip to content

Instantly share code, notes, and snippets.

View philmikejones's full-sized avatar

Phil Mike Jones philmikejones

View GitHub Profile
@philmikejones
philmikejones / .Renviron
Last active February 22, 2022 11:04
R environment settings to use a local directory for the library - useful for reproducibility and isolating packages
R_LIBS_USER=venv/library
@philmikejones
philmikejones / install-r2mlwin.R
Last active February 2, 2019 16:25
Install R2MLwiN (and rbugs)
# Install R2MLwiN (and rbugs - a dependency that's also archived on CRAN)
# You need MLwiN (Windows) or mlnscript (Linux/Mac) to use MLwiN from R
# Download these from (respectively):
# - https://www.bristol.ac.uk/cmm/software/mlwin/
# - https://www.cmm.bris.ac.uk/clients/softwaredownload/
# You may need to install additional dependencies
# If that's the case you'll get an error when you run this script
# that lists missing dependencies
@philmikejones
philmikejones / image-layout.py
Created August 30, 2018 15:14
Layout multiple images onto one canvas with Python pillow
## Pastes Lexis surface diagrams and HAPC plots together
import os
import glob
from subprocess import call
from PIL import Image, ImageDraw, ImageFont
# Get country code list
countries = glob.glob("mort_*.png")
countries = sorted(countries)
@philmikejones
philmikejones / globe_projection_processing_qgis.py
Last active July 14, 2016 11:20
Process shapefiles projected as globe in QGIS.
# Material by Steven Bernard (https://youtu.be/rUShqJde2CA)
import numpy as np
from qgis.core import *
import qgis.utils
import sys, os, imp
import fTools
path = os.path.dirname(fTools.__file__)
ftu = imp.load_source('ftools_utils', os.path.join(path,'tools','ftools_utils.py'))
@philmikejones
philmikejones / nomis-list-databasets.sh
Last active August 29, 2015 14:23
jq script to query nomisweb API
#!/bin/bash
curl 'https://www.nomisweb.co.uk/api/v01/dataset/def.sdmx.json' | \
jq '.[]["keyfamilies"]["keyfamily"][] | {id: .id, description: .description.value, name: .name.value}' \
> nomisweb-datasets.txt