Compare commits

10 Commits

Author SHA1 Message Date
flancian dcf8b1bb2d autopushed 2023-12-18 19:04:49 +01:00
flancian 01763a05cd autopushed 2023-12-18 19:02:35 +01:00
flancian fb470ba319 autopushed 2023-12-18 18:59:13 +01:00
flancian 30c44af669 autopushed 2023-12-18 18:58:39 +01:00
flancian c9c754f62a autopushed 2023-12-18 18:58:05 +01:00
flancian 76eeec6c5f autopushed 2023-12-18 18:55:51 +01:00
flancian bd96c8151a autopushed 2023-12-18 18:48:00 +01:00
flancian 5d10fa5ba2 autopushed 2023-12-18 18:02:46 +01:00
flancian f74d496e46 autopushed 2023-12-18 17:59:49 +01:00
flancian b47c20877b autopushed 2023-12-18 17:58:36 +01:00
6 changed files with 72 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
Y [[Maitreya]] serán nuestros hijos, nuestros [[amigos]]!
+6
View File
@@ -1 +1,7 @@
- A [[book]] you find for free in the [[Agora of Flancia]].
> Avalokiteshvara dijo:
>
> Avalokiteshvara es el vacío, el vacío es Avalokiteshvara.
>
> [[Avalokiteshvara somos nosotros]]."
+1
View File
@@ -0,0 +1 @@
- #pull [[friends]]
Executable
+54
View File
@@ -0,0 +1,54 @@
#!/usr/bin/env python3
# https://click.palletsprojects.com/en/8.1.x/arguments/
# https://click.palletsprojects.com/en/8.1.x/options/
import click
import math
import sys
# I'm not proud (I am a little bit?).
PROOF = [] # :)
class AgoraCmd(click.Command):
def format_help(self, ctx, formatter):
click.echo("""Usage:
- Visit anagora.org/hz to execute this file in the Agora of Flancia.
- Visit e.g. anagora.org/hz/523 to test which note 523hz is the closest to (should return C5)
- In general visit anagora.org/foo, anagora.org/foo/bar to execute e.g. <bin/foo.py bar> from your garden.
""")
def __call__(self, *args, **kwargs):
try:
return super(AgoraCmd, self).__call__(
*args, standalone_mode=False, **kwargs)
except click.MissingParameter as exc:
exc.ctx = None
exc.show(file=sys.stdout)
click.echo()
try:
super(AgoraCmd, self).__call__(['--help'])
except SystemExit:
sys.exit(exc.exit_code)
@click.command(cls=AgoraCmd)
@click.argument('freq', type=click.INT)
def hz(freq):
"""Calculates the closest note to input hz :)"""
A4 = 440
# Number of half steps away.
n = 12 * math.log2(freq / A4)
octave = 4 + (n // 12)
n_rounded = round(n)
note_index = n_rounded % 12
notes = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]
note = notes[note_index]
# click.echo(f"hz({freq}) is {note}{str(octave)}.")
click.echo(f"hz({freq}) is {note}.")
if __name__ == '__main__':
hz()
+5
View File
@@ -0,0 +1,5 @@
- [[work]]
- [[working while working]]
- [[flancia]]:
- [[writing while writing]]
- [[Avalokiteshvara somos nosotros]]
+5
View File
@@ -79,3 +79,8 @@ The term [[data sovereignty]] as per [[wp]] seems to be mostly taken over alread
[[agora graph]]
--
Back here while [[today]] resolves to [[2023-12-18]] :)
Finally I've added support for -- resulting in an hr element in the Agora, I think I have a bug, let's see :)