HackerTrans
TopNewTrendsCommentsPastAskShowJobs

lukasgelbmann

145 karmajoined 8 tahun yang lalu

Submissions

A glitch in February of the year 0

28times.com
22 points·by lukasgelbmann·15 hari yang lalu·25 comments

What types of exceptions should you catch?

pythonmorsels.com
3 points·by lukasgelbmann·bulan lalu·0 comments

How a cat debugged Stable Diffusion (2023)

blog.dwac.dev
59 points·by lukasgelbmann·5 bulan yang lalu·12 comments

Designing a Programming Language to Speedrun Advent of Code (2023)

blog.vero.site
1 points·by lukasgelbmann·7 bulan yang lalu·0 comments

Europe's Erasmus founder Sofia Corradi dies, aged 91

thelocal.com
3 points·by lukasgelbmann·9 bulan yang lalu·0 comments

comments

lukasgelbmann
·6 hari yang lalu·discuss
Author here.

Our aim isn’t to try and line up with the calendar that was in use at the time, 2026 years ago.

Instead, the aim (for 28times) is to implement the rules of the proleptic Gregorian calendar[0] correctly. The bug was that those rules weren’t followed for some rare values.

But to address your comment properly, I think I should justify why on Earth someone would want to use the proleptic Gregorian calendar for year 0 and before. In short, because it’s a useful fiction.

The biggest reason is interoperability: a lot of software follows proleptic Gregorian rules, aligning around ISO 8601. Probably a clear majority of date/time software. We want to line up with all that existing software that assigns a specific meaning to a string like "0000-02-01". That’s the first of February in the proleptic Gregorian calendar, even though it was a different date in the ancient Romans’ calendar.

The other reason is to keep it simple: since most people use the Gregorian calendar in present times, it’s simplest (for us as implementors, but also for users) to extend its rules into the distant past and distant future. The alternative for be to have multiple sets of rules, e.g. Julian and Gregorian calendar. (You might say it would be even simpler to just not allow timestamps before 1582. But there are use cases, e.g. in astronomy or history, where people want to work with timestamps before 1582, and even before 1 AD.)

[0] https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar
lukasgelbmann
·27 hari yang lalu·discuss
I’m working on a time series management & analysis tool. The goal is to provide simple ways to work with time series data, including an API and visualisation.

https://28times.com
lukasgelbmann
·bulan lalu·discuss
> “If you run this on a big repository, it will take quite a lot of time because `git log -n1` takes a long time. I think this is the fastest way to get the most recent commit time on a single file? (That's the assertion that I hope someone can correct me on!) In any case, `bttf tag exec` is using parallelism under the hood to make this even faster.”

Instead of running `git log -n1` on every file, I think you can walk through the commits backwards, skipping any files that have been seen. Something like this (these two commands could be followed by bttf commands):

  git log --pretty=format:"DATE:%aI" --name-only |
  awk '/^DATE:/ {date=substr($0, 6); next} $0!="" && !seen[$0]++ {print date, $0}'
This seems to run much faster. The only problem is it'll include files that have been renamed or removed. I got an AI to fix that too, but it starts getting awkward (still fast though!):

  git ls-files |
  awk '
    # Read all existing files from git ls-files into an array
    NR==FNR { lsfiles[$0]; next }

    # Process the git log stream
    /^DATE:/ { date=substr($0, 6); next }
    $0!="" && ($0 in lsfiles) && !seen[$0]++ { print date, $0 }
  ' - <(git log --pretty=format:"DATE:%aI" --name-only)
lukasgelbmann
·3 bulan yang lalu·discuss
With 3, especially if the animals outnumber humans, you’d first want to do some research into animal psychology to see whether red or blue has an edge for animals.
lukasgelbmann
·3 bulan yang lalu·discuss
There’s a moral benefit to choosing blue if you think there’s a chance that the end result will be split 50-50 and you’ll be the deciding vote between a blue majority and a red majority.
lukasgelbmann
·3 bulan yang lalu·discuss
If you’re using a model, it’s your responsibility to make sure the probability actually is that small. Realistically, you do that by not giving the model access to any of your bloody prod API keys.
lukasgelbmann
·3 bulan yang lalu·discuss
That’s not something I wanted to imply. It can also stand for "the fine article". Is there a better shorthand for "the article linked at top of the page" / "the original article"?
lukasgelbmann
·3 bulan yang lalu·discuss
I use stars to try and protect myself from dependency confusion attacks.

For example, let’s say I want to run some piece of software that I’ve heard about, and let’s say I trust that the software isn’t malware because of its reputation.

Most of the time, I’d be installing the software from somewhere that’s not GitHub. A lot of package managers will let anyone upload malware with a name that’s very similar to the software I’m looking for, designed to fool people like me. I need to defend against that. If I can find a GitHub repo that has a ton of stars, I can generally assume that it’s the software I’m looking for, and not a fake imitator, and I can therefore trust the installation instructions in its readme.

Except this is also not 100% safe, because as mentioned in TFA, stars can be bought.
lukasgelbmann
·9 bulan yang lalu·discuss
Does NO_COLOR=1 mean that all ANSI formatting should be disabled? Including bold text, italic text, and so on?

It seems that different software handles that question in different ways.