GithubHelp home page GithubHelp logo

ncomet / u2ug Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 1.0 78 KB

A Golang library that given a UUID, generates a random adjective and Ubisoft game, or character

License: MIT License

Go 97.57% Dockerfile 0.47% HTML 1.95%
game games go golang library mapping naming ubisoft uuid human-readable

u2ug's Introduction

u2ug: UUID to Ubisoft game

Go

A Golang library that given a UUID (v1 or v4), will return the concatenation of a random adjective and Ubisoft game, or character.

c840005c-06f0-43af-a96f-77bf13fdc956 → Crazy Rocksmith

Disclaimer

Highly inspired by https://github.com/CleverCloud/uuid_to_pokemon.rs, but in Go. Special thanks to the Clever Cloud teams ;)

It is not an injective function, meaning that a given UUID will always produce the same name, but a given name could be the output of two different UUIDs.

It does should not matter since the original UUID must be kept as original source of uniqueness. This library is created in order to assign a reproducible human-readable name to a UUID.

How to use

Go library

go get github.com/ncomet/u2ug/ubi
import "github.com/ncomet/u2ug/ubi"

game, err := ubi.Game("d3acc428-3172-457a-9447-6a22263ef6b3")
if err != nil {
	panic(err)
}

fmt.Println(game) // "Selfish Space Junkies"

character, err := ubi.Character("d3acc428-3172-457a-9447-6a22263ef6b3")
if err != nil {
	panic(err)
}

fmt.Println(character) // "Selfish Selena"

Binary

$ go build .
$ ./u2ug game d3acc428-3172-457a-9447-6a22263ef6b3
Selfish Space Junkies
$ ./u2ug character d3acc428-3172-457a-9447-6a22263ef6b3
Selfish Selena
$ go run ./ game d3acc428-3172-457a-9447-6a22263ef6b3
Selfish Space Junkies
$ go run ./ character d3acc428-3172-457a-9447-6a22263ef6b3
Selfish Selena

Docker

$ docker build -t u2ug .
$ docker run u2ug game d3acc428-3172-457a-9447-6a22263ef6b3
Selfish Space Junkies

WASM

Build the wasm version:

GOOS=js GOARCH=wasm go build -o u2ug.wasm
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" .

Then use it in your webapp:

<html>
<head>
    <meta charset="utf-8"/>
    <script src="wasm_exec.js"></script>
    <script>
        const go = new Go();
        WebAssembly.instantiateStreaming(fetch("u2ug.wasm"), go.importObject).then((result) => {
            go.run(result.instance);
        });

        // call the functions available in window.ubiGame or window.ubiCharacter
        document.body.textContent = ubiGame("c74c3694-8040-4213-8a46-988ee9a42ef3");
    </script>
</head>
<body>
</body>
</html>

You can run an example avaible in /wasm_example:

GOOS=js GOARCH=wasm go build -o ./wasm_example/u2ug.wasm
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js" ./wasm_example
ℹ️
Serve the index.html in your favorite tool to avoid CORS errors

Some examples

Games

Polite Tom Clancy’s Ghost Recon Advanced Warfighter

Dreadful Gunfighter II: Revenge of Jesse James

Shrill Cloudy with a Chance of Meatballs

Shrill Rocket: Robot on Wheels

Meek Assassin’s Creed Origins

Caring Far Cry New Dawn

Scared Buck Bumble

Selfish Splinter Cell: Blacklist - Spider-Bot

Shining Petz: Bunnyz

Angry Seven Kingdoms II: The Fryhtan Wars

Odd ZombiU

Plush Super Bust-A-Move

Sleepy Tiger Woods PGA Tour Golf

Foul Adventures in Music with the Recorder

Cruel Heroes of Might and Magic V: Tribes of the East

Stingy Theocracy

Quiet Lost: Via Domus

Bored Skateball

Tiny Warlords: Battlecry II

Shining Imagine: Babyz

Rich All Star Tennis '99

Characters

Soaring Tus

Fussy Eivor

Thrifty Amaru

Afraid Barr-Barr

Chilly Mo

Creeping Thant

Sloppy Teen Punk

Caring Nikolai Andreievich Orelov

Stingy Princess

Generous Hytham

Rapid Glaz

Grimy Sigurd

Cowardly Straker

Bashful Tiva

Generous Amaru

Kind Clancy

Hard Piquedram

Games list source

All games were taken and de-duplicated from:

Characters list source

Extracted from various dedicated game wiki fandom websites.

u2ug's People

Contributors

ncomet avatar pierreadriendelisle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.