I'm feeling lucky or just lucky
is a CLI written in Go that generates Euromillions keys. If you win using this generator, please share a bit of the prize with me. 😄
This is just a small project that I worked on to practice my Go skills.
The key generation is based purely in computer randomization. It's possible match the generated key with the past draw results (very unlikely event) - in case of a repeated key a new one is generated.
lucky
CLI can work in a standalone manner by passing disable-check
flag to draw
command.
All the other commands are leveraged by using data from euro-millions website.
Since there's no API available the data is scraped from source page HTML.
The only data scraped are the number and the stars from each past draw.
The data scraped is only used to check if the generated key is repeated, meaning that if the generated key was already drawn in the past.
It's possible to store the parsed data into a json
file, intention is this that that data to be used to feed the draw
command and nothing else.
lucky draw --disable-check
This command will scrape data from past draws and compare the generated key agains them. If generated key is a past draw, the CLI will generate a new one
lucky draw
Same as previous section but instead of scrapping directly from the web, it will use a json
file.
lucky draw --file-path /path/to/json/file
Spec of json file:
[
{
"numbers": [<int>],
"stars": [<int>]
}
]
lucky scrape --year 2004 --file-path /path/to/store/data --silent
year
: collects data from the provided year until the current year. There are no data previous to 2004, so if no year is passed or is passed a year prior to 2004, by default 2004 will be set for both scenariosfile-path
: the path to a file to store the data collected. Will be stored injson
format. If nofile-path
is passed, the scrape will performed, however just printed to the screen in a non-standard format (just a print from the Go structure used to work with the data). Ifsilent
is flag is passed withoutfile-path
the scrape will be done but nothing shown, so it's kinda useless.silent
: won't print the non-standard data (a print from the Go stucture used to work with data)
Go to the repository latest release and download the version which fits your computer architecture.
On alternative you can clone this repository and just run make build
- you need to have makefile installed on your system.