Skip to content

Instantly share code, notes, and snippets.

View alastair's full-sized avatar

Alastair Porter alastair

View GitHub Profile
services:
brainzutils:
build:
context: .
dockerfile: ./test/Dockerfile.py3
depends_on:
- redis
volumes:
- ./:/code
*** mb genre: acid house other genre electronic/acid house (100)
*** mb genre: acid jazz other genre electronic/acid jazz (100)
mb genre: acid rock other genre rock/hard rock (78)
mb genre: acid techno other genre electronic/dub techno (76)
mb genre: acoustic blues other genre blues/country blues (74)
mb genre: acoustic rock other genre rock/acoustic (76)
*** mb genre: afrobeat other genre jazz/afrobeat (100)
mb genre: alternative country other genre rock/alternative rock (74)
mb genre: alternative dance other genre rock/alternative rock (79)
mb genre: alternative folk other genre rock/alternative rock (88)
from django.db import models
class MyTable(models.Model):
field_one = models.CharField(max_length=5000, blank=True, null=False, default="")
field_one = models.IntegerField(default=0)
class Meta:
managed = False
---------
Listened (test) ['Green River', 'Band Aid 20', 'Emperor', 'Charlie Haden, Brad Mehldau, Jorge Rossey', 'Royal Blood', 'Black Stone Cherry', 'Jeff "Tain" Watts', 'My Bitter End', 'Swordmaster', 'Variety Lab', '28 Costumes', 'Funkadelic', 'Dave Holland Quintet', 'Damiera', 'Mazzy Star', 'Jefferson Airplane', 'Jamiroquai', 'Poster Children', 'Richie Kotzen', 'Ritchie Blackmore', 'The Twilight Singers', 'The Crowns', 'Reuben', 'Reverend Gary Davis', 'Desensitised', "Yo Mama's Big Fat Booty Band", 'Herod', 'Movimiento Original', 'Snot; Brandon Boyd', 'Mindrite', 'Robert Levon Been', 'Neurosonic', 'Anyk', 'DJ Perro', 'The Bravery', 'Dagoba', 'Glass Casket', 'Joan Jett', 'Angels & Airwaves', 'Train', 'Wake Me Up', 'So They Say', 'Rick Foster', 'Little Eva', 'Five Finger Death Punch', 'Sunn 0)))', 'Triosphere', 'Mark Hanson', 'Anthrax & Public Enemy', 'Dimension Zero', 'Bruce Springsteen', 'Threshold', 'Funny Talking Animals', 'October Falls', 'Tin Arnaldo, , Caetano Veloso', 'The Wombats', 'Edgar Cruz', 'M
@alastair
alastair / Classic rock.ipynb
Created February 14, 2018 16:07
Checking if people apply the 'classic rock' tag to newer music each year
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@alastair
alastair / newest to oldest
Last active June 23, 2017 14:22
last.fm incremental import
psuedo code - last.fm import js:
get last import date from server
for page in all_scrobbles:
store newest scrobble date in the list
send page
if earliest item in page < last import date:
stop submitting
submit 'last import date' to server, which is the date of the most recent scrobble (or now)

Common style mistakes

This section shouldn't act as a replacement for the style rules listed above in PEP-8, however it shows a number of common cases where care should be taken.

def myfunction(arga, argb=None):
    """ Function documentation. """     # Always use triple double-quotes for docstrings
    data = {                            # If a dictionary doesn't fit on one line, split like this
        "first": 1,                     # space after : but not before
This file has been truncated, but you can view the full file.
000009a8-34f1-4c58-a8de-1d99809cd626
00000baf-9215-483a-8900-93756eaf1cfc
00001284-534d-494e-9c46-c0883a77a4e6
0000167c-95f5-48eb-b15f-04790e09a765
00002517-4dfe-4e3c-b648-20f06fca2b69
00002fc9-7283-44dd-bf6f-94c9492d0998
00004ad5-6ffe-4bcb-92d0-7d0947355f9d
00004cc9-2d41-4717-8507-ce5e5d451af0
00005a44-2152-4971-80c1-c217563845eb
00005ac4-210c-4914-89ba-6279ea881809
Wed Nov 16 20:53:28 2016 : Downloading https://metabrainz.org/api/musicbrainz/replication-98981.tar.bz2 to /tmp/replication-98981.tar.bz2
HTTP/1.1 502 Bad Gateway
Connection: close
Date: Wed, 16 Nov 2016 19:53:28 GMT
ETag: "58025bc0-241"
Server: openresty
Content-Length: 577
Content-Type: text/html
Client-Date: Wed, 16 Nov 2016 19:53:29 GMT
Client-Peer: 138.201.227.205:443
[
{
"name": "highlevel",
"type": "RECORD",
"mode": "NULLABLE",
"fields": [
{
"name": "model",
"type": "STRING",
"mode": "NULLABLE"