Fork me on GitHub
#clojure-europe
<
2021-02-10
>
dharrigan06:02:03

Good Morning!

genRaiy08:02:11

More Ning

ordnungswidrig09:02:45

Quick, can you use babashka to pretty print an edn file easily?

ordnungswidrig09:02:58

^--- Could not resolve symbol: pprint/pprint

borkdude09:02:01

@ordnungswidrig

bb -e '(clojure.pprint/pprint (edn/read-string (slurp "deps.edn")))'

ordnungswidrig09:02:08

bb -I -e '(clojure.pprint/pprint (first *input*))'

ordnungswidrig09:02:44

hmmm, I wonder if an output parameter --pretty would make sense.

borkdude09:02:54

I is only needed when you are reading multiple top level EDN values from stdin

ordnungswidrig09:02:22

well, read-string also only returns the first one, doesn’t it?

borkdude09:02:33

What I meant is *input* reads EDN by default, no other flags needed

borkdude09:02:47

unless you want to read e.g. {:a 1} {:b 2} from stdin without a wrapping coll

ordnungswidrig09:02:52

So bb -e '(clojure.pprint/pprint *input*)' -O actually does it. ☝️

borkdude10:02:53

@ordnungswidrig Actually cat deps.edn | bb -e '(clojure.pprint/pprint *input*)' is sufficient

ordnungswidrig10:02:29

cljoure commandline golf 😛

borkdude10:02:54

I should maybe map the REPL requires (pprint, etc,) also to the user namespace, so you can just write (pprint *input*) and (doc inc) for one-liners

ordnungswidrig10:02:47

That’d be awesome

borkdude10:02:49

$ bb -e '(clojure.repl/doc inc)'
-------------------------
clojure.core/inc
([x])
  Returns a number one greater than num. Does not auto-promote
  longs, will throw on overflow. See also: inc'

borkdude09:02:33

@ordnungswidrig I use this tool for pretty-printing including colors on the terminal: https://github.com/borkdude/puget-cli

borkdude09:02:45

Just cat deps.edn | puget

ordnungswidrig09:02:43

clojure -M -e "(require 'clojure.pprint) (clojure.pprint/pprint (clojure.edn/read-string (slurp *in*)))" This also works where you have no babashka

borkdude09:02:18

yep. the same expression also works when you do have bb

ordnungswidrig09:02:29

I’ve just registered a name on ENS with ethers I have trader with Lumens and it was the most thrilling thing I did in the recent past.

javahippie10:02:28

I believe that Ethereum is the most interesting and complex tech project of the decade. And now that they reduce energy consumption, it’s also a little more responsible

ordnungswidrig10:02:10

I read that the miners nowadays use more and more rather excess engery e.g. from hydro plants in china.

otfrom10:02:03

hmm... hydro never needs to be excess tho

javahippie10:02:52

I read that, too. That those damns in China would have no use for the excess energy, and cannot sell it to anybody, so it’s okay for it to go to Bitcoin & Co. Always wanted to read up on that

otfrom10:02:18

that isn't how hydro works tho, there should never be "excess hydro" tho there can be excess capacity to produce more electricity

otfrom10:02:40

you can have excess coal and nuclear, but if you create a market to sell that at a good cost you remove the incentive to get rid of it

otfrom10:02:19

you can have excess wind and solar (as they are intermittent) and that is probably a sort of good thing to use the electricity on, but it would have to be a better use than storage

otfrom10:02:27

(the original Mastodon idea was to use unused baseload power to do big data analytics w/o increasing co2 emissions (follow the moon rather than follow the sun), when we ran the numbers, doing things on 0ish carbon sources was far, far better)

cdpjenkins11:02:08

I thought the nice thing about hydro is you can turn it on at times of peak demand (and deplete the contents of the reservoir) and then turn it off when demand is sufficiently low to be served by power sources that you can’t turn off and on so easily (and allow the reservoir to fill up again during those times). I don’t really understand how you’d end up with peak hydro power, unless the reservoir gets completely full or something.

cdpjenkins11:02:05

Other types of power plants - e.g. coal/nuclear - take much longer to start up and shut down so there are situations where there might not be much demand for power right now but you still have to keep running the plant, so you could possible advance an argument that meh, you might as well do bitcoin mining during that time, and as otfrom points out, you don’t get to choose how much power you get from wind/solar at anmy particular moment (depends on the weather etc).

otfrom16:02:28

I'm having fun now learning about the difference between follow power (30-40 min up and down) and burst power (in fewer minutes) and stored hydro. https://www.sserenewables.com/hydro/foyers/ Interesting that they were going to use the excess baseload power from a nearby nuke, but it looks like it didn't happen. The reasons seem a bit Chernobyl level "yikes" https://en.wikipedia.org/wiki/Hunterston_B_nuclear_power_station

cdpjenkins11:02:01

