Skip to content

Silveira Neto Posts

a page that downloads itself

<html><head>
    <title>Self-Downloading Page</title>
</head>
<body>
    <textarea id="textArea" rows="10" cols="50">Try writing here then click the button.</textarea><br>
    <button onclick="downloadPage()">Download This Page</button>
    
    <script>
        function downloadPage() {
            document.getElementById('textArea').textContent = document.getElementById('textArea').value;
            const html = document.documentElement.outerHTML;
            console.log(html);
            const blob = new Blob([html], { type: 'text/html' });
            const url = URL.createObjectURL(blob);
            const a = document.createElement('a');
            a.href = url;
            a.download = new Date().toISOString() + '.html';
            a.click();
            URL.revokeObjectURL(url);
        }
    </script>
</body></html>

misery loves company

Doctor Faustus asks Mephistophilis why Satan seeks to enlarge his kingdom. Mephistophilis replies with the Latin phrase: 

Solamen miseris socios habuisse doloris

This roughly translates to “It is a comfort to the unfortunate to have had companions in woe,” or simply “misery loves company”.

Doctor Faustus, by Christopher Marlowe, written in the late 16th century and first performed around 1594.

3 keys and knob keyboard

A very useful and also inexpensive mini keyboard found on AliExpress. Mine is the specifically this one. I have added the notes myself using a Brother P-touch label maker.

Here is the drivers and configuration application in a Google Drive. Note to myself: if this share is deleted, search for “3 key keyboard software-20251226T192116Z-3-001.zip” in your own Google Drive.

This is how the “MINI KeyBoard.exe” looks like:

It should display “Connected”. To modify each key, click the green keys (left top corner), it will become red. Then select the operations then click “Download”.

This is my configuration as of today:

  • KEY1: Win L (Go to “KEY”, then select the keys. This locks the computer).
  • KEY2: Win Ctrl V (Go to “KEY”, then select the keys. This is the Windows sound output selector.)
  • KEY3: Mute (Click “Multimedia” then mute)
  • K1 Left (Knob scroll left): Volume- (Click “Multimedia” then “Volume-“)
  • K1 Right (Knob scroll right): Volume + (Click “Multimedia” then “Volume+”)

Notes on Python venv

Python 3.3 or later comes with venv. For Python 3.* < 3.3 with apt:

$ sudo apt install python3-venv

To create, activate and pip install packages:

$ python -m venv my_venv
$ source my_venv/bin/activate
(my_venv)$ pip install gimpformats

To deactivate the venv:

(my_venv)$ deactivate

This allows to have Python virtual environments with isolation. It’s particularly useful when using systems that don’t allow to use pip directly as WSL (Windows Subsystem for Linux).