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 | pbcopy21–30 of 51 posts
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 | pbcopyThere's also https://www.newguid.org/
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…
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 }
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.
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.
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…
uuidgen is provided by the Windows SDK - exactly the same usage than in *nix
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
uuidgen | awk '{ printf "\"" $1 "\"" }' | xclip -selection clipboardOr from PowerShell: [Guid]::NewGuid()
Is shorter and easier.