Anyway, you should probably listen to otfrom and not to me about this stuff.

val_waeselynck12:02:10

Note that there are also hydro plants on rivers rather than in mountains; for those, you don't have much control over the power, and you can't do much storage.

val_waeselynck12:02:26

But to be frank folks, having spent quite a bit of time studying climate and energy issues, when I see Bitcoin advocates telling us that Bitcoin mining is the best use for that electricity, it seems to me that they're simply not conscious of what's at stake with energy in the 21st century, and not really treating it as something precious. The task of replacing fossil fuels is absolutely daunting even when being optimistic about renewables, and the goal of the energy transition should be to preserve what we can on basic needs like heating, food security, healthcare and mobility while limiting damage, not to advance the world into a transcending new digital era. We just won't be that high in the Maslow pyramid. This reality is especially hard to accept for us programmers, who have made a career out of digital progress. E.g if we had so much excess decarbonized power that we don't know what to do with it, we should probably first spend it on hydrogen generation or other industrial applications.

👍 12
borkdude12:02:51

I'm ignoring bitcoin as hard and as long as I can.

val_waeselynck12:02:24

Don't ignore it - undermine it 😉

😂 7
🙌 3
thomas13:02:52

I like the idea of a decentralised currency, but BTC is not that (certainly at the moment)

val_waeselynck15:02:27

I also find the idea of decentralised interesting. That being said, I recently read a book (in French, sorry) about financing the environmental transition via careful state-managed money creation rather than debt (yup, printing money, you read that right). I found it made a convincing case for an approach that is a polar opposite to decentralised currency. Essentially, such an approach can be seen as a society collectively deciding to re-organize its priorities (and therefore wealth distribution and flows) via monetary power rather than just state taxes and expenditures, which are showing their limits currently. It seems all the more relevant than the current structure of debt is so much tied to fossil assets, and that Europe shows signs of a deflationary spiral. As an exemple of historical "success" of this approach, they point to how Nazi Germany used that strategy to recover from their economic crisis and rise up to an industrial powerhouse in just a few years (as neighbouring countries so painfully experienced during WW2). The American New Deal and French reconstruction after WW2 are other examples. For those interested who can read French: https://www.odilejacob.fr/catalogue/sciences/sciences-de-la-terre/une-monnaie-ecologique_9782738152220.php

👍 3
val_waeselynck15:02:27

I also find the idea of decentralised interesting. That being said, I recently read a book (in French, sorry) about financing the environmental transition via careful state-managed money creation rather than debt (yup, printing money, you read that right). I found it made a convincing case for an approach that is a polar opposite to decentralised currency. Essentially, such an approach can be seen as a society collectively deciding to re-organize its priorities (and therefore wealth distribution and flows) via monetary power rather than just state taxes and expenditures, which are showing their limits currently. It seems all the more relevant than the current structure of debt is so much tied to fossil assets, and that Europe shows signs of a deflationary spiral. As an exemple of historical "success" of this approach, they point to how Nazi Germany used that strategy to recover from their economic crisis and rise up to an industrial powerhouse in just a few years (as neighbouring countries so painfully experienced during WW2). The American New Deal and French reconstruction after WW2 are other examples. For those interested who can read French: https://www.odilejacob.fr/catalogue/sciences/sciences-de-la-terre/une-monnaie-ecologique_9782738152220.php

👍 3
val_waeselynck16:02:51

Yeah, pumped hydro is awesome. And to think of those barbarians that choose to live in plains rather than mountains, forcing us to have thermal power stations.

val_waeselynck16:02:41

(Seriously though, hydro is not all good. There are risks associated with it, and it causes more environmental damage than we used to think)

otfrom16:02:29

yeah, hydro can be bad for the rivers and other waterways they are on and big dams can damage communities and ecosystems and fail catastrophically (as witness recent events)

val_waeselynck16:02:08

Also emits more methane than we used to think a few decades ago.

otfrom16:02:40

which bits emit the methane?

val_waeselynck16:02:56

Anaerobic decomposition of flooded biomass.

otfrom16:02:37

I thought that might be the case. I wonder then about whether that methane could be captured and then burned (not sure where the economic/tech tipping points are on that)

val_waeselynck17:02:32

I'd be surprised if that were the case - I guess if those emissions were concentrated enough to make that viable, we'd have detected them sooner, and more accurately 🙂

otfrom17:02:43

sounds like it is a location dependent (or exacerbated) problem. I think there are some other river based systems that don't have the big reservoir problem (I'd have to dig up sources)

otfrom16:02:13

I like anaerobic digesters for power as well. 🙂

❤️ 7
genRaiy14:02:25

Also see her writing on Indian dams - a very impressive summary of the BS around such projects as well as explaining how local and Western elites benefit from such projects more than the locals https://en.wikipedia.org/wiki/Arundhati_Roy#Sardar_Sarovar_Project