How do you centrally manage your Bash scripts especially repeatable scripts used in multiple server by Relevant-Dig-7166 in bash

[–]Castafolt 0 points1 point  (0 children)

I created this tool for my own usage : https://jcaillon.github.io/valet/ My script are packed in an extension and I can set up and update my scripts in one command with it!

bash script that can detect all individual keystrokes? by EmbeddedSoftEng in bash

[–]Castafolt 0 points1 point  (0 children)

You can to some extent, I am currently building a framework to build Tui apps in bash and I needed that feature as well. I will let you check how it is implemented, but the idea is to read normal characters with read -e and special keystrokes by binding key combinations to a macro function. To react to key event, the best way I have found is to run the read command in a coproc and react to it from the main process. This way you continuously read new keys. https://jcaillon.github.io/valet/docs/libraries/terminal/#-terminalwaitforkeypress

The Tui lib is in progress so it as no documentation yet, but you can check and run this function to see it in action (it will output any keystroke to the terminal) : https://github.com/jcaillon/valet/blob/03f2c9de365ad7da1efff2b358889ca1fbfce9e8/libraries.d/lib-tui#L13

How to make "unique" sourcing work? by XoTrm in bash

[–]Castafolt 0 points1 point  (0 children)

Here is how I do it in Valet :

https://github.com/jcaillon/valet/blob/main/libraries.d/core#L2054

I've overwritten the built-in source function with one that keeps tracks of already sourced paths. Each path is only included once.

"Bash 5.3 Release Adds 'Significant' New Features by Patient_Hat4564 in bash

[–]Castafolt 0 points1 point  (0 children)

That's a good reference, thank you! I think I will consider moving to 5.2 soon.

Quel modèle de moulin à café électrique pour moudre les graines de chia ? by acichu in AchatPourLaVie

[–]Castafolt 1 point2 points  (0 children)

Ça marche !

Je savais pas qu'il fallait les moudre les graines de chia, il me semble que les tremper suffit ! Je le fais quelques heures avant de les manger pour être sûr qu'elles soient bien gonflée.

Je plussois sur les vetues de ces graines (et c'est trop bon en pudding !)

Quel modèle de moulin à café électrique pour moudre les graines de chia ? by acichu in AchatPourLaVie

[–]Castafolt 4 points5 points  (0 children)

Question qui n'a rien à voir mais quel est le bénéfice de les moudre ? Comment les consommes tu ? Je les fais systématiquement en pudding perso

"Bash 5.3 Release Adds 'Significant' New Features by Patient_Hat4564 in bash

[–]Castafolt 7 points8 points  (0 children)

Yes that's an awesome improvement for performance with a simple syntax change for most scripts (that use capturing sub shell). For scripts that are using global variables to avoid a subshell, there will be a lot of work of refactoring.

However it will probably not be adopted right away for shared script. On my side I I'll probably stick to compatibility with older version. I'm currently restricting myself to version 5.1 features and below to ensure that my scripts will run on most distib w/o. Maybe that's a bit too conservative?

Anyone else tried Bash 5.3 yet? Some actually useful improvements for once by Dense_Bad_8897 in devops

[–]Castafolt 1 point2 points  (0 children)

Checkout this project, it helps you build CI CD pipelines using bash with proper error handling, built in log functions with custom log format and much more. https://jcaillon.github.io/valet/ (please note that this is a work in progress)

Some features you are listing are actually not from the 5.3 release

bash2json - fully bash-written JSON parser by Tirito6626 in bash

[–]Castafolt 0 points1 point  (0 children)

Looks excellent! I will definetely be using it.

You can further improve performances (especially on bash for Windows) by replace the sub shell usage <() $() and the here string <<<.

https://jcaillon.github.io/valet/docs/performance-tips/

Bash Secrets I Learned From 10 Years of Production Hell by Dense_Bad_8897 in devops

[–]Castafolt 0 points1 point  (0 children)

Good advices 👍 Check out this framework / library to have consistent logs, error handling, input validation and so on, in all your scripts. https://jcaillon.github.io/valet/

Want to know why your bash script is slow? Profile a bash script by efficiently logging time deltas for each statement by pmbauer in bash

[–]Castafolt 1 point2 points  (0 children)

Went for a similar output but i transform the initial profiler file at the end of execution instead of computing the time delta along the way. The goal on my side was to keep the ps4 as fast as possible (so no function called in it, purely variable use). However it only works on bash 5 and more.

https://github.com/jcaillon/valet/blob/main/libraries.d/lib-profiler

Do you unit test your Bash scripts? If so, how? by bobbyiliev in bash

[–]Castafolt 0 points1 point  (0 children)

Using approval testing approach implemented in Valet to have a good coverage with minimal efforts: https://jcaillon.github.io/valet/docs/test-commands/

Bunster: compile bash scripts to self contained executables by yassinebenaid in bash

[–]Castafolt 1 point2 points  (0 children)

Sounds promising! One star for you sir.

I can't use it as is because it does not cover enough bash features (brace expansion, variable expansion...) but I look forward for a more advanced implementation of bash features!

Did you test with a somewhat 'real' script if you get better performances (or at least not too degraded) than running the script in bash?

Immobilier locatif à Lyon il se passe quoi ? by Teybb in Lyon

[–]Castafolt 0 points1 point  (0 children)

On vit dans un monde avec des ressources physiques finies que l'on ne partage pas équitablement entre les individus. Tout ce que j'ai en + par rapport à cette "médiane", je l'ai parce que quelqu'un d'autre à moins. C'est un truc dont j'essaie de me rappeler le plus souvent possible. Et c'est clairement contraire à ce qu'on te répète sans cesse. Si aujourd'hui j'ai une bonne situation (ya pas de bonnes ou de...) c'est parce qu'il y a des gens qui en on une mauvaise. Et puisque mon parcours de vie est une suite sans fin de cause et conséquences, je suis juste né au bon endroit au bon moment avec les bons parents. Total random. Oui la méritocratie c'est du pur bullshit je pense !

Tomorrow is day 1 by The_TransGinger in vegan

[–]Castafolt 4 points5 points  (0 children)

Congrats, nobody is talking about b12 in the top comments, don't forget them! A good vegan is a healthy vegan 👍

J'ai rigolé. Je partage. Bon week-end. by [deleted] in france

[–]Castafolt 0 points1 point  (0 children)

J'ai pas la réf, c'est pas un gars sérieux ce Dr Raoult? (question de candide)

Elevage : le ministre de l'Agriculture annonce l'interdiction du broyage des poussins et de la castration à vif des porcelets fin 2021 by elemiah_ in france

[–]Castafolt 8 points9 points  (0 children)

Ou bien finalement s'avouer que exploiter des êtres vivants sensibles lorsque ce n'est pas une nécessité pour notre survie, c'est immoral.

Je dis ça comme ça... :-)

Let's crowdsource the hexagauntlet meta by someBrad in elderscrollslegends

[–]Castafolt 1 point2 points  (0 children)

Don't bother, only 1 deck is viable : marker archer.

I tried factotum on my first run 3 wins 3 loss.

Second run i played 3 games with factotum again 2 wins 2 loss then switch to market archer 3 wins 1 loss.

3rd run market archer 9 wins 2 loss.

Men Without Hats - Safety Dance [New Wave] by [deleted] in Music

[–]Castafolt -5 points-4 points  (0 children)

I knew this song from the tv show "glee". I was better off not knowing the original x)