Skip to content

Instantly share code, notes, and snippets.

View ghukill's full-sized avatar

Graham Hukill ghukill

  • MIT Libraries
View GitHub Profile
{
"users": [
{
"first_name": "archana",
"last_name": "monika",
"email": "noreply@uptogether.org",
"role": null,
"metadata": {
"zipcode": 64512
},
@ghukill
ghukill / dot_notation_from_dict.py
Created August 16, 2020 13:57
dot notation object from python dict via NamedTuple
"""
amazing little snippet to convert dictionary into dot notation object
"""
from collections import namedtuple
import json
# original dictionary
goober = {'zebra': True, 'tronic': {'important_number': 42}}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ghukill
ghukill / loadenv
Created August 7, 2019 15:59
Load envars from a key=value file
echo "loading env vars from: $1"
export $(grep -v '^#' $1 | xargs)
echo "all done!"
# pairtree example
├── 0=ocfl_1.0
├── 1=my_uuid_quad_tree_spec
├── 6ba7
└── b810
└── 9dad
└── 11d1
└── 80b4
└── 00c0
└── 4fd4
@ghukill
ghukill / sibling_distribution.py
Created November 25, 2018 19:26
sibling hash field distribution
sibling_field_dist = {'mods|mods(6adf01)___mods|abstract(97c301)': 150,
'mods|mods(6adf01)___mods|accessCondition(97c301)___@type=use and reproduction': 655,
'mods|mods(6adf01)___mods|language(97c301)___mods|languageTerm(548f01)___@type=code': 655,
'mods|mods(6adf01)___mods|location(97c301)___mods|url(6adf02)___@usage=primary': 26,
'mods|mods(6adf01)___mods|location(97c301)___mods|url(6adf03)___@access=preview': 26,
'mods|mods(6adf01)___mods|location(97c301)___mods|url(6adf04)___@usage=primary': 91,
'mods|mods(6adf01)___mods|location(97c301)___mods|url(6adf05)___@access=preview': 91,
'mods|mods(6adf01)___mods|location(97c301)___mods|url(6adf05)___@usage=primary': 78,
'mods|mods(6adf01)___mods|location(97c301)___mods|url(6adf06)___@access=preview': 78,
'mods|mods(6adf01)___mods|location(97c301)___mods|url(6adf06)___@usage=primary': 61,
@ghukill
ghukill / Vagrantfile
Last active August 31, 2018 17:05
Ubuntu 18.04 Vagrantfile
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.hostname = "myamazingmachine"
config.vm.box = "bento/ubuntu-18.04"
config.vm.provider "virtualbox" do |vb|
@ghukill
ghukill / gist:6f2ae673c0b02ef9d2a136cb22a9d800
Last active April 11, 2018 14:06
markdown to reStructuredText (RST) regex
\[(.+?)\]\((.+?)\)
`\1 <\2>`_
def funFunction():
print('hey!')
@ghukill
ghukill / combine_django_db_boostrap.json
Last active February 12, 2018 17:41
Combine Bootstrap
[
{
"model": "core.oaiendpoint",
"pk": 1,
"fields": {
"name": "Wayne Ouroboros",
"endpoint": "http://digital.library.wayne.edu/api/oai",
"verb": "ListRecords",
"metadataPrefix": "mods",
"scope_type": "setList",