silas

joined 2 years ago
[–] silas@lemmy.eco.br 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. I'm playing emulated Driver using pcsxr on Linux. Sometimes, when I'm being chased by three or more police cars for example, I'm observing a drop rate (from ~59 fps to ~45 fps). I first thought my computer (which is an old i3 540!), but I soon changed my mind because of two reasons:

  1. I was playing 1080p, but when I decreased resolution to 480p, this problem persisted.

  2. When I disabled emulator frame rate limiting, it jumped to ~120 fps and it dropped to only ~90 fps on other situations. Well, it is impossible to play the game in this situation as it seems you are playing in fast-forward mode.

Because of that, I thought that the game itself could be dropping frames in some situations. Maybe it is considering the limitations of original PS1 hardware and prefer to drop frames instead of delaying the game itself? If this is right, it is impossible to "fix" it changing the emulator configuration. Unfortunately I have no PS1 original hardware to test it myself.

Thanks!

P.S.: I recently discovered there is a Driver game for PC which seems to run much better, but now I'm past half of the PS1 version, so it is not worth to start it over again :-)

[–] silas@lemmy.eco.br 1 points 2 years ago (1 children)

Pelo que entendi tem que copiar as configurações de group_vars/all.yml para inventories/<suamaquina>/group_vars/nas.yml e alterá-las nesse arquivo, conforme as suas necessidades né?

[–] silas@lemmy.eco.br 3 points 2 years ago* (last edited 2 years ago) (3 children)

Olha, eu aprendi tudo lendo a documentação oficial mesmo (em inglês). Mas passa aqui o erro que tá dando ou a dificuldade que você tá tendo, quem sabe a gente consegue te ajudar.

[–] silas@lemmy.eco.br 3 points 2 years ago (5 children)

Olás. Você já está escrevendo o próprio playbook ou está usando algo pronto? Sem trecho de código ou mensagens de erro fica difícil de saber qual o problema.

 

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!