Skip to content

Instantly share code, notes, and snippets.

💭
Hell bent on total world domination!

Robert Kaye mayhem

💭
Hell bent on total world domination!
Block or report user

Report or block mayhem

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:92c00217d4829bc2042c300ebb6b0dda
dig similarity.acousticbrainz.org
; <<>> DiG 9.10.6 <<>> similarity.acousticbrainz.org
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14115
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 512
View gist:9a2a6c964d53ac977d47bd11e8a8c912
SELECT DISTINCT r.gid as recording_mbid, r.name as recording_name, ac.name as artist_credit_name, array_agg(a.gid) as artist_mbids
INTO recording_artist_credit_pairs
FROM recording r
JOIN artist_credit ac ON r.artist_credit = ac.id
JOIN artist_credit_name acn ON ac.id = acn.artist_credit
JOIN artist a ON acn.artist = a.id
GROUP BY r.gid, r.name, ac.name
ORDER BY r.name
View gist:afd89e024a0b5196e6b453ab941a5836
select * from recording r join recording_json rj on r.data = rj.id where gid in ('03dd7916-fc2c-4b50-aa37-7353fd70fb4f', '9964b00c-6e64-41f2-b9c8-91a9982da27b', '6087e0a5-b57a-4194-8928-580ae388a475');
id | gid | data | artist | release | submitted | id | data | data_sha256 | meta_sha256
----------+--------------------------------------+----------+--------------------------------------+--------------------------------------+-------------------------------+----------+-----------------------------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------+------------
View gist:d3df187d26e768316d2f2da178f19109
id | data | data_sha256 | meta_sha256
---------+--------------------------------------------------------------------+------------------------------------------------------------------+------------------------------------------------------------------
3346681 | {"title": "Queen", "artist": "Flint Eastwood", "release": "Queen"} | be2a13cf39c062c5b9714649ff66ee7bd3b2ca0782467a8d7c13cbcf59896650 | 42ad5e74ca7b76056a039ad31ce099434041faed80e487a9d7687fb894329acf
id | data | data_sha256 | meta_sha256
---------+----------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
View gist:4de08e3defbe0c4f6476d1b2afba4e4c
artist votes: 5
3104 portishead = portishead
2 portishead = portishead & massive atta
3 portishead = portishead & dj shadow
6 portishead = portishead + epigones
1 portishead = portishead + epigones
View gist:9cad2d793b2d7dfadef472c82be5221c
Use direct sorting
------------------
load MSB recordings
sort MSB recordings (30931043 items)
Time: 206.17126965522766
real 9m21.058s
user 0m0.064s
sys 0m0.041s
View gist:790831809d354b0d3c5994958a0c69ca
#!/usr/bin/env python3
data = [(5, "Pogues, The"), (6, "void"), (2, "U2"), (3, "Foo Fighters"), (1, "Zambiana"), (7, "void")]
data_index = list(range(len(data)))
data_index = sorted(data_index, key=lambda rec: data[rec][1])
for i in data_index:
print(data[i])
View gist:c05e1be9735778abbfd6d5beedd42644
#!/usr/bin/env python3
data = [(5, "Pogues, The"), (6, "void"), (2, "U2"), (3, "Foo Fighters"), (1, "Zambiana"), (7, "void")]
data_index = list(range(len(data)))
data_index = sorted(data_index, key=lambda rec: data[rec][1])
for i in data_index:
print(data[i])
View gist:9df9125ec392c17b48fdf650c50429eb
2019-06-24 23:04:07.378 GMT messybrainz@messybrainz 11186 127.0.0.1(43752) ERROR: duplicate key value violates unique constraint "recording_json_pkey"
2019-06-24 23:04:07.378 GMT messybrainz@messybrainz 11186 127.0.0.1(43752) DETAIL: Key (id)=(9268154) already exists.
2019-06-24 23:04:07.378 GMT messybrainz@messybrainz 11186 127.0.0.1(43752) STATEMENT: INSERT INTO recording_json (data, data_sha256, meta_sha256)
VALUES ('{"artist":"Billie Holiday","recording_mbid":"0178f490-3ecf-3ffb-bd4b-37917716b591","release":"Billie Holiday","title":"My Old Flame"}', '5d57c44d2b2a9f70f05da5515c7d1957d6d1241bf8eea06eeadfc64e9d5b5100', 'a4138094b73860eb780d8a218cff9b2902b0cac23a61b26fd9232dcac91ebb3e')
View gist:434d2607e55c0b667c8c21c91d3b3d9e
messybrainz=> select musicbrainz.musicbrainz_collate('porta~') > musicbrainz.musicbrainz_collate('portable');
?column?
----------
f
(1 row)
========================
s1 = "porta~"
s2 = "portable"
You can’t perform that action at this time.