Skip to content

Instantly share code, notes, and snippets.

@dbcooper
Last active June 4, 2022 17:15
Show Gist options
  • Select an option

  • Save dbcooper/9bc5398631dcb46077ea29434ad4db66 to your computer and use it in GitHub Desktop.

Select an option

Save dbcooper/9bc5398631dcb46077ea29434ad4db66 to your computer and use it in GitHub Desktop.
Stupid Q&D Perl script to rename Windows spotlight images [for wallpaper]. FMI https://www.cnet.com/tech/computing/where-to-find-the-windows-spotlight-photos/
#!/usr/bin/env perl
use v5.010;
use strict;
use warnings;
# From http://listofrandomwords.com/index.cfm?blist
my @keywords = qw(
hotspur
topnotch
warsle
bluebird
fatly
skimo
moment
kevin
angled
remerge
unpierced
snuffly
halers
tattler
clubfoot
lignite
bundu
thrombin
welshman
matrass
foundrous
nester
prezzie
haynesville
pamper
sucker
kola
sully
draughtsman
bareback
karpas
hipster
mosso
beery
schnorkle
trudie
lemma
parson
reborn
knobstick
farad
thia
barracks
bissau
scarborough
plical
sondheim
outspit
shallow
distal
baalshem
define
hubble
unnigh
gaoler
gassing
bottoms
contained
kilo
tonsure
boxwood
stroudsburg
acrux
backstay
branky
carry
oxter
triple
tickseed
bema
meris
waking
wafdist
mentor
rinsing
contrite
dahlia
lachish
jamboy
hallan
groundway
peartly
forejudged
eastern
domic
surcharge
ramal
grimace
ormuzd
deathday
convolve
pensile
cestoid
eyetooth
sponson
aycliffe
lesage
charente
halsey
cussed
reside
rooky
georgette
chapbook
gumboil
gisarme
freehold
studwork
trisa
spunky
inmost
outslide
unseat
clapstick
grecise
whitebelt
creta
mealworm
callus
daybill
replot
amass
stingo
grandson
mistreat
pinstripe
sampling
markka
render
unruled
berchta
untramped
album
cenis
disarm
enfin
clannish
frostproof
hjordis
kneeling
bootleg
paki
potline
ahchoo
foxing
greybeard
haptene
widget
fallen
);
my @files = glob("*.jpg");
for my $fn (@files) {
my $target = random_name(3) . ".jpg";
warn "Renaming $fn to $target\n";
rename $fn, $target;
}
sub random_name
{
my ($rounds) = @_;
state $list_size = scalar @keywords;
my @indices;
while ($rounds > 0) {
push @indices, int(rand($list_size));
$rounds--;
}
my $name = join '-', map { $keywords[$_]; } @indices;
return $name;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment