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:35ed08fb470127facd3de66131090c1f
SELECT r.id
FROM musicbrainz.release_group rg
JOIN musicbrainz.release r ON rg.id = r.release_group
JOIN musicbrainz.release_country rc ON rc.release = r.id
JOIN musicbrainz.medium m ON m.release = r.id
JOIN musicbrainz.medium_format mf ON m.format = mf.id
JOIN musicbrainz.format_sort fs ON mf.id = fs.format
FULL OUTER JOIN musicbrainz.release_group_secondary_type_join rgstj ON rg.id = rgstj.release_group
WHERE rg.artist_credit != 1
ORDER BY rg.artist_credit, rg.type, rgstj.release_group desc, rg.name, fs.sort, date_year, date_month, date_day, country
View gist:55c6947bfd8cd22514deb9a1e969d566
QUERY PLAN
-------------------------------------------------------------------------------------------------------------------------------------------
GroupAggregate (cost=25445006.19..27648699.60 rows=62962669 width=118)
Group Key: rpr.id, ac.name, r.gid, r.name, a.gid, rl.name, rl.gid
-> Sort (cost=25445006.19..25602412.86 rows=62962669 width=118)
Sort Key: rpr.id, ac.name, r.gid, r.name, a.gid, rl.name, rl.gid
-> Hash Join (cost=1692437.93..5667781.13 rows=62962669 width=118)
Hash Cond: (r.artist_credit = ac.id)
-> Hash Join (cost=1307840.84..4062150.57 rows=23713115 width=81)
Hash Cond: (t.recording = r.id)
View gist:801f772d22d57acd1c23cead95f92508
1 | CD
2 | DVD
3 | SACD
4 | DualDisc
5 | LaserDisc
6 | MiniDisc
11 | DAT
12 | Digital Media
13 | Other
16 | DCC
View gist:98389b65eb8d2bfff3de96053751d28b
## utils.py
def register_dataframe(df, table_name):
try:
df.createOrReplaceTempView(table_name)
except HolyShitTableNotFoundException as err:
df.createOrReplaceTempView(alternate_table_name)
try:
utils.register_dataframe(df, table)
except Py4JJavaError as err:
View gist:fbb0da414dc1fd1dd272d69b87122d9f
#!/usr/bin/env python3
import datetime
from dateutil.relativedelta import relativedelta
# 2019-08-02
begin_date = datetime.datetime.utcnow()
def get_months(from_date, days):
date_pairs = []
for offset in range(days + 1):
View gist:a00ae98f8842561fc3aeeb68c204a97c
root@bono /home/zas # la -la . .ssh
.:
total 24
drwxr-xr-x 3 zas zas 4096 Jul 17 13:01 .
drwxr-xr-x 5 root root 4096 Jul 17 13:13 ..
-rw-r--r-- 1 zas zas 220 Jul 17 12:43 .bash_logout
-rw-r--r-- 1 zas zas 3771 Jul 17 12:43 .bashrc
-rw-r--r-- 1 zas zas 807 Jul 17 12:43 .profile
drwxr--r-- 2 root root 4096 Jul 17 13:03 .ssh
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
---------+----------------------------------------------------------------------------------------------------------------------+-----------------------------------------------
You can’t perform that action at this time.