Initial commit
This commit is contained in:
commit
64dcb8fed4
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
75
Cargo.lock
generated
Normal file
75
Cargo.lock
generated
Normal file
|
@ -0,0 +1,75 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "blank"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"rand",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.153"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
13
Cargo.toml
Normal file
13
Cargo.toml
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
[package]
|
||||||
|
name = "blank"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
rand = "0.8.5"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "blank"
|
||||||
|
path = "main.rs"
|
1760
index.html
Normal file
1760
index.html
Normal file
File diff suppressed because it is too large
Load diff
214
main.rs
Normal file
214
main.rs
Normal file
|
@ -0,0 +1,214 @@
|
||||||
|
use rand::seq::SliceRandom;
|
||||||
|
use rand::thread_rng;
|
||||||
|
use rand::Rng;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
|
fn main() -> std::io::Result<()> {
|
||||||
|
let letters = HashMap::from([
|
||||||
|
(
|
||||||
|
'A',
|
||||||
|
"0000000000
|
||||||
|
0000110000
|
||||||
|
0001001000
|
||||||
|
0001001000
|
||||||
|
0010000100
|
||||||
|
0011111100
|
||||||
|
0010000100
|
||||||
|
0100000010
|
||||||
|
0100000010
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'D',
|
||||||
|
"0000000000
|
||||||
|
0011110000
|
||||||
|
0010001000
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0010001000
|
||||||
|
0011110000
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'F',
|
||||||
|
"0000000000
|
||||||
|
0011111110
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0011111110
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'H',
|
||||||
|
"0000000000
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0011111100
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'I',
|
||||||
|
"0000000000
|
||||||
|
0111111100
|
||||||
|
0000100000
|
||||||
|
0000100000
|
||||||
|
0000100000
|
||||||
|
0000100000
|
||||||
|
0000100000
|
||||||
|
0000100000
|
||||||
|
0111111100
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'L',
|
||||||
|
"0000000000
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0011111110
|
||||||
|
0011111110
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'O',
|
||||||
|
"0000000000
|
||||||
|
0001111000
|
||||||
|
0010000100
|
||||||
|
0100000010
|
||||||
|
0100000010
|
||||||
|
0100000010
|
||||||
|
0100000010
|
||||||
|
0010000100
|
||||||
|
0001111000
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'P',
|
||||||
|
"0000000000
|
||||||
|
0011111000
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0010000100
|
||||||
|
0011111100
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0010000000
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'R',
|
||||||
|
"0000000000
|
||||||
|
0011110000
|
||||||
|
0010001000
|
||||||
|
0010000100
|
||||||
|
0010001000
|
||||||
|
0011110000
|
||||||
|
0010100000
|
||||||
|
0010010000
|
||||||
|
0010001000
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'S',
|
||||||
|
"0000000000
|
||||||
|
0001111000
|
||||||
|
0010000100
|
||||||
|
0100000000
|
||||||
|
0111000000
|
||||||
|
0000111000
|
||||||
|
0000000100
|
||||||
|
0010000100
|
||||||
|
0001111000
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'Y',
|
||||||
|
"0000000000
|
||||||
|
0110000110
|
||||||
|
0110000110
|
||||||
|
0010000100
|
||||||
|
0001001000
|
||||||
|
0000110000
|
||||||
|
0000110000
|
||||||
|
0000110000
|
||||||
|
0000110000
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'0',
|
||||||
|
"0000000000
|
||||||
|
0001111000
|
||||||
|
0010000100
|
||||||
|
0100000010
|
||||||
|
0100000010
|
||||||
|
0100000010
|
||||||
|
0100000010
|
||||||
|
0010000100
|
||||||
|
0001111000
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'2',
|
||||||
|
"0000000000
|
||||||
|
0001111000
|
||||||
|
0010000100
|
||||||
|
0010000010
|
||||||
|
0000000100
|
||||||
|
0000001000
|
||||||
|
0000010000
|
||||||
|
0001100000
|
||||||
|
0011111110
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
(
|
||||||
|
'4',
|
||||||
|
"0000000000
|
||||||
|
0000011000
|
||||||
|
0000101000
|
||||||
|
0001001000
|
||||||
|
0010001000
|
||||||
|
0100001000
|
||||||
|
0111111110
|
||||||
|
0000001000
|
||||||
|
0000001000
|
||||||
|
0000000000",
|
||||||
|
),
|
||||||
|
]);
|
||||||
|
let ans = "HAPPYAPRILFOOLSDAY2024";
|
||||||
|
let mut file = File::create("index.html")?;
|
||||||
|
let mut rng = thread_rng();
|
||||||
|
for c in ans.chars() {
|
||||||
|
let letter = letters[&c].chars();
|
||||||
|
let mut zeros = letter
|
||||||
|
.enumerate()
|
||||||
|
.filter(|(_, c)| matches!(c, '0'))
|
||||||
|
.map(|(i, _)| i)
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
zeros.shuffle(&mut rng);
|
||||||
|
for i in zeros {
|
||||||
|
writeln!(
|
||||||
|
file,
|
||||||
|
"<div style='color:white;position:absolute;top:{}px;left:{}px'>0</div>",
|
||||||
|
((i / 11) as f32 + rng.gen_range(0.1..0.9)) * 50.0,
|
||||||
|
((i % 11) as f32 + rng.gen_range(0.1..0.9)) * 50.0
|
||||||
|
)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
Loading…
Reference in a new issue