Let's say you have a json like {"foo": {"bar-baz": true}}. Dashes in the keys make it impossible to look for jq '.foo.bar-baz'. you look around and you read that you should use ["bar-baz"]. the thing is that you have to use that syntax everywhere in your query.
jueves, 30 de mayo de 2019
jq accessing fields with dashes
solving lnav truncate files
lnav is an awesome tool for browsing logs. I'm not sure what are most of the people doing with logs.... tail -f? grep? anyway...
Sometimes log files get suddently truncated, and when you're doing development, you don't want lnav to be always refreshing itself with the current contents of the files.
just using a bit of unix magic, we can log our files with "lnav <(tail -F logs/access.log)".
Sometimes log files get suddently truncated, and when you're doing development, you don't want lnav to be always refreshing itself with the current contents of the files.
just using a bit of unix magic, we can log our files with "lnav <(tail -F logs/access.log)".
domingo, 12 de mayo de 2019
ncdu vs dired-du-mode
ncdu a very nice utility that does what you probably want to do when you do 'du -sh *' repeatedly in different directories.
ncdu allows for navigating through the directory structure seeing sizes and disk usage percentages of files and subdirectories. Also, has vi-friendly keybindings.
Of course, there's a way to do a very similar thing in emacs, which is using `dired-du-mode`. Take a look at the "c-x c-h" keybind to toggle human friendly numbers, and m-x dired-du-count-size to aggregate the sizes of all marked files.
ncdu allows for navigating through the directory structure seeing sizes and disk usage percentages of files and subdirectories. Also, has vi-friendly keybindings.
Of course, there's a way to do a very similar thing in emacs, which is using `dired-du-mode`. Take a look at the "c-x c-h" keybind to toggle human friendly numbers, and m-x dired-du-count-size to aggregate the sizes of all marked files.
jueves, 9 de mayo de 2019
preview files/links without changing the focus
I realized today that there's a consistent way (although not very intuitive to me) to peek (preview) a destination of a clickable thing without opening it.
It's "C-o". Of course, it is very useful for browsing and exploring purposes. Just try it in dired, occur, ibuffer, rg, and probably many more.
In most of those modes "o" "opens" a buffer on the destination and gives the focus to it, so I guess "C-o" makes sense, it's just I'm so used to hit RET that I never think of "C-o".
Anyway, I hope you find this one helpful
It's "C-o". Of course, it is very useful for browsing and exploring purposes. Just try it in dired, occur, ibuffer, rg, and probably many more.
In most of those modes "o" "opens" a buffer on the destination and gives the focus to it, so I guess "C-o" makes sense, it's just I'm so used to hit RET that I never think of "C-o".
Anyway, I hope you find this one helpful
dashes-to-dashes goes "serverless"
jq is a known tool nowadays, with lots of uses everywhere in the industry.
Today I just replaced dashes-to-dashes api that is hosted in heroku, (it is a single endpoint that did a json transformation) to a jq script that can live in a github, and travis can be the one that runs and self publishes itself, putting the json in the github page of the repo, so it's fast, statically served, and requires no heroku dinos to keep it running.
If something, I learnt about extracting keys from a hash in jq
Today I just replaced dashes-to-dashes api that is hosted in heroku, (it is a single endpoint that did a json transformation) to a jq script that can live in a github, and travis can be the one that runs and self publishes itself, putting the json in the github page of the repo, so it's fast, statically served, and requires no heroku dinos to keep it running.
If something, I learnt about extracting keys from a hash in jq
Suscribirse a:
Entradas (Atom)