Skip to content

Instantly share code, notes, and snippets.

>>> for pkg in model.Session.query(model.Package).filter_by(state='active'): print pkg.name, '\t\t', ' '.join([t.name for t in pkg.get_tags()])
...
africa-powermining-projects-database mining power sub-saharan africa
africa-the-electicity-supply-system Africa Electricity OSeMOSYS
biomass-per-district-2002 Biomass District Uganda
bla
cameroon-hydro-power-projects hydro power plant
climatescope-mapping-the-global-frontiers-for-clean-energy-investment-2016 renewable energy
dar-es-salaam-raw
demand-for-distributed-renewable-energy-generation-in-pakistan distributed renewable energy iesco islamabad pakistan solar tail-ended-grid
'''Load some test CSV using pgloader'''
import argparse
import subprocess
from pprint import pprint
import os.path
import sqlalchemy
import messytables

Keybase proof

I hereby claim:

  • I am davidread on github.
  • I am davidread (https://keybase.io/davidread) on keybase.
  • I have a public key ASCLfxHooMvjCtVRSqJRX7n4AQOgYplbm4wzd_JNMCnI7wo

To claim this, I am signing this object:

@davidread
davidread / Dockerfile
Created February 20, 2018 14:59
Jupyter dockerfile
FROM jupyter/datascience-notebook
# Install Anaconda
#RUN conda install anaconda
# Install Jupyter Dashboard
#RUN pip install jupyter_dashboards
#RUN jupyter dashboards quick-setup --sys-prefix
#RUN jupyter nbextension enable jupyter_dashboards --py --sys-prefix
@davidread
davidread / container-start.sh
Created February 20, 2018 15:01
Jupyter container start
#!/usr/bin/env bash
set -ex
# NB_USER=$USER
# NB_UID=$USER_UID
# USER_UID=1001
# GROUP=staff
# # Add the $USER user
# useradd -g $GROUP -u $USER_UID -d /home/$USER $USER
@davidread
davidread / config.yaml
Last active April 25, 2018 15:32
zero-to-jupyterhub auth0 example config
auth:
type: custom
custom:
className: "oauthenticator.auth0.Auth0OAuthenticator"
config:
client_id: "3maZCyDXXXXXXXXXIDbz0W8A"
client_secret: "aMSobNMr0OkPjXXXXXXXXX7MdZkAcpL"
oauth_callback_url: "http://a172XXXX77d46cd-18XXXXX48.eu-west-1.elb.amazonaws.com/hub/oauth_callback"
scope:
- "openid"
Lots of stack traces and error messages for CKAN, followed by a comment about how I fixed it (that time).
NB don't email me privately for help - ask on StackOverflow #ckan instead.
David
File "/vagrant/src/ckan/ckan/templates/home/snippets/search.html", line 1, in top-level template code
{% set tags = h.get_facet_items_dict('tags', limit=3) %}
File "/vagrant/src/ckan/ckan/lib/helpers.py", line 949, in get_facet_items_dict
if not c.search_facets or \
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/werkzeug/local.py", line 347, in __getattr__
return getattr(self._get_current_object(), name)
@davidread
davidread / validator.diff
Created September 28, 2018 16:26
validator
diff --git a/ckan/lib/navl/validators.py b/ckan/lib/navl/validators.py
index 172da1531..b041d478e 100644
--- a/ckan/lib/navl/validators.py
+++ b/ckan/lib/navl/validators.py
@@ -4,7 +4,7 @@ from six import text_type
import ckan.lib.navl.dictization_functions as df
-from ckan.common import _, json
+from ckan.common import _, json, config
$ nosetests --ckan --with-pylons=test-core.ini ckan/tests/lib/test_helpers.py:TestBuildNavMain -x
No handlers could be found for logger "ckan.lib.uploader"
E
======================================================================
ERROR: ckan.tests.lib.test_helpers.TestBuildNavMain.test_dataset_navigation_legacy_routes
----------------------------------------------------------------------
Traceback (most recent call last):
File "/usr/lib/ckan/default/local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
self.test(*self.arg)
File "/vagrant/src/ckan/ckan/tests/lib/test_helpers.py", line 606, in test_dataset_navigation_legacy_routes
@davidread
davidread / gist:98a883005586db33b325c1bcb69f5be7
Created February 6, 2019 15:17
Git concepts & language
"working tree" = "repository"
"untracked files" - diff
"changes"
---- "add" --->
<--- "rm" ----
"Staged" = "Changes to be committed" = "index"
Similar: "indexed" "tracked files" "snapshot"