Compare commits

45 Commits

Author SHA1 Message Date
flancian 341c4a3edb autopushed 2023-10-15 02:29:50 +02:00
flancian d9b13d8976 autopushed 2023-10-15 01:26:34 +02:00
flancian 363818436a autopushed 2023-10-15 01:24:53 +02:00
flancian 3e8e22e0e2 autopushed 2023-10-15 01:24:19 +02:00
flancian 61f5724101 autopushed 2023-10-15 01:10:20 +02:00
flancian 31fbecfba8 autopushed 2023-10-15 01:09:46 +02:00
flancian 2a82de3a9d autopushed 2023-10-15 01:09:12 +02:00
flancian 252361433d autopushed 2023-10-15 00:50:44 +02:00
flancian e1b989680d autopushed 2023-10-15 00:50:11 +02:00
flancian 953d9da069 Symlink 2023-10-15 00:48:22 +02:00
flancian 32f525ff34 Add simple dice-throwing utility :) 2023-10-15 00:42:30 +02:00
flancian bbf20dc60a autopushed 2023-10-14 23:46:22 +02:00
flancian ec27c51dec autopushed 2023-10-14 23:45:48 +02:00
flancian 0e8365e442 autopushed 2023-10-14 23:37:25 +02:00
flancian cd42f3c692 autopushed 2023-10-14 23:36:51 +02:00
flancian bb43d6eb13 autopushed 2023-10-14 23:36:17 +02:00
flancian 193775f994 autopushed 2023-10-14 23:35:43 +02:00
flancian 40022b71cd autopushed 2023-10-14 23:35:09 +02:00
flancian dac90d8562 autopushed 2023-10-14 23:34:35 +02:00
flancian 017039c012 autopushed 2023-10-14 23:32:54 +02:00
flancian f9e64e007a autopushed 2023-10-14 23:32:21 +02:00
flancian 3b8a0094de autopushed 2023-10-14 23:31:47 +02:00
flancian 32009ab2ab autopushed 2023-10-14 23:23:56 +02:00
flancian 935e444492 autopushed 2023-10-14 23:23:22 +02:00
flancian e3e575a9f2 autopushed 2023-10-14 23:22:49 +02:00
flancian 0dafd7ebaa autopushed 2023-10-14 22:50:22 +02:00
flancian cb6419c982 autopushed 2023-10-14 22:48:08 +02:00
flancian 88e7e2e252 autopushed 2023-10-14 21:59:29 +02:00
flancian 3542718e9f autopushed 2023-10-14 21:58:55 +02:00
flancian 1a2d2d48b3 autopushed 2023-10-14 21:58:21 +02:00
flancian 10bab69801 autopushed 2023-10-14 21:57:47 +02:00
flancian e7719a03f2 autopushed 2023-10-14 21:57:13 +02:00
flancian cb39621e97 autopushed 2023-10-14 21:56:39 +02:00
flancian d3b674a2e0 autopushed 2023-10-14 21:55:32 +02:00
flancian e1985bd945 autopushed 2023-10-14 21:54:58 +02:00
flancian a4cd9dc251 autopushed 2023-10-14 21:54:24 +02:00
flancian 35ec6381d0 autopushed 2023-10-14 21:53:51 +02:00
flancian 0fa80d61b9 autopushed 2023-10-14 21:53:17 +02:00
flancian 6a3d32748f autopushed 2023-10-14 21:51:36 +02:00
flancian a5eab0b0cb autopushed 2023-10-14 21:48:10 +02:00
flancian 72d3e90b9a autopushed 2023-10-14 21:47:35 +02:00
flancian 62f3323892 [[nostromo]] was hanging on a stale lock, trying to [[merge]] :) 2023-10-14 21:45:23 +02:00
flancian fd9343eadd autopushed 2023-10-14 20:06:51 +02:00
flancian 012412a30e autopushed 2023-10-14 20:03:55 +02:00
flancian f0369bec56 autopushed 2023-10-14 20:03:20 +02:00
10 changed files with 172 additions and 9 deletions
Executable
+53
View File
@@ -0,0 +1,53 @@
#!/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 :)
- 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)
def rand(n):
proof = []
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'}]].")
else:
proof.append(f"You throw a die of [[{i}]] sides and it comes up [[{r}]].")
return "\n".join(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)
if __name__ == '__main__':
dice()
+18 -9
View File
@@ -14,10 +14,17 @@ def factor(n):
for i in range(2, n+1):
click.echo(f"Is {i} a factor of {n}, I wonder?")
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):
is_prime = [True for n in range(0, n+1)]
sieve = [True for n in range(0, n+1)]
upto = math.ceil(math.sqrt(n))
for i, _ in enumerate(is_prime):
for i, _ in enumerate(sieve):
# click.echo(f"i: {i}")
if i < 2:
continue
@@ -25,7 +32,7 @@ def is_prime(n):
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 is_prime[i]:
if not sieve[i]:
continue
# for j in range(2, math.ceil(math.sqrt(n) + 1)):
for j in range(2, n):
@@ -34,11 +41,10 @@ def is_prime(n):
break
PROOF.append(f"[[{i*j}]] is composite: {i} * {j}.")
try:
is_prime[i*j] = False
sieve[i*j] = False
except IndexError:
continue
# click.echo(f"Sieve: {is_prime}.")
return is_prime[n]
return (n >= 2 and sieve[n], sieve)
class AgoraCmd(click.Command):
def format_help(self, ctx, formatter):
@@ -65,11 +71,14 @@ class AgoraCmd(click.Command):
@click.argument('n', type=click.INT)
def prime(n):
"""Simple program that factors a number using a [[Sieve of Eratosthenes]]."""
if is_prime(n):
click.echo(f"[[{n}]] is prime.")
p, sieve = is_prime(n)
if p:
click.echo(f"*{n}* is *prime*.")
else:
click.echo(f"{n} is not prime. Want proof? :)")
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"\nPrimes up to {n}: {print_sieve(sieve)}.")
if __name__ == '__main__':
prime()
+1
View File
@@ -0,0 +1 @@
prime.py
Executable
+42
View File
@@ -0,0 +1,42 @@
#!/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/prompt to execute this file in the Agora of Flancia.
- Visit e.g. anagora.org/prompt/foo to prompt known models with 'foo'.
- 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('s', type=click.STRING)
def prompt(s):
"""A simple utility to redirect to generation providers."""
gen = f"https://anagora.org/{s}"
click.echo(gen)
if __name__ == '__main__':
prompt()
+1
View File
@@ -0,0 +1 @@
- You carry a [[set]] of [[dice]] in your [[bag of holding]].
+7
View File
@@ -0,0 +1,7 @@
- Mi idioma materno.
Hola! Gracias por estar acá. Si encontraste este video en youtube o en otro repositorio de videos: bienenide! Espero que en este día (en el día en que encontrás esto) te esté yendo bien :)
Escribo esto en [[2023-10-03]]. Qué fecha es por allá?
Para contestar, podés visitar https://anagora.org/2023-10-03 y leer ese nodo, o visitar una [[Stoa]].
+1
View File
@@ -0,0 +1 @@
- #go https://www.youtube.com/watch?v=LXbYeJKcRf4
+28
View File
@@ -0,0 +1,28 @@
- [[work]]
- meetings with [[er-ch]]
- [[consultation doc]]
- [[proposal]]
- [[flancia]]!
- I've been thinking of [[flancia home]] in the context of [[mohammed]]
- [[37]]
- [[bodhi]]
[[Imaginate un mundo sin latencia]] me dije, habiendo solucionado los problemas de conectividad bluetooth en [[nostromo]] :)
A veces extraño el [[español]] como idioma.
- #push [[youtube]]
- the uploading experience even on studio.youtube.com leaves me unsatisfied :)
- it is slow, you need to perform a multitude of clicks to get to publish something
- friction should be much lower than this!
Mientras escribo esto, estoy escuchando [[hola frank]] de [[sumo]] :)
- Next I will work on a [[proposal]] within the context of my work in the [[er-ch]].
- And on my personal computer I will start work on [[x]] as the evening progresses :)
Let us pray, dice Luca Prodan :)
- Four hours later, I'm back here after three hours of work and then dinner+yoga.
- [[janet]] made me laugh: https://www.youtube.com/watch?v=LXbYeJKcRf4
+5
View File
@@ -0,0 +1,5 @@
- [[flancia]]!
- [[work]]
- [[er-ch]] gets intense sometimes
- still it's a privilege to represent [[zooglers]] and to some extent [[googlers]], meaning my fellow employees
- [[aldhari]]
+16
View File
@@ -5,4 +5,20 @@ Today is [[14 October 2023]] and I am glad you are here with me.
It has been ages since I've in Flancia, sometimes it feels, even as time is varying.
<hr />
Here is what I call a poem: [[trees]].
<hr />
This weekend I intend to advance what I call [[open letters]]: documents addressed to groups, openly published even as they are being written.
<hr />
As of 21:45 CET I did some 'day job' stuff (having chosen it) and started a proposal (open letter, as per the above) that I had on my todo list.
Now switching to [[paramita]], planning to continue on related topics but in the [[commons]].
<hr />
Today we bought the tickets to and from [[Sri Lanka]], happy about it!