Skip to content

Instantly share code, notes, and snippets.

@tomdyson
tomdyson / restart-audio.sh
Created July 31, 2021 09:08
restart macOS audio drivers
sudo launchctl stop com.apple.audio.coreaudiod && sudo launchctl start com.apple.audio.coreaudiod
[
{"url": "https://www.jpl.nasa.gov/news/news.php?feature=7638", "title": "NASA's Curiosity Keeps Rolling As Team Operates Rover From Home", "introduction": "The Mars mission has learned to meet new challenges while working remotely.", "updated_at": "2020-04-14 12:04:00", "paras": ["<p>For people who are able to work remotely during this time of social distancing, video conferences and emails have helped bridge the gap. The same holds true for the team behind NASA's Curiosity Mars rover. They're dealing with the same challenges of so many remote workers - quieting the dog, sharing space with partners and family, remembering to step away from the desk from time to time - but with a twist: They're operating on Mars.</p>", "<p></p>", "<p>On March 20, 2020, nobody on the team was present at NASA's Jet Propulsion Laboratory in Southern California, where the mission is based. It was the first time the rover's operations were planned while the team was completely remote. Two days later, the commands they had sent to
[
{"name": "Abalone", "image": false, "rating_description": "one", "rating_image": "/images/MCS_GoodFishGuide_Rating_01_01_1.svg", "latin_name": "Haliotis discus hannai; Haliotis tuberculata", "description": "Abalone (called ormer in France and elsewhere) are molluscs, belonging to a group of animals known as gastropods (the same group as whelks). Abalone can be farmed on land in aquaculture systems that are enclosed, referred to as \"recirculating systems\", which means that all water and waste are contained. Abalone graze on seaweeds. As there are no environmental interactions and no depletion of resources for food this makes abalone a really sustainable seafood choice. Abalone can be farmed on land in aquaculture systems that are enclosed, referred to as \"recirculating systems\", which means that all water and waste are contained. Abalone graze on seaweeds for food. As there are no environmental interactions and no depletion of resources for food this makes abalone a really sustainable seafood choice."},
@tomdyson
tomdyson / wagtail-import-data.md
Last active May 7, 2024 12:35
Create 35k Wagtail pages of Wikipedia film plots

Create Wagtail pages programmatically

This short recipe demonstrates how to create Wagtail pages programmatically. It may also be useful for testing Wagtail development against a reasonable volume of page data (about 35,000 film plots, from English Wikipedia).

Instructions

In a virtualenv:

@tomdyson
tomdyson / wagtail-zappa-rds.md
Last active May 29, 2019 14:49
Wagtail on Lambda with RDS

Wagtail on AWS Lambda, with Zappa and RDS

Install Wagtail and Zappa, and create an empty site:

pip install wagtail zappa zappa-django-utils
pip install pip==9.0.3 # see https://github.com/Miserlou/Zappa/issues/1471
wagtail start zappa_rds
@tomdyson
tomdyson / wagtail-on-zappa.md
Last active June 20, 2023 02:22
Wagtail on AWS Lambda, with Zappa

Wagtail on AWS Lambda, with Zappa

Install Wagtail and Zappa, and create an empty site:

pip install wagtail zappa zappa-django-utils
pip install pip==9.0.3 # see https://github.com/Miserlou/Zappa/issues/1471
wagtail start foo
@tomdyson
tomdyson / wagtaildemo-on-ubuntu-1404.sh
Created December 14, 2015 16:40
wagtaildemo-on-ubuntu-1404
sudo apt-get install python-pip git python-dev python-setuptools
sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev
sudo apt-get install liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk
sudo apt-get install libpq-dev python-dev
sudo apt-get install postgresql postgresql-contrib
git clone https://github.com/torchbox/wagtaildemo.git
cd wagtaildemo
sudo pip install -r requirements.txt
vim wagtaildemo/settings/base.py # change DATABASES to 'django.db.backends.sqlite3'
./manage.py migrate

Keybase proof

I hereby claim:

  • I am tomdyson on github.
  • I am tomd (https://keybase.io/tomd) on keybase.
  • I have a public key whose fingerprint is B6AB B406 56B8 3C5D 8ADB 3F0F 436E B3AD 8E76 A467

To claim this, I am signing this object:

@tomdyson
tomdyson / getting-started-with-wagtail.md
Last active November 12, 2020 05:47
Getting started with Wagtail

Wagtail tutorial

Thanks to [Serafeim Papastefanos] for authoring this tutorial. Please note that the installation process is in flux; most of the steps here should soon be unnecessary.

[Wagtail] is a new Open Source [Django]-based CMS. In this 20 minute tutorial we will see how you can create a blog from scratch using Wagtail. If you want to see some more examples of usage please take a look at the [wagtaildemo] GitHub project.

To follow this tutorial you will need to have [Python] 2.7 installed with a working version of [pip] and [virtualenv].

Installing the wagtail dependencies

@tomdyson
tomdyson / extracted_favicons.py
Created September 27, 2013 14:55
favicons with extracted colours
from colorific import extract_colors
from django_rq import job
from PIL import Image as Im
from PIL import ImageChops, ImageDraw
@job
def populate_colours(photo_id):
from models import Colour, Photo
# remove any existing colours
photo = Photo.objects.get(id=photo_id)