Skip to content

Instantly share code, notes, and snippets.

@leonh
leonh / music_theory.py
Created April 24, 2021 14:30 — forked from mvanga/music_theory.py
Basic Music Theory in ~200 Lines of Python
# The code for my article with the same name. You can find it at the URL below:
# https://www.mvanga.com/blog/basic-music-theory-in-200-lines-of-python
# MIT License
#
# Copyright (c) 2021 Manohar Vanga
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
import asyncio
import aioredis
async def add_new_win(pool, winner):
# Creating tasks doesn't schedule them
# so you can create multiple and then
# schedule them all in one go using `gather`
task1 = pool.zincrby('wins_counter', 1, winner)
task2 = pool.incr('total_games_played')
@leonh
leonh / gist:ad5ffc6bdfa4e5c7a165300cdb146233
Created December 3, 2018 13:53
Django application (Wagtail CMS Bakery demo) as Python zipapp using Shiv
I ran into a couple of problems following the example on the Shiv (RTD) docs page
The following files worked for me from a python3 virtual env called test_shiv_env
Created .py file
test_shiv_env/bakerydemo/bakerydemo/main.py
import sys