Skip to content

Instantly share code, notes, and snippets.

@su8
Created November 5, 2025 10:54
Show Gist options
  • Select an option

  • Save su8/a10c3eb16c2ebba5eb4c421fa8ed2c25 to your computer and use it in GitHub Desktop.

Select an option

Save su8/a10c3eb16c2ebba5eb4c421fa8ed2c25 to your computer and use it in GitHub Desktop.
names-main.rs
use std::collections::HashSet;
use std::fs::File;
use std::io::{self, BufRead, BufReader};
use std::path::Path;
fn variants(word: &str) -> Vec<String> {
let mut result = vec![word.to_string()];
let capitalized = word.to_ascii_uppercase();
result.push(capitalized);
let upper = word.to_uppercase();
result.push(upper);
result
}
fn main() {
let mut args = std::env::args().skip(1);
if args.len() < 5 {
return;
}
let usernames = ["frost"];
let roles = ["user", "root"];
let separators = ["", "_"];
if args.next().unwrap().as_bytes()[1] == b'f' {
usernames.clear();
usernames.extend(args.next().unwrap().split_whitespace());
}
if args.next().unwrap().as_bytes()[1] == b'o' {
roles.clear();
roles.extend(args.next().unwrap().split_whitespace());
roles.extend(args.next().unwrap().split_whitespace());
}
for username in usernames {
for role in roles {
for separator in separators {
for variant in variants(&username) {
for variant2 in variants(&role) {
println!("{}{}{}", variant, separator, variant2);
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment