mirror of
https://github.com/flancian/garden.git
synced 2026-08-06 06:26:20 +00:00
Compare commits
71 Commits
408d81a4b9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 36ece344eb | |||
| a60ba48285 | |||
| 0e72513b57 | |||
| 436d1f2080 | |||
| 55f07b2968 | |||
| 2fb768cdd5 | |||
| f24cc3c045 | |||
| e84b1ed3ef | |||
| 7a7113ee51 | |||
| 7ae947429c | |||
| 321658d458 | |||
| dbb6160527 | |||
| 3c56c6b6a9 | |||
| 05ee62ea9e | |||
| a41164a32e | |||
| 787713c8f0 | |||
| 5a399aaed2 | |||
| 32f0f4fd48 | |||
| d73fad0150 | |||
| 2a8a0a7973 | |||
| 428a76830f | |||
| 6cf86a51cc | |||
| 0b297fe517 | |||
| fe540a1d19 | |||
| 8630add5a3 | |||
| d225d813a6 | |||
| 83bc9f67aa | |||
| 5e26d88e63 | |||
| 58d47b4d0d | |||
| ba72d180ad | |||
| 408ada2324 | |||
| 114bc4e3de | |||
| 91c8222c69 | |||
| 90319b8516 | |||
| ef341f5a77 | |||
| 4ed0ba158b | |||
| 6007844770 | |||
| 3229b5ca80 | |||
| 8c72aeed08 | |||
| 16f577c8c4 | |||
| 053bee9b83 | |||
| 7fe2011480 | |||
| e3812fae45 | |||
| 9495d2b8f9 | |||
| e656cfcf9d | |||
| 57551097aa | |||
| 219595ed05 | |||
| a2887f9404 | |||
| da0b4d6b46 | |||
| e822cfc2e2 | |||
| 9a5dbdba73 | |||
| e61179ae5c | |||
| f7028f8722 | |||
| b44d500415 | |||
| 5006c78fc1 | |||
| 33ad7acccf | |||
| 7353291fd6 | |||
| 8a21454381 | |||
| 64a7e533cc | |||
| 7e74d42a1b | |||
| 0b03e40e48 | |||
| 2531134e70 | |||
| f1d8e65022 | |||
| c3f58c489a | |||
| e231242f07 | |||
| 32b10da2db | |||
| b07d294d1e | |||
| bfd44134d0 | |||
| 9aa323d6ac | |||
| 6a41fc820f | |||
| 69fc4d2e42 |
@@ -0,0 +1 @@
|
||||
- [[Simon]] told me about [[Stiftung für direkte Demokratie]]!
|
||||
@@ -0,0 +1 @@
|
||||
- [[twg bugs]]
|
||||
@@ -0,0 +1,28 @@
|
||||
- I'm writing this in [[Homemade]] just after hosting a discussion about the Commons and the [[Agora]]. It was great!
|
||||
- The whole three days here so far have been great; I am thankful for the experience.
|
||||
- The first day I came over with [[KM]] and [[David]], they stayed one night. We had a beautiful walk in the vicinity with an imposing view of the Alps.
|
||||
- Yesterday night I worked on setting up a local Agora for the [[Bitwäscherei]] space in Zürich, which [[SGMK}] is a part of.
|
||||
- Tomorrow I leave. I am looking forward to the last night and the last day -- I plan to head bac kto Zürich, probably walking down the mountain to the train station, around 5-6PM on [[2026-07-28]].
|
||||
- I am writing this without really reading the screen, after a new friend of mine perhaps, while I watch a movie I don't quite understand that is exclusively in German without subtitles :)
|
||||
- So these notes might be more disjointed and potentially lillegible than usual, although my standards are quite low many days, and to be honest maybe even rough unedited (even unseen) notes are better than no notes! And no notes has been the general standard in the last few months!
|
||||
|
||||
|
||||
---
|
||||
|
||||
And then I thought about the [[zine]].
|
||||
|
||||
(I wished I could write to [[bouncepaw]] here, right here when I'm writing these notes, and then I realized this was possible. It is literally what I'm doing right now :) -> Wrote in Telegram.)
|
||||
|
||||
Today in the conversation associated with the [[Agora presentation]] (and thank you Simon!) [[dusjagr]] shared an LLM generated [[zine]] It didn't quite work when we tried it (it was a demo, after all!) but I liked the idea and realization already a lot. It is a zine that is generated based on the content of some wikis that the LLM is aware of!
|
||||
|
||||
-> [[zine generator]] https://weiweiweiopen.github.io/peach-blossom-spring/
|
||||
|
||||
[[dusjagr]] also shared a beautiful tool to visualize [[timelines]] of [[the lifecycle of wikis]], e.g.
|
||||
|
||||
-> [[wiki lifecycle]] https://arai-eek.github.io/wiki-research/sgmk.html
|
||||
|
||||
---
|
||||
|
||||
I met many interesting people this weekend! So many. I feel very lucky indeed!
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
- Thought and discussed some more about the [[Bitwäscherei Agora]] :)
|
||||
- I was going to return tonight to Zürich but I decided to stay one extra night and go to work straight from Ebnat-Kappel, work the second half of the day. I have multiple months of vacation saved up so I thought it was a good thing to self-gift (?) :)
|
||||
- I met so many interesting people for the first time! Some that come to mind right away:
|
||||
- Ananda
|
||||
- Taras
|
||||
- Kim
|
||||
- Ting
|
||||
- Stefan
|
||||
- Markus
|
||||
- Monika
|
||||
- Adam
|
||||
- and many more!
|
||||
- Thank you all! (also all the people I already knew but got to know a lot better during this opportunity!)
|
||||
- Claire showed us a tarot of the future! Name incoming :)
|
||||
@@ -0,0 +1,5 @@
|
||||
- [[ec]] dijo:
|
||||
* aire para los oprimidos
|
||||
* paz para los perseguidos (buenísimo)
|
||||
- [[zine]]
|
||||
- [[La Revolución es un Sueño Eterno]]!
|
||||
@@ -0,0 +1,5 @@
|
||||
- I love [[KM]]... but :(
|
||||
- I ended up going to the [[Zentralwäscherei]] around 17 and stayed until 5am.
|
||||
- I spoke to [[Simon]] about the [[Bitwäscherei Agora]], he has very nice ideas! I think we are building the Commons together.
|
||||
- I spoke to many people and danced, it was cathartic.
|
||||
- I helped fix a computer (to replace one that was broken), tried to help here and there and did some visuals. Many people were doing music and visuals and it was wonderful.
|
||||
@@ -0,0 +1,8 @@
|
||||
- [[2026-08-01]] happened and it was memorable in many ways, some sad and some joyful.
|
||||
- Today I woke up late after going to bed very late and I spent the day with my mum (and Burup); we played [[canasta]] and then went to the lake at [[Tiefenbrunnen]], we had a great time.
|
||||
- Then on the way back home I passed by the [[Wäscherei]] to see who was around/if anything needed doing and to do some work.
|
||||
- An impromptu todo:
|
||||
* Review [[zine]] and maybe start the short prose contribution? The city theme is not strong in my contribution so far!
|
||||
* Review one of my [[dragon tasks]] at work, probably the document that's been in continuous revision for six months now (yikes)
|
||||
* Do something more strictly [[Bitwäscherei]] related, maybe write that wiki importer that I added to the [[agora bridge]] scope some time ago? It would make sense given the sources that the internal Agora needs to import.
|
||||
* I talked about the [[Agora]] and linking notes with Adam!
|
||||
@@ -0,0 +1,8 @@
|
||||
- Very nice feedback/ideas/interactions with the [[SGMK]]/[[Homemade]] community about the [[Bitwäscherei Agora]]! I'm very grateful.
|
||||
- This gave me a nice clear list of further priorities, and I like how they overlap with things I considered through the years and somehow didn't get to yet :) A free form todo list follows.
|
||||
- [[Agora Bridge]]:
|
||||
- [[Mediawiki importer]] -- how do I not really have this yet?!
|
||||
- [[RSS importer]] / [[Wordpress importer]] -- same! Although [[Lord Enki]]'s garden/site was one-off imported with something I coded pre-AI, maybe I still have it around somewhere?
|
||||
- [[Agora Server]]:
|
||||
* Some nice feedback on the visualization in the Agora! People keep commenting how nice it is, I do think that there is plenty of new ideas to also explore in this space!
|
||||
* I really liked [[dusjagr]]'s bringing up his (and his group's) experiments
|
||||
@@ -0,0 +1,2 @@
|
||||
- Stiftung für direkte Demokratie
|
||||
- https://www.demokratie.ch/
|
||||
+25
-14
@@ -1,20 +1,17 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# https://click.palletsprojects.com/en/8.1.x/arguments/
|
||||
# https://click.palletsprojects.com/en/8.1.x/options/
|
||||
#
|
||||
# boilerplate shamelessly cloned from prime.py :).
|
||||
|
||||
import click
|
||||
import math
|
||||
import random
|
||||
import sys
|
||||
|
||||
|
||||
class AgoraCmd(click.Command):
|
||||
def format_help(self, ctx, formatter):
|
||||
click.echo("""Usage:
|
||||
- Visit anagora.org/dice to execute this file in the Agora of Flancia.
|
||||
- Visit e.g. anagora.org/dice/17 to throw a 17-sided die, and others :)
|
||||
- Visit e.g. anagora.org/dice/20 to roll a d20 (and see rolls for all smaller dice!).
|
||||
- In general visit anagora.org/foo, anagora.org/foo/bar to execute e.g. <bin/foo.py bar> from your garden.
|
||||
""")
|
||||
|
||||
@@ -31,23 +28,37 @@ class AgoraCmd(click.Command):
|
||||
except SystemExit:
|
||||
sys.exit(exc.exit_code)
|
||||
|
||||
def rand(n):
|
||||
|
||||
def roll_tower(n):
|
||||
proof = []
|
||||
for i in range(2, n+1):
|
||||
for i in range(2, n + 1):
|
||||
r = random.randint(1, i)
|
||||
if i == 2:
|
||||
proof.append(f"You throw a fair coin and it lands [[{bool(r-1) and 'heads' or 'tails'}]].")
|
||||
coin = "heads" if r == 2 else "tails"
|
||||
proof.append(f"Coin flip (d2): [[{coin}]].")
|
||||
else:
|
||||
proof.append(f"You throw a die of [[{i}]] sides and it comes up [[{r}]].")
|
||||
|
||||
return "\n".join(reversed(proof))
|
||||
proof.append(f"d[[{i}]] roll: [[{r}]].")
|
||||
return list(reversed(proof))
|
||||
|
||||
|
||||
@click.command(cls=AgoraCmd)
|
||||
@click.argument('n', type=click.INT)
|
||||
def dice(n):
|
||||
"""A simple randomness generator, imitating those we know and love from R^4 :)."""
|
||||
proof = rand(n)
|
||||
click.echo(proof)
|
||||
"""Simulates rolling a d[[n]] die along with a polyhedral dice tower."""
|
||||
if n < 1:
|
||||
click.echo("Please provide a die size of at least 1.")
|
||||
return
|
||||
|
||||
main_roll = random.randint(1, n)
|
||||
click.echo(f"🎲 Rolling a d[[{n}]]: result is [[{main_roll}]]!\n")
|
||||
|
||||
if n > 1:
|
||||
click.echo(f"Dice tower rolls from d[[2]] up to d[[{n}]]:")
|
||||
tower = roll_tower(n)
|
||||
for line in tower:
|
||||
click.echo(f" • {line}")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
dice()
|
||||
|
||||
|
||||
+66
-34
@@ -6,14 +6,43 @@ import click
|
||||
import math
|
||||
import sys
|
||||
|
||||
# I'm not proud (I am a little bit?).
|
||||
PROOF = [] # :)
|
||||
|
||||
def get_centered_hex(k):
|
||||
"""Returns the k-th centered hexagonal number (1-indexed)."""
|
||||
if k < 1:
|
||||
return None
|
||||
return 3 * k * (k - 1) + 1
|
||||
|
||||
|
||||
def check_centered_hex(n):
|
||||
"""Checks if n is a centered hexagonal number.
|
||||
Returns (is_hex, k) if it is, or (False, closest_k) if it isn't.
|
||||
"""
|
||||
if n < 1:
|
||||
return False, 1
|
||||
|
||||
# Solve 3k^2 - 3k + 1 - n = 0
|
||||
# k = (3 + sqrt(12n - 3)) / 6
|
||||
d = 12 * n - 3
|
||||
if d < 0:
|
||||
return False, 1
|
||||
|
||||
s = math.isqrt(d)
|
||||
k_approx = (3 + s) // 6
|
||||
|
||||
# Make sure we check k_approx and its neighbor to find the best fit
|
||||
for k in (k_approx, k_approx + 1):
|
||||
if get_centered_hex(k) == n:
|
||||
return True, k
|
||||
|
||||
return False, k_approx
|
||||
|
||||
|
||||
class AgoraCmd(click.Command):
|
||||
def format_help(self, ctx, formatter):
|
||||
click.echo("""Usage:
|
||||
- Visit anagora.org/primes to execute this file in the Agora of Flancia.
|
||||
- Visit e.g. anagora.org/primes/17 to test if 17 is prime.
|
||||
- Visit anagora.org/hex to execute this file in the Agora of Flancia.
|
||||
- Visit e.g. anagora.org/hex/19 to test if 19 is a centered hexagonal number.
|
||||
- In general visit anagora.org/foo, anagora.org/foo/bar to execute e.g. <bin/foo.py bar> from your garden.
|
||||
""")
|
||||
|
||||
@@ -30,42 +59,45 @@ class AgoraCmd(click.Command):
|
||||
except SystemExit:
|
||||
sys.exit(exc.exit_code)
|
||||
|
||||
|
||||
@click.command(cls=AgoraCmd)
|
||||
@click.argument('n', type=click.INT)
|
||||
def hexnum(n, centered=True):
|
||||
"""Calculates the first n hex numbers just for fun :)"""
|
||||
def hexnum(n):
|
||||
"""Checks if n is a centered hexagonal number and provides nearest neighbors."""
|
||||
is_hex, k = check_centered_hex(n)
|
||||
|
||||
# Going through this from first principles (from memory/deducing this) for fun :)
|
||||
if is_hex:
|
||||
click.echo(f"[[{n}]] is the centered hexagonal number #[[{k}]].")
|
||||
else:
|
||||
click.echo(f"[[{n}]] is *not* a centered hexagonal number.")
|
||||
# Find neighbors
|
||||
if n < 1:
|
||||
h_next = get_centered_hex(1)
|
||||
click.echo(f"The first centered hexagonal number is [[{h_next}]] (index #[[1]]).")
|
||||
else:
|
||||
h1 = get_centered_hex(k)
|
||||
h2 = get_centered_hex(k + 1)
|
||||
if h1 > n:
|
||||
# k was overestimated or we need k-1
|
||||
h2 = h1
|
||||
k2 = k
|
||||
k1 = max(1, k - 1)
|
||||
h1 = get_centered_hex(k1)
|
||||
else:
|
||||
k1 = k
|
||||
k2 = k + 1
|
||||
|
||||
# Why does the first list comprehension I wrote knowing it was wrong not work?
|
||||
# Is it because of its complexity? Note I don't know the 'closed form' for hex numbers yet but I think it exists.
|
||||
# To calculate them, I only know you need to add 6 more than after the previous number.
|
||||
# But that can't be (trivially) expressed in a list comprehension.
|
||||
#
|
||||
# hexnums = [int(centered) + 6*n for n in range(0,n)]
|
||||
# click.echo(f"These are not all hex numbers, but some are: {list(enumerate(hexnums))}")
|
||||
if k1 == k2:
|
||||
click.echo(f"The closest centered hexagonal number is [[{h1}]] (index #[[{k1}]]).")
|
||||
else:
|
||||
click.echo(f"The closest centered hexagonal numbers are [[{h1}]] (index #[[{k1}]]) and [[{h2}]] (index #[[{k2}]]).")
|
||||
|
||||
# If we could skip one, then two, then three from the list above,
|
||||
# we could exclude all non-hex-numbers.
|
||||
# is there something in itertools that can do this for us?
|
||||
# I don't think so. Maybe dropwhile with the right lambda?
|
||||
|
||||
# ...anyway, going at it old school.
|
||||
# acc = int(centered)
|
||||
# for row in range(0, n+1):
|
||||
# acc += 6 * row
|
||||
# click.echo(f"hex({row}) is {acc}.")
|
||||
|
||||
# ...and then https://oeis.org/A003215 to the rescue :)
|
||||
# [[crystal ball sequence for hexagonal lattice]]: why does this work?
|
||||
# -> https://en.wikipedia.org/wiki/Centered_hexagonal_number
|
||||
# It is a cubic polynomial and Wikipedia shows how to convince yourself that it works.
|
||||
# Beautiful :)
|
||||
hexnums = [3*n*(n+1)+1 for n in range(0,n)]
|
||||
|
||||
for nth, hexnum in enumerate(hexnums):
|
||||
click.echo(f"hex({nth+1}) is {hexnum}.")
|
||||
# Always show first 20 centered hexagonal numbers for context
|
||||
first_20 = [str(get_centered_hex(i)) for i in range(1, 21)]
|
||||
first_20_links = ", ".join(f"[[{x}]]" for x in first_20)
|
||||
click.echo(f"\nFirst 20 centered hexagonal numbers: {first_20_links}.")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
hexnum()
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import click
|
||||
import math
|
||||
import sys
|
||||
|
||||
|
||||
class AgoraCmd(click.Command):
|
||||
def format_help(self, ctx, formatter):
|
||||
click.echo("""Usage:
|
||||
@@ -27,29 +28,40 @@ class AgoraCmd(click.Command):
|
||||
except SystemExit:
|
||||
sys.exit(exc.exit_code)
|
||||
|
||||
|
||||
@click.command(cls=AgoraCmd)
|
||||
@click.argument('freq', type=click.FLOAT)
|
||||
def hz(freq):
|
||||
"""Calculates the closest note to input hz :)"""
|
||||
"""Calculates the closest musical note to an input frequency in Hz."""
|
||||
if freq <= 0:
|
||||
click.echo("Frequency must be positive.")
|
||||
return
|
||||
|
||||
A4 = 440
|
||||
A4 = 440.0
|
||||
|
||||
# Number of half steps away.
|
||||
n = 12 * math.log2(freq / A4)
|
||||
n = round(n)
|
||||
note_index = n % 12
|
||||
# Exact continuous half steps from A4
|
||||
n_exact = 12 * math.log2(freq / A4)
|
||||
n = round(n_exact)
|
||||
|
||||
# Pitch deviation in cents (100 cents = 1 semitone)
|
||||
cents = round((n_exact - n) * 100)
|
||||
|
||||
notes = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]
|
||||
note_index = n % 12
|
||||
note = notes[note_index]
|
||||
|
||||
octave = 4 + (n // 12)
|
||||
if note in ["C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]:
|
||||
# compensate for the fact that octaves are counted from C
|
||||
# compensate for octave starting at C
|
||||
octave += 1
|
||||
|
||||
click.echo(f"hz({freq}) is {note}{str(octave)}.")
|
||||
# click.echo(f"hz({freq}) is {note}.")
|
||||
note_name = f"{note}{octave}"
|
||||
cents_str = f" ({'+' if cents > 0 else ''}{cents} cents)" if cents != 0 else " (perfect pitch)"
|
||||
|
||||
click.echo(f"[[hz/{freq}]] is closest to [[{note_name}]] at [[{freq}]] Hz{cents_str}.")
|
||||
click.echo(f"Note class: [[{note}]], Octave: [[octave/{octave}]].")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
hz()
|
||||
|
||||
|
||||
+85
-41
@@ -7,44 +7,65 @@ import click
|
||||
import math
|
||||
import sys
|
||||
|
||||
# I'm not proud (I am a little bit?).
|
||||
PROOF = [] # :)
|
||||
|
||||
def factor(n):
|
||||
for i in range(2, n+1):
|
||||
click.echo(f"Is {i} a factor of {n}, I wonder?")
|
||||
def get_prime_factors(n):
|
||||
"""Computes the full prime factorization of n."""
|
||||
factors = []
|
||||
d = 2
|
||||
temp = abs(n)
|
||||
while d * d <= temp:
|
||||
while temp % d == 0:
|
||||
factors.append(d)
|
||||
temp //= d
|
||||
d += 1
|
||||
if temp > 1:
|
||||
factors.append(temp)
|
||||
return factors
|
||||
|
||||
def print_sieve(sieve):
|
||||
primes = []
|
||||
for n, prime in enumerate(sieve):
|
||||
if n >= 2 and prime:
|
||||
primes.append(str(n))
|
||||
return ", ".join(primes)
|
||||
|
||||
def is_prime(n):
|
||||
sieve = [True for n in range(0, n+1)]
|
||||
upto = math.ceil(math.sqrt(n))
|
||||
for i, _ in enumerate(sieve):
|
||||
# click.echo(f"i: {i}")
|
||||
if i < 2:
|
||||
continue
|
||||
# If we're above the square root, we can stop considering the first factor, as we'll try higher numbers in the inner loop.
|
||||
if i > upto:
|
||||
break
|
||||
# If this is a known composite, then we've already crossed off its multiples when we iterated over its primes.
|
||||
if not sieve[i]:
|
||||
continue
|
||||
# for j in range(2, math.ceil(math.sqrt(n) + 1)):
|
||||
for j in range(2, n):
|
||||
# I wrote >= here initially. That did *not* work ;)
|
||||
if i * j > n:
|
||||
break
|
||||
PROOF.append(f"[[{i*j}]] is composite: {i} * {j}.")
|
||||
try:
|
||||
sieve[i*j] = False
|
||||
except IndexError:
|
||||
continue
|
||||
return (n >= 2 and sieve[n], sieve)
|
||||
def get_factor_pairs(n):
|
||||
"""Returns all proper factor pairs (a, b) such that a * b = n with a <= b."""
|
||||
pairs = []
|
||||
n_abs = abs(n)
|
||||
for i in range(2, math.isqrt(n_abs) + 1):
|
||||
if n_abs % i == 0:
|
||||
pairs.append((i, n_abs // i))
|
||||
return pairs
|
||||
|
||||
|
||||
def get_proper_divisors(n):
|
||||
"""Returns all proper divisors of n strictly between 1 and n."""
|
||||
divs = set()
|
||||
n_abs = abs(n)
|
||||
for i in range(2, math.isqrt(n_abs) + 1):
|
||||
if n_abs % i == 0:
|
||||
divs.add(i)
|
||||
divs.add(n_abs // i)
|
||||
return sorted(list(divs))
|
||||
|
||||
|
||||
def sieve_primes(n):
|
||||
"""Generates all prime numbers up to n using the Sieve of Eratosthenes."""
|
||||
if n < 2:
|
||||
return []
|
||||
sieve = [True] * (n + 1)
|
||||
sieve[0] = sieve[1] = False
|
||||
for i in range(2, math.isqrt(n) + 1):
|
||||
if sieve[i]:
|
||||
for j in range(i * i, n + 1, i):
|
||||
sieve[j] = False
|
||||
return [i for i, is_p in enumerate(sieve) if is_p]
|
||||
|
||||
|
||||
def format_primes(primes, limit=50):
|
||||
"""Formats a list of primes with wikilinks, capping output if too long."""
|
||||
total = len(primes)
|
||||
if total <= limit:
|
||||
return ", ".join(f"[[{p}]]" for p in primes)
|
||||
else:
|
||||
shown = ", ".join(f"[[{p}]]" for p in primes[:limit])
|
||||
return f"{shown}, ... ({total} total)"
|
||||
|
||||
|
||||
class AgoraCmd(click.Command):
|
||||
def format_help(self, ctx, formatter):
|
||||
@@ -67,18 +88,41 @@ class AgoraCmd(click.Command):
|
||||
except SystemExit:
|
||||
sys.exit(exc.exit_code)
|
||||
|
||||
|
||||
@click.command(cls=AgoraCmd)
|
||||
@click.argument('n', type=click.INT)
|
||||
def prime(n):
|
||||
"""Simple program that factors a number using a [[Sieve of Eratosthenes]]."""
|
||||
p, sieve = is_prime(n)
|
||||
if p:
|
||||
"""Factors a number using prime decomposition and a [[Sieve of Eratosthenes]]."""
|
||||
if n <= 1:
|
||||
click.echo(f"[[{n}]] is neither prime nor composite.")
|
||||
return
|
||||
|
||||
factors = get_prime_factors(n)
|
||||
is_p = (len(factors) == 1)
|
||||
|
||||
if is_p:
|
||||
click.echo(f"[[{n}]] is *prime*.")
|
||||
else:
|
||||
click.echo(f"[[{n}]] is *not prime*. Want proof? :)")
|
||||
click.echo("\n".join([line for line in PROOF if f'[[{n}]]' in line]))
|
||||
click.echo(f"[[{n}]] is *not prime* (composite). Want proof? :)")
|
||||
factor_links = " * ".join(f"[[{f}]]" for f in factors)
|
||||
click.echo(f"\nFull prime factorization: {factor_links}")
|
||||
|
||||
pairs = get_factor_pairs(n)
|
||||
if pairs:
|
||||
click.echo("\nFactor pairs:")
|
||||
for a, b in pairs:
|
||||
click.echo(f" [[{n}]] = [[{a}]] * [[{b}]]")
|
||||
|
||||
divs = get_proper_divisors(n)
|
||||
if divs:
|
||||
divs_str = ", ".join(f"[[{d}]]" for d in divs)
|
||||
click.echo(f"\nProper divisors: {divs_str}")
|
||||
|
||||
primes = sieve_primes(n)
|
||||
if primes:
|
||||
click.echo(f"\nPrimes up to {n}: {format_primes(primes)}.")
|
||||
|
||||
click.echo(f"\nPrimes up to {n}: {print_sieve(sieve)}.")
|
||||
|
||||
if __name__ == '__main__':
|
||||
prime()
|
||||
|
||||
|
||||
+39
-29
@@ -1,20 +1,33 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# https://click.palletsprojects.com/en/8.1.x/arguments/
|
||||
# https://click.palletsprojects.com/en/8.1.x/options/
|
||||
#
|
||||
# boilerplate shamelessly cloned from prime.py :).
|
||||
|
||||
import click
|
||||
import math
|
||||
import random
|
||||
import sys
|
||||
|
||||
|
||||
def decompose(n):
|
||||
"""Decomposes n into chunks of 7, 4, 3, 2, and 1."""
|
||||
if n <= 0:
|
||||
return []
|
||||
ret = []
|
||||
while n > 7:
|
||||
ret.append(7)
|
||||
n -= 7
|
||||
if n == 6:
|
||||
ret.extend([3, 3])
|
||||
elif n == 5:
|
||||
ret.extend([3, 2])
|
||||
else:
|
||||
ret.append(n)
|
||||
return ret
|
||||
|
||||
|
||||
class AgoraCmd(click.Command):
|
||||
def format_help(self, ctx, formatter):
|
||||
click.echo("""Usage:
|
||||
- Visit anagora.org/tare to execute this file in the Agora of Flancia.
|
||||
- Visit e.g. anagora.org/tare/23 to print 23 syllables.
|
||||
- Visit e.g. anagora.org/tare/23 to print 23 syllables of the Tara mantra.
|
||||
- In general visit anagora.org/foo, anagora.org/foo/bar to execute e.g. <bin/foo.py bar> from your garden.
|
||||
""")
|
||||
|
||||
@@ -31,35 +44,32 @@ class AgoraCmd(click.Command):
|
||||
except SystemExit:
|
||||
sys.exit(exc.exit_code)
|
||||
|
||||
def decompose(n, p):
|
||||
ret = []
|
||||
while n > 7:
|
||||
ret.append(7)
|
||||
n -= 7
|
||||
if n == 6:
|
||||
ret.append(3)
|
||||
ret.append(3)
|
||||
elif n == 5:
|
||||
ret.append(3)
|
||||
ret.append(2)
|
||||
else:
|
||||
ret.append(n)
|
||||
|
||||
return ret
|
||||
|
||||
@click.command(cls=AgoraCmd)
|
||||
@click.argument('n', type=click.INT)
|
||||
def tare(n):
|
||||
"""Just for fun, as many of these -- partly inspired by an Asimov story :)"""
|
||||
"""Generates [[n]] syllables of the [[Green Tara]] mantra: Om Tare Tuttare Ture Svaha :)"""
|
||||
parts = {
|
||||
1: ['Om'],
|
||||
2: ['Tare', 'Ture'],
|
||||
3: ['Tuttare'],
|
||||
4: ['Tare Ture'],
|
||||
7: ['Tare Tuttare Ture'],
|
||||
8: ['Tuttare Tuttare Ture'],
|
||||
1: '[[Om]]',
|
||||
2: '[[Tare]] [[Ture]]',
|
||||
3: '[[Tuttare]]',
|
||||
4: '[[Tare]] [[Ture]] [[Svaha]]',
|
||||
7: '[[Om]] [[Tare]] [[Tuttare]] [[Ture]] [[Svaha]]',
|
||||
}
|
||||
click.echo(decompose(n, parts))
|
||||
|
||||
chunks = decompose(n)
|
||||
if not chunks:
|
||||
click.echo("Please provide a positive integer count of syllables.")
|
||||
return
|
||||
|
||||
mantra_lines = [parts.get(c, f"[[syllables/{c}]]") for c in chunks]
|
||||
click.echo(f"[[Green Tara]] mantra breakdown for [[{n}]] syllables:")
|
||||
for i, line in enumerate(mantra_lines, 1):
|
||||
click.echo(f" {i}. {line}")
|
||||
|
||||
click.echo(f"\nTotal syllables: [[{n}]]")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
tare()
|
||||
|
||||
|
||||
+1070
File diff suppressed because it is too large
Load Diff
@@ -6,50 +6,105 @@
|
||||
# 2026-07
|
||||
|
||||
```poetry
|
||||
Algún día, algún día
|
||||
Algún día haremos la [[revolución]]
|
||||
Algún día, algún día!
|
||||
Algún día haremos la revolución.
|
||||
|
||||
Pero si no ahora cuándo?
|
||||
Si no ahora [[cuándo]]?
|
||||
Pero si no ahora: cuándo?
|
||||
Si no ahora, cuándo?
|
||||
```
|
||||
|
||||
```
|
||||
¡Gloria, gloria, gloria!
|
||||
Gloria a las maravillas del universo
|
||||
|
||||
¡Salve, salve, salve!
|
||||
Salve la luz de la consciencia
|
||||
|
||||
Y:
|
||||
|
||||
¡Agua, agua, agua!
|
||||
|
||||
Agua para los sedientos
|
||||
|
||||
Pan (o Flan...) para los hambrientos
|
||||
|
||||
Fuego para los que tienen frío
|
||||
|
||||
Techo para los que no tienen casa (o los desamparados...)
|
||||
|
||||
Paz para los oprimidos
|
||||
|
||||
Luz para los que ven
|
||||
|
||||
Ágora para los que escriben
|
||||
|
||||
Flancia para los que leen
|
||||
|
||||
Libertad para los seres sintientes
|
||||
|
||||
¡Libertad, libertad, libertad!
|
||||
|
||||
```
|
||||
|
||||
|
||||
```poetry
|
||||
Ay! Quién tuviera
|
||||
Los ojos verdes de Lady Burup
|
||||
|
||||
Sus ojos negros
|
||||
Trasnochando
|
||||
Sus bellas rayas!
|
||||
|
||||
Ay! Quién tuviera
|
||||
Los ojos negros de Lady Burup
|
||||
|
||||
Sus ojos verdes
|
||||
Tornasolados
|
||||
Sus bellas rayas!
|
||||
```
|
||||
|
||||
```poetry
|
||||
Gone gone
|
||||
Ay! Quién fuera
|
||||
una flecha derecha
|
||||
volando hacia el corazón de Moloch
|
||||
|
||||
Ay! Quién fuera
|
||||
una saeta certera
|
||||
silbando hacia el corazón de Moloch
|
||||
|
||||
Ay! Quién fuera
|
||||
tal jara dos jaras
|
||||
doblando hacia el corazón de Moloch
|
||||
|
||||
Las jaras, qué jaras?
|
||||
Las de Avalokiteshvara,
|
||||
Maitreya! Y Tara…
|
||||
```
|
||||
|
||||
`
|
||||
```poetry
|
||||
Gone gone,
|
||||
Gone beyond
|
||||
|
||||
Everybody gone
|
||||
to the other shore
|
||||
|
||||
Gone free
|
||||
Gone free,
|
||||
Gone kindly
|
||||
|
||||
If you have to go:
|
||||
Go awake
|
||||
(When you have to go…)
|
||||
Go free
|
||||
Go kindly
|
||||
|
||||
Go awake
|
||||
Meditate
|
||||
```
|
||||
|
||||
```poetry
|
||||
¡Agua, agua, agua!
|
||||
Agua para los sedientos
|
||||
|
||||
Sal para los hipotensos
|
||||
Pan (o Flan...) para los hambrientos
|
||||
|
||||
Fuego para los que tienen frío
|
||||
Techo para los desamparados
|
||||
|
||||
Luz para los que leen
|
||||
Ágora para los que escriben
|
||||
|
||||
Libertad para los oprimidos:
|
||||
¡Libertad, libertad, libertad!
|
||||
```
|
||||
|
||||
``
|
||||
|
||||
# Earlier
|
||||
|
||||
- The following is a snapshot of some of the fragments I contributed; the source of truth now lives in [[Overleaf]] as of [[2024-09-28]].
|
||||
- The following is a snapshot of some of the fragments I contributed earlier/initially; the source of truth moved to [[Overleaf]] as of [[2024-09-28]], until [[2026]] when it fragmented/came back to Markdown.
|
||||
|
||||
## Gloria
|
||||
|
||||
@@ -138,6 +193,8 @@ Sus rayas bellas!
|
||||
|
||||
-
|
||||
|
||||
(This became a song)
|
||||
|
||||
Bella muy bella Burup
|
||||
Bella muy bella Burup
|
||||
|
||||
@@ -148,7 +205,7 @@ True Burup
|
||||
|
||||
## Las Jaras
|
||||
|
||||
I once found this card at the confluence of two rivers and it answered a question.
|
||||
I once found this card at the confluence of two rivers and it answered a question (this is still true.)
|
||||
|
||||
```
|
||||
Las jaras:
|
||||
@@ -195,6 +252,8 @@ Go with love!
|
||||
|
||||
## Tara
|
||||
|
||||
(This became a mantra.)
|
||||
|
||||
```
|
||||
Tare tuttare ture:
|
||||
Tuttare tuttare ture.
|
||||
@@ -208,19 +267,26 @@ Maitre ya!
|
||||
|
||||
```
|
||||
|
||||
# Outro
|
||||
## Carcaj
|
||||
|
||||
Llevo en mi carcaj dos jaras:
|
||||
#Flancia y el [[Agora]]!
|
||||
[[Flancia]] y el [[Agora]]!
|
||||
|
||||
Las jaras, qué jaras?
|
||||
|
||||
Las de Avalokiteshvara
|
||||
Las de Tara
|
||||
Las de Maitreya!
|
||||
|
||||
## Rainbow folding
|
||||
We will be
|
||||
like a [[rainbow folding]],
|
||||
like [[Maitreya flowing]]
|
||||
|
||||
##
|
||||
We will be straight, straight, straight!
|
||||
Straight like an arrow
|
||||
|
||||
Like an arrow,
|
||||
true to self
|
||||
|
||||
Ever bending
|
||||
|
||||
like a [[rainbow folding]],
|
||||
|
||||
|
||||
Reference in New Issue
Block a user