HNHacker News
TopNewBestAskShowJobs

madacol

578 karma · joined October 7, 2014

submissionscomments
madacol··on Show HN: CTRL-F for YouTube Videos
bookmarklet to "Show transcript"

    javascript:document.querySelector('button[aria-label="Show transcript"]').click()
<https://getbookmarklets.com/scripts/data%3Atext%2Fjavascript...>
madacol··on Show HN: Mazelit - My wife and I released our first game
github.blog ask for cookies, but github.com does not
madacol··on DNS over Wikipedia
I've been thinking about that for years.

I believe there are sooo many problems that would be solved by that kind of system

And although it might not be technically practical in many cases, I think in this case it would

madacol··on Show HN: I've built a locally running Perplexity clone
Have you considered using grammar sampling?
madacol··on NotepadNext – a cross-platform reimplementation of Notepad++
You cannot edit in real-time with regex

With regex, you need to plan everything you need to do and then surgically do it.

With multiple cursors, you only need to know (roughly) where you need to change, the rest you figure it out on the fly.

madacol··on Show HN: I made a cheap alternative to college-level math & physics tutoring
It's very confusing how you use ">"

It is generally used to quote literally a passage from the person your replying, for example you wrote this:

> FF mobile: you're correct, this is not mobile responsive yet

and here, in a new line, people usually respond to what is quoted above ↑

madacol··on Ask HN: What non-AI products are you working on?
Thanks!, I really like the idea of doing some kind of rate-limiting
madacol··on Ask HN: What non-AI products are you working on?
A bookmarklet store https://getbookmarklets.com/

Though I am having trouble figuring out a simple way to solve discovering and make it work autonomously without leaving it open to spam

Any ideas or feedback appreciated

madacol··on Difftastic, a structural diff tool that understands syntax
Easy installation from source https://difftastic.wilfred.me.uk/from_source.html

    cargo install --locked difftastic
madacol··on Using Termux on Android for Self Hosting
Do you have any problem like the phone's CPU sleeping and becoming unresponsive?. It has happened to me but phone was on battery instead of charging
madacol··on Ask HN: What are the most useful bookmarklets you use?
I also think we need some kind of bookmarklet manager to show only the relevant bokkmarklets depending on the webpage in display
madacol··on Ask HN: What are the most useful bookmarklets you use?
On firefox you can right click -> "Reveal password"
madacol··on Ask HN: What are the most useful bookmarklets you use?
- Open npm package on socket.dev

    javascript:location.href=document.location.href.replace("www.npmjs.com/", 'socket.dev/npm/');

- Edit any text on any page

    javascript: (function() {   document.body.contentEditable = true;   document.body.spellcheck = false;  })();

- Highlight selected text (wraps selection in <mark> tags)

this one is complex, see it here: https://getbookmarklets.com/scripts/https%3A%2F%2Fraw.github...

---

BTW, I am building https://getbookmarklets.com precisely because I want a place to share bookmarklets

I am trying to make the site as simple as possible on the server-side by only storing the URL of the bookmarklet, everything else is derived on the client side from the URL, similar to how bookmarkl.ink does it

I am still figuring out how to make it resistant to spam, I don't want it to become like the userscript sites where you can't find a simple useful script, they all seem to be ultra specific and very complex scripts that are hard to verify.

Any feedback is appreciated

madacol··on Selfish reasons to want more humans
I am shocked by the overwhelming negative comments

I do not think the author is arguing for mindlessly expanding the population disregarding our current consequences. I think his concern is that people seem to have forgotten that population growth is generally very good in most situations, especially in the long term. So instead of promoting de-growth as the solution to our problems, we should be trying to solve our current, and temporary, bad externalities of our growing population (climate change, loss of biodiversity), and that is a technological problem

madacol··on A beginner's guide to constant-time cryptography (2017)
> isMatch = false;

That instruction is executed conditionally, you can time it.

Maybe eliminate the if completely an do something like this

    ...
      for (var i = 0; i < inputKey.length; i++)
        isMatch = isMatch && (inputKey.charAt(i) !== correctKey.charAt(i)
      }
    ...
madacol··on A beginner's guide to constant-time cryptography (2017)
- a repeated event when aggregated (like summed or averaged) tends to look more and more like a normal distribution the more samples you got

- the standard deviation of a normal distribution scales roughly by the square root of the number of samples

- From microseconds to nanoseconds you need a 1000x in precision, 1000² = 1.000.000.

So from an event that has a noise amplitude of microseconds, I think you may be able to measure a difference of nanoseconds with ~1 million samples.

---

So yeah unlikely in normal scenarios. But if you could, for example, rent a server in 10km from your target, you can reduce by 10-100x the latency, which will reduce your number of samples by its square, so a 100x-10000x reduction

And what if it's possible to rent a server in the same datacenter of your target? ... well K.O.

madacol··on What happened with the Web Monetization API?
Lightning has had lots of problems, but most of those are fixable through software or gets better and better with adoption (at least in theory).

The reason adoption has been so low is that with current hardware you cannot run a full node in a phone, so you either get a server to run a full node or you trade-off some control/security of your coins

There are still other theoretical problems, mostly things like denial-of-services, but adoption has been what has stagnated it.

The hardware/control tradeoff is a real PITA, we need a phone with like 50x more battery or efficient to be able to run lightning in a completely self-custodial manner

And there are still some people advocating for blocksize increase, which will make the problems of lightning even worse

madacol··on Browser extensions are underrated: the promise of hackable software (2019)
No, Firefox automatically encodes it, but it does have other gotchas because line-breaks are removed

   - You have to put `;` on each statement
   - You cannot use inline comments, // you cannot do this
madacol··on Browser extensions are underrated: the promise of hackable software (2019)
An interesting one I made recently is related to a game published a couple of days ago here in HN called "infinite craft" https://neal.fun/infinite-craft/

The game does not have any save mechanism, so I made a bookmarklet that loads and autosaves to localStorage

```

javascript:(function(){ const exportState = () => JSON.stringify({ discoveries: window.$nuxt.$root.$children[2].$children[0].$children[0]._data.discoveries, elements: window.$nuxt.$root.$children[2].$children[0].$children[0]._data.elements });

    const importState = (state) => {
        const { discoveries, elements } = JSON.parse(state);
        const gameInstance = window.$nuxt.$root.$children[2].$children[0].$children[0]._data;
        gameInstance.discoveries = discoveries;
        gameInstance.elements = elements;
    };

    /* Set up a MutationObserver to listen for changes in the DOM and automatically export the current state. */
    const observer = new MutationObserver((mutations) => {
        const state = exportState();
        localStorage.setItem('gameState', state);
    });

    /* Start observing DOM changes to auto-save the game state. */
    const startObserving = () => {
        const targetNode = document.querySelector('.sidebar');
        observer.observe(targetNode, { childList: true, subtree: true });
    };

    /* Check for a saved state in localStorage and import it if available. */
    const savedState = localStorage.getItem('gameState');
    if (savedState) importState(savedState);
    else localStorage.setItem('gameState', exportState() );

    startObserving();
})();

```

madacol··on Browser extensions are underrated: the promise of hackable software (2019)
edit any text on webpage

    javascript: (function() {   document.body.contentEditable = true;   document.body.spellcheck = false;  })();
Open on wayback machine

    javascript:location.href='https://web.archive.org/web/*/'+document.location.href.replace(/\/$/, '');
Others that are longer https://github.com/madacol/web-automation/tree/master/bookma...
madacol··on Infinite Craft
I made a bookmarklet that loads the state from localstorage and also autosaves the state on each new craft

    javascript:(function(){
        const exportState = () => JSON.stringify({
            discoveries: window.$nuxt.$root.$children[2].$children[0].$children[0]._data.discoveries, 
            elements: window.$nuxt.$root.$children[2].$children[0].$children[0]._data.elements
        });

        const importState = (state) => {
            const { discoveries, elements } = JSON.parse(state);
            const gameInstance = window.$nuxt.$root.$children[2].$children[0].$children[0]._data;
            gameInstance.discoveries = discoveries;
            gameInstance.elements = elements;
        };

        /* Set up a MutationObserver to listen for changes in the DOM and automatically export the current state. */
        const observer = new MutationObserver((mutations) => {
            const state = exportState();
            localStorage.setItem('gameState', state);
        });

        /* Start observing DOM changes to auto-save the game state. */
        const startObserving = () => {
            const targetNode = document.querySelector('.sidebar');
            observer.observe(targetNode, { childList: true, subtree: true });
        };

        /* Check for a saved state in localStorage and import it if available. */
        const savedState = localStorage.getItem('gameState');
        if (savedState) importState(savedState);
        else localStorage.setItem('gameState', exportState() );

        startObserving();
    })();
madacol··on Infinite Craft
Just add water like 5 times, and you get fish
madacol··on Show HN: Startup funding simulator
I disagree, The UI feels more like a simulation, you have an initial position (100% equity) and you start adding events sequentially, and you can see the partial results after each event that you have added.

Sure, you could have done the same thing in a spreadsheet, but I think the UI is what differentiates a simulation from a calculator

madacol··on Wait, what's a bookmarklet?
edit any text on the page:

    javascript: (function() {   document.body.contentEditable = true;   document.body.spellcheck = false;  })();
---

Longer bookmarklets: https://github.com/madacol/web-automation/tree/master/bookma...

  - Highlight selected text

  - chatgpt to markdown

  - Convert images to base64 DataURL markdown embedding
madacol··on Undermining Democracy: The EU Commission's Controversial Push for Surveillance
I personally feel powerless, or that it requires a huge amount of work to have a significant impact.

If what you say is true, It could be very persuasive to inform about the expected impact a single person could have by just doing X.

For example, describing how contacting MPs work, why would they care about what I say? giving a specific example, with rough estimates of number of people that need to contact or if it's more important the words chosen to achieve impact

I would be interested in reading a good blog post describing the expected impact of activism in politics, especially on topics that I really care about, like privacy and freedom.

I want to know what powers I have to change the things I care!

madacol··on Show HN: OpenBLE, Swagger for Bluetooth
> Unfortunately it also opens up the door for so many new exploits.

Put the door behind a permission the user has to explicitly activate, and if you are still concerned, add more friction to the process, or in this case, argue for a better permission system, but please do not argue for "infinite friction" (a.k.a prohibiting, banning, censoring)

If you still think we should not do this because users won't care and will accept any permission anyway, then you are arguing against the freedom of users to have control of their devices and run whatever algorithm they want on them

madacol··on First word discovered in unopened Herculaneum scroll by CS student
But that's expected!

When you are discovering to do a new thing that nobody knows how to do, you first try a bunch of things manually to learn what works and what doesn't.

Only after you have a procedure that reliably works, you automate it.

madacol··on Undermining Democracy: The EU Commission's Controversial Push for Surveillance
Elon once mentioned an interesting idea, just make removing laws easier than approving them. For example, if you require something like 2/3 of the votes to approve a law, then require only 1/2 to remove a law
madacol··on Undermining Democracy: The EU Commission's Controversial Push for Surveillance
when you "do something" what are you talking about?, can you give me a couple of examples please?
madacol··on State of HTML 2023 now open
- Survey link: https://survey.devographics.com/en-US/survey/state-of-html/2...

- State of HTML: https://stateofhtml.com/

It's the same organization (https://www.devographics.com/) behind "State of Js" (https://stateofjs.com)

Took me a couple minutes to verify that

← PreviousPage 2 of 10Next →