diff --git a/content/blog/bdaymusic.md b/content/blog/bdaymusic.md index e14971f..b4ac84c 100644 --- a/content/blog/bdaymusic.md +++ b/content/blog/bdaymusic.md @@ -5,10 +5,10 @@ draft: false tags: ["music"] --- -I was scrolling around in the [Free Music Archive](https://freemusicarchive.org/) and I stumbled upon the entries of their [The New Birthday Song Contest](https://www.freemusicarchive.org/music/Happy_Birthday_Song_Contest/The_New_Birthday_Song_Contest) back in 2012. One of my favorites is an entry by [Kevin Lax](http://www.kevinlax.com/) titled [Happy Birthday](https://files.freemusicarchive.org/storage-freemusicarchive-org/music/WFMU/Kevin_Lax/The_New_Birthday_Song_Contest/Kevin_Lax_-_Happy_Birthday.mp3) licensed under [Creative Commons Attribution](https://creativecommons.org/licenses/by/3.0/). +I was scrolling around in the [Free Music Archive](https://freemusicarchive.org/) and I stumbled upon the entries of their [The New Birthday Song Contest](https://www.freemusicarchive.org/music/Happy_Birthday_Song_Contest/The_New_Birthday_Song_Contest) back in 2012. One of my favorites is an entry by [Kevin Lax](http://www.kevinlax.com/) titled [Happy Birthday](https://files.freemusicarchive.org/storage-freemusicarchive-org/music/WFMU/Kevin_Lax/The_New_Birthday_Song_Contest/Kevin_Lax_-_Happy_Birthday.mp3) licensed under [Creative Commons Attributioni v3](https://creativecommons.org/licenses/by/3.0/). {{< addaudio "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/WFMU/Kevin_Lax/The_New_Birthday_Song_Contest/Kevin_Lax_-_Happy_Birthday.mp3" >}} -Even though the competition is long over (and I don't have much skill) I still decided to record a small entry which I'll title [Happy Birthday](/music/happybday.ogg) licensed under [Creative Commons Attribution](https://creativecommons.org/licenses/by/3.0/) as well. +Even though the competition is long over (and I don't have much skill) I still decided to record a small entry which I'll title [Happy Birthday](/music/happybday.ogg) licensed under [Creative Commons Attribution v4](https://creativecommons.org/licenses/by/4.0/). -{{< addaudio "/music/happybday.ogg" >}} \ No newline at end of file +{{< addaudio "/music/happybday.ogg" >}} diff --git a/content/blog/pymemoization.md b/content/blog/pymemoization.md index b6f723c..417c0ae 100644 --- a/content/blog/pymemoization.md +++ b/content/blog/pymemoization.md @@ -8,6 +8,8 @@ tags: ["python"] There is often a trade-off when it comes to efficiency of CPU vs memory usage. In this post, I will show how the [`lru_cache`](https://docs.python.org/3/library/functools.html#functools.lru_cache) decorator can cache results of a function call for quicker future lookup. ```python +from functools import lru_cache + @lru_cache(maxsize=2**7) def fib(n): if n == 1: @@ -19,4 +21,4 @@ def fib(n): In the code above, `maxsize` indicates the number of calls to store. Setting it to `None` will make it so that there is no upper bound. The documentation recommends setting it equal to a power of two. -Do note though that `lru_cache` does not make the execution of the lines in the function faster. It only stores the results of the function in a dictionary. \ No newline at end of file +Do note though that `lru_cache` does not make the execution of the lines in the function faster. It only stores the results of the function in a dictionary.