Quick links: [Joyce/Pynchon/Wallace]    [Top 100]    [The pics]    [Warning]    [e-Mojis]    [Contact]


 

Each day I update this dump of a site, I execute a script called: mm.sh in iTerm, which looks a little exactly like this:

#!/bin/zsh
rsync -av /Users/lance/development/mattmclaurine.com/mattmclaurine.com/bin/* ~/bin/ &&
mm-makegraphics.sh &&
mm-makePhotos.sh && \ #toprocess->tostamp->_photos
mm-stamp.sh
mm-makeThumbnails.sh && \ # which also calls mm-makeThumbnailHtml.sh
mm-makeAll.sh $1 && # creates index, otherIndex, and calls mm-divy unless --no-divy
mm-makeSitemapXml.sh &&
mm-makeSitemap.sh &&
mm-sync.sh
#########################################################################


As you noticed, "she bangs bin zee shell"; thus, Darwin here. The first thing I do is make sure that the latest scripts are in my bin directory. The second step regenerates any graphics that I've scripted via ImageMagick. Skip to the bottom of the page from more info on the graphics. Below is the listing for mm-makePhotos.sh which puts the photographs from my camera into the right resolutions and directories. Basically, I take a 4MB image and cut it down to ~ 1 MB, watermark it with mattmclaurine.com and then also create a thumbnail for the images. I did mention that I'm serving this site via satellite? Yeah, I live in the sticks. What'd I use to make that cool watermark? Imagemagick. How? I don't fucking remember. Read the damn tutorial like I did, and you should be able to figure it out.

#!/bin/zsh
cd /Users/lance/mattmclaurine.com/images/_photos/toprocess/ &&
# photos should already have their filenames assign by this point
# and moved into the toprocess directory...
for image in *.JPG
do
   ffmpeg -y -i "$image" -vf scale="-1:1080" \
     /Users/lance/mattmclaurine.com/images/_photos/tostamp/"$image"> \
/dev/null2>&1
done
#########################################################################


On the topic of ffmpeg, you'll notice that I call it to make sure that the images are scaled down to a maximum of 1080 vertical pixels. The horozonal pixels will be proportially squashed due to the "-1:1080" argument above.

Next, it's time to watermark the images. I do this by calling a program called imagemagick to place a graphic with my watermark (stamp.png) on top of each image. Once they are stamped, they get moved to their final location. I currently have about 1,300 photos on this site (as of 20240220).

#!/bin/zsh
cd /Users/lance/mattmclaurine.com/images/_photos/tostamp/ \
for i in *JPG
do
  magick composite -gravity south -geometry +0+10 \
    /Users/lance/mattmclaurine.com/images/z_stamp/stamp.png \
    "$i"out.JPG > /dev/null 2>&1 &&
  mv out.JPG "$i"
done &&
mv * /Users/lance/mattmclaurine.com/images/_photos/
#################################################################


Ok, so we've reduced the size and watermarked the photos. Next, I'll make a thumbnail of each of them and the corresponding html that will show them at 300x200 pixels. This program is atrociously poorly coded, but it works (if you think that I was going to spend more than a couple hours writing this code to automate what I had been doing manually, you've got the wrong idea about this site).

#!/bin/zsh
cd /Users/lance/mattmclaurine.com/images/_photos/toprocess && \
for image in *
do
  ffmpeg -y -i "$image" -vf scale="600:400" /Users/lance/mattmclaurine.com/images/_thumbnails/"$image" > /dev/null 2>&1
done
rm * || echo "Had a problem deleting the files in /Users/lance/mattmclaurine.com/images/_photos/toprocess"
/Users/lance/bin/mm-makeThumbnailHtml.sh
#############################################################################################################

...and the html for the thumbnails...

#!/bin/zsh
cd /Users/lance/mattmclaurine.com/images/_thumbnails && \
ls *JPG > thumbnails && \
sort -r -o thumbnails_sorted thumbnails && \
rm thumbnails.html && \
touch thumbnails.html && \
while read i
do
echo \<a href=\"\/images\/_photos\/"$i"\"\> \
\<img src=\"\/images\/_photos\/"$i"\" \>
width=\"300\" alt=\"mattmclaurine.com\" \
height=\"200\"\>\<\/a> \
>> thumbnails.html
done < thumbnails_sorted


Ok, now that all the image shit is done, the work begins on creating the html that will host the images above. What I do is create a gallery for each different day upon which an image exists. I acually base this decision on filename rather than other attributes. "How'd I get the images off the camera in 'IMG-9999.JPG' format into their current 'YYYYMMDD hh:mm:ss-<orignal name>' format? I use this to get those filenames:

#!/bin/zsh
for i in *
do
shrtdate=`stat -f %SB -t %Y%m%d-%H%M%S "$i"`
mv "$i" $shrtdate-"$i"
done
################################################


And, below is the code otherwise known as the "Make All" script. It concatenates my templates into index.html and otherindex.html. Then it calls--you got it--another fucking shell script because I'm getting senile or something.


#!/bin/zsh
cd /Users/lance/mattmclaurine.com && \
cat templates/html-head.html css/darkmode.css \
templates/html-head-body.html \
templates/header.html \
templates/body.html \
templates/footer.html \
templates/html-body-html.html \
> index.html
cat templates/html-head.html css/darkmode.css \
templates/html-head-body.html \
templates/headerOtherIndex.html \
images/_thumbnails/thumbnails.html \
templates/footerOtherIndex.html \
templates/html-body-html.html \
> otherIndex.html

# Don't forget the pr0n
~/bin/mm-makePr0nHtml.sh
cat templates/html-head.html css/darkmode.css \
templates/html-head-body.html \
templates/header-pr0n.html \
templates/pr0n.html \
templates/html-body-html.html \
> pr0n.html

#Now let's make the old pages...
if [[ $1 != "--no-divy" ]];
then
~/bin/mm-divyUpImagesToHtmlFiles.sh
fi
###################################################


And this is the code that creates the pr0n (my image favorites):


cd /Users/lance/development/mattmclaurine.com/mattmclaurine.com/public_html/templates && \
rm pr0n.html && \
touch pr0n.html && \

while read i
do
echo \<a href=\"\/images\/_photos\/"$i"\"\> \
\<img src=\"\/images\/_thumbnails\/"$i"\" \
width=\"300\" alt=\"$i at mattmclaurine.com\" \
height=\"200\"\>\<\/a\> \
>> pr0n.html
done < pr0n


The file pr0n is just a list of filenames.

Here's the code in the aforementioned mm-divyUpImagesToHtmlFiles.sh file which is the importantest most important code of importance. Beep-boop. AI out. What is does is this: Let's say it's a nice day on February 19, 2024, so I took some pictures that I want to have shown at mattmclaurine.com. And let's say that the previous day I did such a thing before was January 12, 2024. Etc. What the code below does is find all images associated with a common day with an html page to display them. It then creates the "navigation" at the bottom of the galleries that provide links to the other galleries. E.g., what my program does is figure out how to link 20240219 to it's previous page on 20240112; or if I insert some pics on a day that previously had no pics, it creates the new page correctly. If I haven't done any photo work, I pass the "--no-divy" parameter to the mm.sh script so that this code does not get invoked:

#!/bin/zsh
cd /Users/lance/mattmclaurine.com/ &&
find 20* -name index.html -delete

if [[ -e images/_thumbnails/thumbnails_sorted ]]; then
previousLink="index.html"
previousYear=""
previousMonth=""
previousDay=""
currentPage=""
nextLink=""
currentDate=""
currentYear=""
currentMonth=""
currentDay=""
nextDate=""
nextYear=""
nextMonth=""
nextDay=""
firstTransition=""
while read image
do

$nextYear/$nextMonth/$nextDay"

if [[ -z $currentPage ]]; then #2nd-If it's the 1st time through
currentPage=$image

currentYear=`echo $image | cut -b 1-4 -`
currentMonth=`echo $image | cut -b 5-6 -`
currentDay=`echo $image | cut -b 7-8 -`currentDate="$currentYear/$currentMonth/$currentDay"

cat templates/html-head.html css/darkmode.css templates/html-head-body.html > \
$currentYear/$currentMonth/$currentDay/index.html
echo "<p>Here are some pictures that I took on $currentYear$currentMonth$currentDay:</p>" >> \
$currentYear/$currentMonth/$currentDay/index.html


echo "<a href=\"/images/_photos/$image\"><img src=\"/images/_thumbnails/$image\" width=\"300\" height=\"200\"></a>" >> \
$currentYear/$currentMonth/$currentDay/index.html

else #2nd-Valid iterations 2->n
nextLink=$image
nextYear=`echo $image | cut -b 1-4 -`
nextMonth=`echo $image | cut -b 5-6 -`
nextDay=`echo $image | cut -b 7-8 -`
nextDate="$nextYear/$nextMonth/$nextDay"
if [[ $currentDate != $nextDate ]]; then #3rd--transition
#we're transistioning to the new date, so update $current values after writing html
#3rd--transition
if [[ -z $firstTransition ]]; then #4th--first time through?
#this is the first time through and the previous link is just to the index page
previousLinkHtml="<p><a href=\"/index.html\">Previous Page</a>"
nextLinkHtml="<a href=\"/$nextYear/$nextMonth/$nextDay/index.html\">Next Page</a></p>"

# on second thought, I should set previousYear to something
previousYear=$currentYear
previousMonth=$currentMonth
previousDay=$currentDay
#3rd--transition
else #4th--not, no first time #create those links
previousLinkHtml="<p><a href=\"/$previousYear/$previousMonth/$previousDay/index.html\">Previous Page</a>"
nextLinkHtml="<a href=\"/$nextYear/$nextMonth/$nextDay/index.html\">Next Page</a></p>"
fi
#4th--not the first time
#3rd--transition continued....
#Write the links, and button up links for "current page"
echo "$previousLinkHtml" >> $currentYear/$currentMonth/$currentDay/index.html
spaceIsThePlace="&nbsp;"
echo $spaceIsThePlace$spaceIsThePlace$spaceIsThePlace$spaceIsThePlace$spaceIsThePlace \
>> $currentYear/$currentMonth/$currentDay/index.html
echo "<a href=\"/index.html\">Go Home</a>" \
>> $currentYear/$currentMonth/$currentDay/index.html
echo $spaceIsThePlace$spaceIsThePlace$spaceIsThePlace$spaceIsThePlace$spaceIsThePlace \
>> $currentYear/$currentMonth/$currentDay/index.html
echo "$nextLinkHtml" >> $currentYear/$currentMonth/$currentDay/index.html

#first, finish off "current"
cat templates/html-body-html.html \
>> $currentYear/$currentMonth/$currentDay/index.html
#second, open the "next file"
cat templates/html-head.html css/darkmode.css
templates/html-head-body.html > $nextYear/$nextMonth/$nextDay/index.html
echo "<p>Here are some pictures that I took on $nextYear$nextMonth$nextDay</p>" >> \
$nextYear/$nextMonth/$nextDay/index.html

echo "<a href=\"/images/_photos/$image\"><img src=\"/images/_thumbnails/$image\" \
width=\"300\" height=\"200\"></a>" >> \
$nextYear/$nextMonth/$nextDay/index.html

previousLink=$currentPage
previousYear=$currentYear
previousMonth=$currentMonth
previousDay=$currentDay
previousDate="$previousYear/$previousMonth/$previousDay"
currentPage=$nextLink
currentYear=$nextYear
currentMonth=$nextMonth
currentDay=$nextDay
currentDate="$currentYear/$currentMonth/$currentDay" #3rd--done with code for transitions
else #3rd-transition: no transition
#No transition, here. Just write $image out each time neede...
echo "<a href=\"/images/_photos/$image\"><img src=\"/images/_thumbnails/$image\" \
width=\"300\"height=\"200\"></a>" >> \
$currentYear/$currentMonth/$currentDay/index.html
fi #3rd-transitions
fi #2nd--1st or nth time?
done < images/_thumbnails/thumbnails_sorted

# but wait, there's one more file to write...
# need to figure out what images are on the last page...which I haven't done yet
# so, the below will not work until that's done...

previousLinkHtml="<a href=\"/$currentYear/$currentMonth/$currentDay/index.html\">Previous Page</a>"
nextLinkHtml="<a href=\"/index.html\">Next Page</a>"
# Note, that at this point $previous=$current, so the below is correct
echo $previousLinkHtml >> $currentYear/$currentMonth/$currentDay/index.html #because current=next at this point in the program
spaceIsThePlace="&nbsp;"
echo $spaceIsThePlace$spaceIsThePlace$spaceIsThePlace$spaceIsThePlace$spaceIsThePlace \
>> $currentYear/$currentMonth/$currentDay/index.html
echo $nextLinkHtml >> $currentYear/$currentMonth/$currentDay/index.html
cat templates/html-body-html.html >> $currentYear/$currentMonth/$currentDay/index.html
else #1st
print "Sorry, dude, but I don't see a file to parse"
fi #1st
##################################################################################################################################

As James Joyce said, "Phew! What a warm time we were in there but how keling is here the airabouts" (FW 10:24-26). And a buncha other shit you should check out (but, I'd suggest reading Ulysses before FW).
Anywho, we're almost done. Everything important has happened, but somehow, in "doing my research," I created a sitemap to help the indexers out. Here's that piece of crap:

#!/bin/zsh
cd "/Users/lance/mattmclaurine.com" &&
find . -name "*html" > sitemap &&
sed -i.bak 's_./__' sitemap &&
sort sitemap > sitemap_sorted &&
mv sitemap_sorted sitemap &&

echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"> sitemap.xml &&
echo "<urlset xmlns=\"https://www.sitemaps.org/schemas/sitemap/0.9\">" >> sitemap.xml &&
echo "<url>" >> sitemap.xml &&
echo "<loc>https://mattmclaurine.com/index.html</loc>" >> sitemap.xml
echo "</url>" >> sitemap.xml &&
while read url
do
echo "<url>" >> sitemap.xml
echo "<loc>https://mattmclaurine.com/$url</loc>">> sitemap.xml
echo "<lastmod>2023-04-18</lastmod>" >> sitemap.xml
echo "</url>" >> sitemap.xml
done < sitemap &&
echo "</urlset>" >> sitemap.xml
#######################################################################################


Just noticing that I should change the last mod to be something like `date` instead of hardcoded to 2023-04-18. Anywho, here's the corresponding html version:

#!/bin/zsh
cd /Users/lance/mattmclaurine.com && \
cat templates/html-head.html \
css/darkmode.css \
templates/html-head-body.html \
templates/header-sitemap.html \
> sitemap.html
echo "<p style=\"font-size:12px; \">" \
>> sitemap.html

echo "Here's all the html pages:" \
>> sitemap.html
echo "</p>" >> sitemap.html
echo "<p style=\"font-size:10px; \">" \
>>sitemap.html
echo while read html
do
echo "<a href=\"$html\">$html</a><br>" \
>> sitemap.html
done < sitemap
echo "</p>" >> sitemap.html
cat templates/footer-sitemap.html >> sitemap.html
cat templates/html-body-html.html >> sitemap.html
#################################################


Finally, I call a program that syncs the code off my laptop and onto the Raspberry Pi Model 3B that hosts this site (not included--the program, you're looking at the stupid site). The code itself is now managed via git, and Apache NetBeans is my IDE of choice when not using vi.

 


 

Here's how I created the graphics (not the ones above on this page, but the one on the home page). CandiceEF is a font I have on my Mac. You should be able to find a similar or the same one if you use a search engine.:

#!/bin/zsh
cd /Users/lance/mattmclaurine.com/images/images &&
echo "Making imagemagick images..."
magick -size 420x100 xc:#111111 -font CandiceEF -pointsize 72 -fill white \
-stroke black -strokewidth 25 -annotate +25+65 'Welcome to' \
-stroke red -strokewidth 20 -annotate +25+65 'Welcome to' \
-stroke black -strokewidth 15 -annotate +25+65 'Welcome to' \
-stroke white -strokewidth 10 -annotate +25+65 'Welcome to' \
-stroke black -strokewidth 2 -annotate +25+65 'Welcome to' \
-fill dodgerblue -draw "text 25,65 'Welcome to'" \
0-welcome-to.jpg
magick -size 900x100 xc:#111111 -font CandiceEF -pointsize 72 -fill white \
-stroke black -strokewidth 25 -annotate +25+65 'Matt McLaurine.com' \
-stroke red -strokewidth 20 -annotate +25+65 'Matt McLaurine.com' \
-stroke black -strokewidth 15 -annotate +25+65 'Matt McLaurine.com' \
-stroke white -strokewidth 10 -annotate +25+65 'Matt McLaurine.com' \
-stroke black -strokewidth 2 -annotate +25+65 'Matt McLaurine.com' \
-fill dodgerblue -draw "text 25,65 'Matt McLaurine.com'" \
0-mm.com.jpg
magick -size 1000x100 xc:#111111 -font CandiceEF -pointsize 50 -fill white \
-stroke black -strokewidth 25 -annotate +25+65 'Pushing that boulder uphill one day at a time' \
-stroke red -strokewidth 20 -annotate +25+65 'Pushing that boulder uphill one day at a time' \
-stroke black -strokewidth 15 -annotate +25+65 'Pushing that boulder uphill one day at a time' \
-stroke white -strokewidth 10 -annotate +25+65 'Pushing that boulder uphill one day at a time' \
-stroke black -strokewidth 2 -annotate +25+65 'Pushing that boulder uphill one day at a time' \
-fill dodgerblue -draw "text 25,65 'Pushing that boulder uphill one day at a time'" \
0-sisyphus.jpg
magick -size 1000x100 xc:#111111 -font CandiceEF -pointsize 32 \
-fill white -draw "text 23,63 'March 8, 2024'" \
-fill white -draw "text 27,67 'March 8, 2024'" \
-fill white -draw "text 24,64 'March 8, 2024'" \
-fill black -draw "text 26,66 'March 8, 2024'" \
-fill gray -draw "text 25,65 'March 8, 2024'" \
1-update.jpg


Here's how you create the neon-ish type banner on this page:

magick -size 1200x400 -fill dodgerblue -background \#111111 -gravity Center \
-font CandiceEF -pointsize 60 label:' Welcome to \n Matt McLaurine.com \n Pushing that boulder uphill \n one day at a time' \
\( +clone -blur 0x25 -level 0%,50% \) \
-compose screen -composite neonsign.png


Ciao

MM 240310


(c)2023-2026 All Rights Reserved

Sarcasm Warning      Policy      Terms      Not sure what this one does...