serhii.net

In the middle of the desert you can say anything you want

06 May 2020

Day 492

Searching in quotes

TIL DDG doesn’t allow me to search for exact matches in quotes, which I find absolutely idiotic. Yandex works, Google works. The usual “I want to like ddg but I honestly can’t”

To read / interesting

/g/ - Let’s collect here programming books that are unusual in some sense, be it their approach, presentation, or simply just quality. “The little schemer” has a nice dialog-like structure, and I find this very interesting. I wonder if there are any other similar books (or threads).

Editing bash scripts

Take care editing bash scripts

Well, after the 30 seconds elapses, the running script deletes all of my files. This happens because bash reads the content of the script in chunks as it executes, tracking where it’s up to with a byte offset. When I delete one character from the sleep line, the “next command” offset points at the r in #rm instead of the #. From the interpreter’s point of view, the # shifts backwards onto the previous line so it runs the unfortunate command.

javascript:(function(){(function () {var i, elements = document.querySelectorAll('body *');for (i = 0; i < elements.length; i++) {if (getComputedStyle(elements[i]).position === 'fixed') {elements[i].parentNode.removeChild(elements[i]);}}})();document.querySelector('body').style.setProperty('overflow','auto','important'); document.querySelector('html').style.setProperty('overflow','auto','important');})(), found in One of my favorite bookmarklets to remove cookie notifications or other obnoxiou… | Hacker News

To run it as bookmarklet in qutebrowser, jseval works:

:jseval (function(){(function () {var i, elements = document.querySelectorAll('body *');for (i = 0; i < elements.length; i++) {if (getComputedStyle(elements[i]).position === 'fixed') {elements[i].parentNode.removeChild(elements[i]);}}})();document.querySelector('body').style.setProperty('overflow','auto','important'); document.querySelector('html').style.setProperty('overflow','auto','important');})()

Now bound to ,b:

config.bind(",b", ":seval (function(){(function () {var i, elements = document.querySelectorAll('body *');for (i = 0; i < elements.length; i++) {if (getComputedStyle(elements[i]).position === 'fixed') {elements[i].parentNode.removeChild(elements[i]);}}})();document.querySelector('body').style.setProperty('overflow','auto','important'); document.querySelector('html').style.setProperty('overflow','auto','important');})()")

And as a bonus, ,w now takes me to the wayback machine for that page:

config.bind(",w", ":jseval javascript:location.href='https://web.archive.org/web/*/'+location.href")

Qutebrowser show all bindings

:bind opens a page with all the bindings as currently configured. This answered a lot of my quesions, especially about the caret mode bindings that are not documented anywhere I could find. What’s interesting is the Ctrl-e in Insert mode that opens the editor (I usually did Esc+e)

Nel mezzo del deserto posso dire tutto quello che voglio.