Live data from Hacker News

Show HN: Givemeguid.com – CLI/curl friendly GUIDs

givemeguid.com

21–30 of 51 posts

Re: Show HN: Givemeguid.com – CLI/curl friendly GUIDs

#21
Nice! I think this will still have a use and is a nice addition to add another alternative way to generate uuids

I use the following alias to generate uuids

   function uuid() { uuidgen | tr "[:upper:]" "[:lower:]" | tr -d "\n\r" }
I then pair it with pbcopy on the mac

   uuidgen | pbcopy

Re: Show HN: Givemeguid.com – CLI/curl friendly GUIDs

#23

Earlier quoted context omitted.

Maybe a JS App which is made completely out of third party APIs, without anything self-hosted? Not discussing wether this is a good idea or not, though... I was surprised to see that there is no "built-in" mechanism in JS to generate a GUID. As a C# dev, I'm used to Guid.NewGuid()

Why would you make an http request if you can just google a 3-line JS solution? You're just generating a large random number and formatting it as a UUID. https://gist.github.com/jed/982883 If you google "generate uuid javascript" you can find approaches from Math.random to node/browser `crypto` module to shelling out OS random. One of the main benefits of guid generation is that you don't need to synchronize with any…

UUIDs also have a hashed namespace in them, don't they? Not sure if that version implements them.

Re: Show HN: Givemeguid.com – CLI/curl friendly GUIDs

#24
This is what I use to generate guids with autohotkey: ::;guid:: guid := GUID() StringLower, guid, guid Clipboard := guid SendInput,^v return

GUID() { format = %A_FormatInteger% ; save original integer format SetFormat Integer, Hex ; for converting bytes to hex VarSetCapacity(A,16) DllCall("rpcrt4\UuidCreate","Str",A) Address := &A Loop 16 { x := 256 + *Address ; get byte in hex, set 17th bit StringTrimLeft x, x, 3 ; remove 0x1 h = %x%%h% ; in memory: LS byte first Address++ } SetFormat Integer, %format% ; restore original format h := SubStr(h,1,8) . "-" . SubStr(h,9,4) . "-" . SubStr(h,13,4) . "-" . SubStr(h,17,4) . "-" . SubStr(h,21,12) return h }

Re: Show HN: Givemeguid.com – CLI/curl friendly GUIDs

#25
post #23

Earlier quoted context omitted.

Why would you make an http request if you can just google a 3-line JS solution? You're just generating a large random number and formatting it as a UUID. https://gist.github.com/jed/982883 If you google "generate uuid javascript" you can find approaches from Math.random to node/browser `crypto` module to shelling out OS random. One of the main benefits of guid generation is that you don't need to synchronize with any…

UUIDs also have a hashed namespace in them, don't they? Not sure if that version implements them.

Only uuid v3/v5. Anything is possible if that's what you want. But 128 (or 122) bits of random are usually what you want when you think of guid.

Most people format 128-bit random numbers into a UUID just so it's obvious at a glance what it is: a guid. Even if it's not technically a UUIDv4 because it doesn't have the magic bits.

Re: Show HN: Givemeguid.com – CLI/curl friendly GUIDs

#26
post #15
post #3

I'm having trouble imagining who would want to use this. What's the environment where you would have curl and a need for generating UUIDs, but wouldn't have access to uuidgen or similar?

Yeah, I'm just really confused. If you're at a CLI, you probably have uuidgen. And I'd assume there's something similar on Windows. If you're writing some kind of application, pretty much every language/framework can generate UUIDs, and even if yours doesn't, just generate a 128-bit number, stamp the v4 UUID bits into it, reformat it, and you're done. Calling out to a 3rd-party service is insane for that use case any…

> Yeah, I'm just really confused. If you're at a CLI, you probably have uuidgen. And I'd assume there's something similar on Windows.

uuidgen is provided by the Windows SDK - exactly the same usage than in *nix

Re: Show HN: Givemeguid.com – CLI/curl friendly GUIDs

#27
post #21

Nice! I think this will still have a use and is a nice addition to add another alternative way to generate uuids I use the following alias to generate uuids function uuid() { uuidgen | tr "[:upper:]" "[:lower:]" | tr -d "\n\r" } I then pair it with pbcopy on the mac uuidgen | pbcopy

one of my most used non-trivial shell commands must be

    uuidgen | awk '{ printf "\"" $1 "\"" }' | xclip -selection clipboard
Post reply on HN