silas

joined 2 years ago
[–] [email protected] 4 points 1 month ago (1 children)

Yeah, I ended up using awk, which solved my problem perfectly. I was just curious if I could do that with sed, but it seems too complicated. Thank very much, guys!

 

Hi there!

Usually, sed can be used in different ways, but most of the time we use it to match lines in a file against a fixed regexp. Some examples:

This replaces ocurrences of regexp for "foo":

sed 's/regexp/foo/g' < myfile

This prints all lines that have "foo", but will change the first "o" in the line for an "a":

sed -n '/foo/s/o/a/p' < myfile

and so on...

But I tried to do a different thing, with no success: can I pass to sed a file with a bunch of regular expressions and test them against a fixed string? I tried to play with pattern space, hold space, with no success. It just seems impossible to use them (which would be the closest to "variables") in search commands.

I know sed is Turing complete, but using it that way would maybe require to implement a regexp engine from scratch?

Thanks!

 

Hi. We successfully store secrets in ansible variables files with either ansible-vault or sops. It is a good approach when Ansible itself configures something that requires a secret, such as configuring a database admin password.

But I'd like to ask you about how you store secrets meant to be used by applications. Example: we have a an application in PHP with a config.php file with all credentials needed by the application. Developers have a config.php setup to work with the test environment, while we maintain a different config.php for production in production machines. Nowadays this config.php file is stored in ansible repository, encrypted by ansible-vault or sops. We thought about moving the config.php production file to the application repository, so we could get advantage of the CI/CD pipeline.

It doesn't smell right, because it would require to encrypt it somehow, and store keys to decrypt it in CI/CD, but I decided to ask you anyway what do you think of that and how you solved it yourselves.

Thanks!

 

The Pentel Smash mechanical pencil is usually compared to the Pentel Graphgear 1000, but I'd like to ask you comparing Smash to Graphgear 500.

Where I live, both are expensive mechanical pencils, but Smash is 70% more expensive and, IIUC, more professional. I'd like to know whether it pays to choose Smash over Graphgear 500 or both are kind of similar so I should go to Graphgear 500.

Do you know them? How do you compare both?

Thanks!