HNHacker News
TopNewBestAskShowJobs

alain_gilbert

475 karma · joined June 23, 2011

http://agilbert.name/

alain.gilbert.15@gmail.com

submissionscomments
alain_gilbert··on Swift Container Plugin
My two mains "why tf is this not built-in" are:

"Why are tuple not Hashable ?!"

Which means that you cannot have a tuple of Int `(1, 1)` as a key in a dict, and you have to make a struct that implement Hashable instead.

And

"Why do they not have a `.sum()` and I have to do `.reduce(0, +)` every time instead."

Or implement it yourself

    extension Sequence where Element: AdditiveArithmetic {
        func sum() -> Element { reduce(.zero, +) }
    }
alain_gilbert··on Golang Generic Mutex
I submit again this library that I made since I added the much needed "value mutex" that do not need to be initialized (like you would use a normal sync.Mutex)

Single file, easily copyable in your project, providing generic strongly typed mutex which unlock much safer patterns.

alain_gilbert··on I recreated Shazam's algorithm with Go [video]
git repository of this project ->

https://github.com/cgzirim/seek-tune

alain_gilbert··on Feluda – A CLI tool to detect restrictive licenses in dependencies
I think you have some bugs. I ran it on my project which has 60 direct dependencies in my "go.mod" file, and feluda's output says `Total dependencies scanned: 2`

EDIT: there was a package.json in the same folder, that's what caused the "bug"

alain_gilbert··on Apple is open sourcing Swift Build
I'm just curious, if I was to run my application on a linux server.

How would I ever know what caused the crash?

when I compile using `swiftc main.swift` and run with `./main`, the error seems even more useless.

all I get is:

    Swift/ContiguousArrayBuffer.swift:600: Fatal error: Index out of range
    zsh: illegal hardware instruction  ./main
alain_gilbert··on Apple is open sourcing Swift Build
that's not related to the symbolizer thing. It seems to just be part of the "index out of range" crash. I get the same thing without using the symbolizer.

    zsh: illegal hardware instruction  swift main.swift
alain_gilbert··on Apple is open sourcing Swift Build
Here is the output with the environment variable set.

https://pastebin.com/8M9Dbrgj

This doesn't provide anything useful either.

alain_gilbert··on Apple is open sourcing Swift Build
If I follow the advice

https://pastebin.com/8M9Dbrgj

Not sure how that's any better... I still have no idea that the error occurred on line 2

alain_gilbert··on Apple is open sourcing Swift Build
Swift is a really cool language.

But one thing that blows my mind is that if you ever encounter an "index out of range" error, the (massive) error message that you get doesn't tell you anything about where this error occurred... no line number... no nothing...

    let a = [1]
    print(a[1])
Is all you have to do to reproduce the error.

The error looks something like that https://pastebin.com/MQV82SaR

And gives you no useful information as to how it happened or how to fix it.

compare that with Golang which tells you, it happened in main.go at line 4.

    panic: runtime error: index out of range [1] with length 1
    
    goroutine 1 [running]:
    main.main()
     /Users/username/main.go:4 +0x15
    exit status 2
EDIT: with the LLVM_SYMBOLIZER_PATH set https://pastebin.com/8M9Dbrgj this doesn't provide anything useful either.
alain_gilbert··on Can we communally deprecate git checkout?
yeah, totally agree, it's so hard to type `git rebase --abort` (?)
alain_gilbert··on WinSweeper – macOS minesweeper game that guarantees a win with perfect play
A minesweeper game, but you always win if you play perfectly.

Whenever you are forced to make a decision, the game will shift the odds in your favor. If you happen to click on a mine, the game will move it — but only if there are absolutely no safe tiles left for you to discover.

After discovering all safe tiles, if there is a pair of tiles each with a 50% chance of being safe, you must click one of them. If no such pairs are available, you can click any tile adjacent to a discovered tile. If neither option is available, it is safe to click any tile.

alain_gilbert··on Toasty, an async ORM for Rust
`if you have ever looked at a database created by a ORM`

You do realize that you can make your own migrations using raw SQL, and still use the ORM with your tables?

alain_gilbert··on Toasty, an async ORM for Rust
I never understood why people are so stubborn about hating on orm.

For example I'm familiar with https://gorm.io and it does save me a lot of time and useless boilerplate.

And guess what, if I ever need to make a complex query, I also happen to know SQL, and I'm just going to make a "raw" query https://gorm.io/docs/sql_builder.html#Raw-SQL and be done with it.

It's not all that hard.

edit:

