14 posts about #Infrastructure
Fake HTTP responses and response times
If you need an HTTP endpoint replying with a specific HTTP status code or taking a specific response time: try https://httpstat.us!
For example:
- return a 200 OK success status, taking 5 seconds: https://httpstat.us/200?sleep=5000
- return a 400 Bad Request: https://httpstat.us/400
Hyphens and underscores in mysql.cnf
According to this bug_and - may both be used in mysql / mariadb configuration options inside the mysql.cnf file.
E.g.
[mariadb]
log-bin # enable binary loggingand
[mariadb]
log_bin # enable binary loggingare both ok!
For googling and searching inside pages the _ variant usually works better.
TIL to log-into til.giantmonkey.de
I needed some time because it’s not obvious, but now it’s easy. Just open https://til.giantmonkey.de/admin and sign in with your giant monkey google account …
Ripgrep: searching with negative lookahead
Using ripgrep we can search using PCREs. First we need to enable pcre expressions in ~/.ripgreprc:
--pcre2Then we can search for all occurences of mywordnot followed by _:
> rg 'myword(?!_)'
TIL how to check the progress of a recursive grep
If you want to check the progress of a recursive grep, going trough lots of files, just sudo ls -lah /proc/[GREP PID]/fd. You’ll see which files grep is accessing at the moment, which will give you an idea how far it is in the search.
Ansible: decrypt single vault value in the shell
$ ansible localhost -m debug -a 'var=my_password'
localhost | SUCCESS => {
"my_password": "not secret anymore"
}
You can jump to slash in zsh
After changing from bash to zsh I found it quite annoying that ⌥ + ← was always jumping to the closest white character, instead to space or slash (or some other special characters considered to be word-separators).
Fortunately it’s possible to change this behaviour by editing the WORDCHARS env variable.
Source: https://github.com/ohmyzsh/ohmyzsh/issues/5108#issuecomment-233480020
Tom's Obvious, Minimal Language isn't so obvious
TIL that order really matters when it comes to Tom’s Obvious, Minimal Language aka TOML.
https://gitlab.giantmonkey.de/docker/gitlab-runner/-/merge_requests/20
Breaking the runner
Today I learned that our GitLab runner deploys itself. Which means that if you push a change which breaks it, later when you’ll try to fix it, it won’t be there to deploy the fix.
Cloud Tasks need App Engine to be enabled
Today I learned that even though cloud tasks are a separate product now they still need your App Engine project to be enabled. Otherwise, all tasks will just hang and any attempt of forcing them to execute will result in a 500 error.
Using ngrok with puma-dev
If you have a local Rails/Rack server running using puma-dev, e.g. http://gomus.test and you want to use ngrok for accessing this server from remote, you can pass a --host-header=gomus.test to ngrok.
ngrok http --host-header=gomus.test localhost:80Happy hacking!
Fixing file permissions in git repository
If you mess up your file permissions in a git repository you can easily reset them back to how they were with this simple command:
git diff -p -R --no-color \
| grep -E "^(diff|(old|new) mode)" --color=never \
| git applyFrom this gist: https://gist.github.com/jtdp/5443498
This is not a usual problem, and can if on the off chance it does occure you can normally solve it by a simple checkout or hard reset, but in my case I also had uncommited changes to files in the repository alongside the permission changes which I really wanted/needed to keep!
Sidenote
If you are wondering how you could end up in this situation in the first place… well, my story is I backed up a complete copy of my projects folder onto a HD when I installed my laptop from fresh. This was the easiest way for me to ensure that I would have all of my local changes in projects just in case I had forgotten to commit and push somewhere! After copying them back every repo was full of file permission changes.
DGN provides free S/MIME certificates
The “Deutsches Gesundheitsnetz” offers free S/MIME certicate creation. These certificates work with Apple Mail (and presumably with Google Mail, but the steps for installing are not completely clear to me) and are valid for one year.