jutty

joined 1 year ago
[–] jutty@blendit.bsd.cafe 1 points 1 month ago (1 children)

I guess, but:

  1. my JS skills are horrific
  2. I have a habit of avoiding all outer and/or global state like the plague
[–] jutty@blendit.bsd.cafe 5 points 1 month ago* (last edited 1 month ago) (4 children)

Some websites are really cursed in how hard they make overriding their styles.

Some things I usually do to handle these are using Stylus with Instant inject mode and some !important rules for a global dark theme.

If that also fails, I have an anti-Flash-of-Unstyled-Content userscript ready to toggle per-website as needed:

;(function() {

  const css = `
    html, body {
      background: #222 !important;
      min-height: 100vh !important;
    }

    body > * {
      visibility: hidden !important;
    }
  `

  const style = document.createElement('style')
  style.id = 'antiFOUC-block'
  style.textContent = css

  const container = document.head || document.documentElement
  container.prepend(style)

  window.addEventListener('DOMContentLoaded', () => {
    const block = document.getElementById('antiFOUC-block')
    if (block) block.remove()

    document.body.childNodes.forEach(n => {
      if (n.nodeType === 1) {
        n.style.visibility = ''
      }
    })
  })
})()

It works by preventing display of content before it's fully loaded. This won't make websites dark on its own, just prevent the flash.

(I have tested this with Violentmonkey on boardgamegeek.com plus a Stylus dark theme and it did solve it. With Dark Reader though it will still flash)

If even that fails I have a second one that will strip all inline and !important styles, but it rarely ever comes to that.

I hope this is helpful because being flashed with a fully white page makes me want to cry and punch my computer.

[–] jutty@blendit.bsd.cafe 2 points 1 month ago (1 children)

this is beautiful, and sobering

[–] jutty@blendit.bsd.cafe 3 points 1 month ago* (last edited 1 month ago)

Mint is a glorious debloat of Ubuntu with several extras and are strategically wise in having LMDE ready and in production. They fill a very important role as an user-friendly not-DIY distro suitable for someone completely unfamiliar with Linux. I wouldn't describe Fedora that way. It changes too fast for that use case and compared to Mint comes with not much preinstalled.

[–] jutty@blendit.bsd.cafe 1 points 2 months ago

I wrote a small script that takes a query as its single argument and if it finds a matching filename in a given directory it shows that in a pager. If it doesn't, it uses ripgrep to search inside that directory and returns the filenames in a picker. If I prepend the filename with e, it opens that file (either existing or new) in an editor. Then I track that directory with Git.

This way I have a quick way to store, find and retrieve notes from the terminal itself.

[–] jutty@blendit.bsd.cafe 3 points 2 months ago

Yeah more like safety in numbers than reading every line of code you run, which is impractical and only warranted for the most extreme threat models.

I don't think plugin devs add such features too often. More likely will focus only on their functionality. Plugins are better avoided if you are concerned. They are often abandoned and possibly bound to weak auth systems as compared to the main program source channel. The advantage is their code is usually much much shorter and easier to check out yourself.

[–] jutty@blendit.bsd.cafe 6 points 2 months ago (2 children)

Can vary a lot from project to project. Usually there is a bottleneck where new code is certainly getting looked at before being merged, not that things can't go unnoticed. Depending on the size of the project, full audits can be performed by third parties. If it's popular enough or there are bug bounties up, random people might be looking for issues as well. In general, the less popular, the less likely it is someone has recently taken a look at the code.

[–] jutty@blendit.bsd.cafe 8 points 2 months ago (1 children)

That's already configurable in Settings > General > Share Links.

[–] jutty@blendit.bsd.cafe 9 points 2 months ago
[–] jutty@blendit.bsd.cafe 40 points 2 months ago* (last edited 2 months ago) (4 children)

at this crossroads in time it'd be better to boost this lest we celebrate one of F-Droid's last birthdays

[–] jutty@blendit.bsd.cafe 1 points 5 months ago (1 children)

The quoting oversight was due to me testing the first one only on zsh, which quotes differently.

The second was tested on Busybox ash and dash against the input in the example. It does assign a number just smaller or equal to threshold because head is overwritten on each iteration until it lands on the last value that was less than or equal to the threshold.

[–] jutty@blendit.bsd.cafe 2 points 5 months ago* (last edited 5 months ago) (3 children)

For the simpler case of threshold match and larger, with the list already ordered, you could use sed:

echo $list | sed -n '/^150$/,$p'

The edge case is tricky because "equal or lower" can't be expressed with regex cleanly, so even an awk solution would look kinda convoluted, so I personally prefer a for loop for readability's sake:

for i in $list; do
    if [ "$i" -le "$threshold" ]; then
        head="$i"
    else
        tail="$tail\n$i"
    fi
done

printf '%b\n' "$head$tail"
view more: next ›