Skip to content

Instantly share code, notes, and snippets.

View mrchrisadams's full-sized avatar

Chris Adams mrchrisadams

View GitHub Profile
@mrchrisadams
mrchrisadams / pip-virtual-versions-in-a-new-shell.sh
Created April 7, 2017 13:06
why do I keep getting old and busted pip and setuptools versions?
$ which pip
# /usr/local/bin/pip
$ which virtualenv
#/usr/local/bin/virtualenv
$ pip --version
# pip 9.0.1 from /usr/local/lib/python2.7/site-packages (python 2.7)
$ virtualenv --version
# 1.11.6
@mrchrisadams
mrchrisadams / after_updating_south.md
Last active March 10, 2017 10:39
Y U NO SEE TABLEZ IN DATABASE
-mptt 0.6.  Explicitly define a TreeManager() on your model to remove this warning.
  DeprecationWarning

 - Soft matched migration 0037 to 0037_auto__del_pagemoderator__del_field_globalpagepermission_can_moderate__.
Running migrations for cms:
 - Migrating forwards to 0037_auto__del_pagemoderator__del_field_globalpagepermission_can_moderate__.
 > cms:0037_auto__del_pagemoderator__del_field_globalpagepermission_can_moderate__
FATAL ERROR - The following SQL query failed: DROP TABLE "cms_pagemoderator" CASCADE;
The error was: table "cms_pagemoderator" does not exist
@mrchrisadams
mrchrisadams / settings.py
Last active February 21, 2017 00:04
Messing around and using AWS Lambda wrong. These are the settings I got working in the end. I'm tired, and almost definitely using Whitenoise wrong
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
# new
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
2016-11-13T23:33:59.424570+00:00 heroku[router]: at=info method=GET path="/" host=website-prod.herokuapp.com request_id=367ab598-58ee-477d-a479-ea184c53e00f fwd="95.90.242.216" dyno=web.1 connect=1ms service=49ms status=500 bytes=24
DisallowedHost: Invalid HTTP_HOST header: 'website-prod.herokuapp.com'. You may need to add u'website-prod.herokuapp.com' to ALLOWED_HOSTS.
@mrchrisadams
mrchrisadams / amee and a npm for enviromental data.md
Last active October 4, 2016 11:46
I'm giving a talk later this week at a Dat Meetup, so I figured I'd dump this here, get some feedback then put together a deck for Thursday, once I've had a chance to think it over.

Making sense of the AMEE platform and an npm for scientific models

Hi folks.

I'm going to try sharing my understanding of how the AMEE platform works, because I'm giving a talk about this subject later in the week, at this event, where a load of open data and javascript geeks will be, and i figured that might be interested in it.

Anatomy of a calculation on the AMEE platform

Let's says I want to see the impact dairy cows have on the environment:

@mrchrisadams
mrchrisadams / funcs_for_importing_images_as_wagtail_images.py
Created August 29, 2016 09:51
A few functions I've used for importing photos that were previously in a huge mess of nested folders
#!/usr/bin/env python
import os
from django.conf import settings
from django.core.files.images import ImageFile
from wagtail.wagtailimages.models import Image as WagtailImage
import dimensions
import glob2
@mrchrisadams
mrchrisadams / orielly-info-arch-book-review.md
Created February 11, 2016 09:16
reviewing the polarbear book

I've just finished the book.

It's generally seen as the authoritative text on what information architecture is - it's been around since the 90's and this is the most recent edition released in October, and while it's still fresh in my mind, I figured it's worth sharing some notes

### Who is it good for?

If you have any interest in the tools, the techniques and the deliverables that existing firms use to "do IA" for larger corporate clients, you'll come away learning lots here. There are lots of good examples of different variations of sitemaps, content models, controlled vocabularies, wireframes, and the processes you might follow are also outlined in detail - in fact, this book ends up feeling like the closest thing to an authoritative, 'this is how the industry does it' reference for both information architecture, but also for elements of UX and content strategy.

That said, while it definitely feels like a secondary audience, there is enough coverage about the general principles going into this for you

Talk description

Working out the footprint of the internet, and moving to greener clouds

IT's share of global CO2 emissions is growing faster than aviation, and showing no signs of slowing down. If we want a more planet friendly web, we need understanding where the emissions are happening in our current use before we know where can make changes.

Abstract

After providing a brief background on the subject, we'll map out the supply chain involved in delivering the world wide web to a user's browser, from devices, to data centres, to the infrastructure that provides them.

@mrchrisadams
mrchrisadams / bad.yml
Last active January 26, 2016 17:26
Getting pointers on updating a deploy role for ansible
- name: add deploy key for deploy user, if there is one
copy: >
src={{ deploy_user_ssh_priv_key_path }}
dest=/home/{{ deploy_user_name }}/.ssh/deploy
mode=600
owner={{ deploy_user_name}}
group={{ deploy_user_name }}
sudo: yes
when: deploy_user_ssh_priv_key_path
@mrchrisadams
mrchrisadams / error.txt
Last active January 10, 2016 22:01
Why would `mysql_root_password` not be defined here? As far as I can tell, I'm following the ansible var discovery rules
ansible-playbook -i inventories/production ./playbooks/wordpress.yml ⏎ witan-jupyter ✖ ✱ ◼
PLAY [wordpress] **************************************************************
GATHERING FACTS ***************************************************************
ok: [ricotta-prod-01]
TASK: [productscience.common | install editors and shells] ********************
ok: [ricotta-prod-01] => (item=vim,zsh,htop,iotop,git,subversion)