the other common complaint usually is: "but I don't know what query the orm is going to make..."

Use "Debug" https://gorm.io/docs/session.html#Debug and it will print out exactly what query it's making. Not happy with it? Make a raw query.

alain_gilbert··on Pin
Should add "rust" in the title, so that we know what the article is talking about.

If you're one of the "rust/go in title" haters... please go rage somewhere else.

alain_gilbert··on A saner way to use mutex in Golang, using generics
Golang generic mutex that looks a bit like rust Mutex<T>
alain_gilbert··on Asciinema 3.0 will be rewritten in Rust
https://github.com/charmbracelet/vhs/blob/main/record.go#L22

I was looking at the code, and it seems like you could put a low value for this and it would do what you want.

I did not try it though

  // sleepThreshold is the time at which if there has been no activity in the
  // tape file we insert a Sleep command
  const sleepThreshold = 500 * time.Millisecond
EDIT:

I tested it. It actually work, but their software crash, I had to patch line 153

  for lines[i] == lines[i+repeat] {
    repeat++
    if i+repeat == len(lines) {
      break
    }
  }
EDIT 2:

I actually went ahead and created a pull request to fix the bug.

https://github.com/charmbracelet/vhs/pull/446

alain_gilbert··on The timing of computer search warrants when it takes years to guess the password
I'm curious, given the fact that they have physical access to the device, would it be possible to clone the hard drive as it is on multiple devices, and then brute force the passcode in parallel?
alain_gilbert··on Breaking SHA256: length extension attacks in practice
Title is missing "(with Go)".

Not sure why it was removed, that makes the whole thing much more interesting to me.

alain_gilbert··on Ask HN: Best Way to Mess with Hackers?
I don't see what is illegal in putting whatever you want on your own server...
alain_gilbert··on My next Mac might be the last
osx has Ctrl+Shift+G to quickly paste a path to go to
alain_gilbert··on Requiring MFA on popular gem maintainers
Maybe they completely deactivated the sim card, I don't really know. The phone just doesn't even connect to a network anymore.

In which case, I wonder if I actually just lost my phone number altogether(?)

alain_gilbert··on Requiring MFA on popular gem maintainers
Funny thing that happened to me recently.

I'm having a prepaid plan with att, and I did not pay it for a while. Recently I needed to get a text message so I went on the att prepaid website to reactivate the plan for the month so that I could get the text message.

Guess what. The att website wants to send me a text message to ensure that I am the owner of the account... to my phone... that has no plan... fun times!

alain_gilbert··on Ask HN: What are the ways you go about getting comfortable with a new codebase?
I'd give the complete opposite advice.

I use "go to definition"/"find references" to go all around the code base and at the same time try to figure out how each files interact with each others.

alain_gilbert··on Library Writing Realizations (2015)
> People will just copy-paste your example code.

> People will not read the docs.

Reminds me of a pull request I made a while ago

https://github.com/krisajenkins/yesql/pull/151/files

The first piece of code on the readme is "not the solution" (lol), and everybody I knew who was trying to use that library was copy-pasting that specific piece of code from the readme.

alain_gilbert··on MCQ – Minecraft Query, is a Go library to query anything in a Minecraft world
Hey HN,

I made MCQ because there is a treasure hunt going on in Loony_MC first world, and I wanted a quick way to extract all books, signs, or anything that a human could put in a minecraft world to convey information.

This library allows you to make powerful searches. Some examples:

- Search any Zombie that holds a Shulkerbox with an Apple in the third slot within this bounding box (x1 ,z1, x2, z2)

- Give me the location of all signs that have text

- Give me the location of all Books in the Nether

alain_gilbert··on Berry is a healthy, byte-sized window manager written in C for Unix systems
What does "byte-sized" means here?
alain_gilbert··on Things we did not do while reaching $2M ARR
Legends! I love to see your content, every times. Congrats.
alain_gilbert··on Go 1.18 Beta 1 is available, with generics
I know there is no flag library built-in in rust (I do quite a lot of rust as well as go). That's my whole point. It should be compared to something like https://github.com/urfave/cli . That would be a fairer comparison.
alain_gilbert··on Go 1.18 Beta 1 is available, with generics
Are you using "clap" because the "built-in" one in rust is not good? :P
alain_gilbert··on AWS disables ISIS propaganda website it had hosted since April
> 9/19/2012 Haqqani Network (HQN)

(from your list)

Khalil Ur-Rahman Haqqani is now the Taliban head of security in Kabul.

https://www.nbcnews.com/politics/national-security/new-talib...

← PreviousPage 2 of 7Next →