# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 9
# self = https://watcher.sour.is/conv/7jzbj7a
For some reason, I was using calc all this time. I mean, it’s good, but I need to do base conversions (dec, hex, bin) *very* often and you have to type base(2) or base(16) in calc to do that. That’s exhausting after a while.

So I now replaced calc with a little Python script which always prints the results in dec/hex/bin, grouped in bytes (if the result is an integer). That’s what I need. It’s basically just a loop around Python’s exec().

$ mcalc
> 123
123 0x[7b] 0b[01111011]

> 1234
1234 0x[04 d2] 0b[00000100 11010010]

> 0x7C00 + 0x3F + 512
32319 0x[7e 3f] 0b[01111110 00111111]

> a = 10; b = 0x2b; c = 0b1100101
10 0x[0a] 0b[00001010]

> a + b + 3 * c
356 0x[01 64] 0b[00000001 01100100]

> 232 - 1
4294967295 0x[ff ff ff ff] 0b[11111111 11111111 11111111 11111111]

> 4 * atan(1)
3.141592653589793

> cos(pi)
-1.0
=
For some reason, I was using calc all this time. I mean, it’s good, but I need to do base conversions (dec, hex, bin) *very* often and you have to type base(2) or base(16) in calc to do that. That’s exhausting after a while.

So I now replaced calc with a little Python script which always prints the results in dec/hex/bin, grouped in bytes (if the result is an integer). That’s what I need. It’s basically just a loop around Python’s exec().

$ mcalc
> 123
123 0x[7b] 0b[01111011]

> 1234
1234 0x[04 d2] 0b[00000100 11010010]

> 0x7C00 + 0x3F + 512
32319 0x[7e 3f] 0b[01111110 00111111]

> a = 10; b = 0x2b; c = 0b1100101
10 0x[0a] 0b[00001010]

> a + b + 3 * c
356 0x[01 64] 0b[00000001 01100100]

> 232 - 1
4294967295 0x[ff ff ff ff] 0b[11111111 11111111 11111111 11111111]

> 4 * atan(1)
3.141592653589793

> cos(pi)
-1.0=
For some reason, I was using calc all this time. I mean, it’s good, but I need to do base conversions (dec, hex, bin) *very* often and you have to type base(2) or base(16) in calc to do that. That’s exhausting after a while.

So I now replaced calc with a little Python script which always prints the results in dec/hex/bin, grouped in bytes (if the result is an integer). That’s what I need. It’s basically just a loop around Python’s exec().

$ mcalc
> 123
123 0x[7b] 0b[01111011]

> 1234
1234 0x[04 d2] 0b[00000100 11010010]

> 0x7C00 + 0x3F + 512
32319 0x[7e 3f] 0b[01111110 00111111]

> a = 10; b = 0x2b; c = 0b1100101
10 0x[0a] 0b[00001010]

> a + b + 3 * c
356 0x[01 64] 0b[00000001 01100100]

> 232 - 1
4294967295 0x[ff ff ff ff] 0b[11111111 11111111 11111111 11111111]

> 4 * atan(1)
3.141592653589793

> cos(pi)
-1.0
=
@movq That sounds super useful! I always used bc and ibase=2/obase=2 for conversions. But your digit grouping is what I always lacked. I gotta switch.
@lyse That’s the script, if you’re interested: https://www.uninformativ.de/git/bin-pub/file/mcalc.html
@lyse That’s the script, if you’re interested: https://www.uninformativ.de/git/bin-pub/file/mcalc.html
@lyse That’s the script, if you’re interested: https://www.uninformativ.de/git/bin-pub/file/mcalc.html
@lyse That’s the script, if you’re interested: https://www.uninformativ.de/git/bin-pub/file/mcalc.html
@movq Thanks! I already found it and patched it to run in my ancient Python version (no match keyword and exec(…) only allows globals and locals as positional arguments). :-) https://lyse.isobeef.org/tmp/mcalc-patched.py.txt