Category Archives: Uncategorized

I think I may be addicted to creating AI art

I’ve watched from the sidelines for about a year now. The photography YouTubers I follow one-by-one fell in love with it, I started seeing a lot of criticism from artists YouTubers, and a few months ago my old brother became enamored with it, reinventing himself as an AI Artist and posting 100’s of images to Facebook. So when a buddy of mine showed me Bing’s Image Creator early last week I was quite interested.

Suffice to say, I’ve fallen hard for this tech. A lot of the AI art I was seeing months ago wasn’t very impressive, but today it seems amazing. I was in awe of this creepy pumpkin it created for me:

“A scary carved jack-o-lantern smoke around it, modern H.R. Giger stylized oil on canvas”

If this was on a t-shirt, I’d consider buying it. It’s just so mind boggling good.

After toying around a bit I wound up becoming entranced with creating this stuff. Early last week they were giving 100 credits per day (now it looks like its only 25). So I had plenty of room to experiment with prompt ideas. And a good prompt is key. I found out early on that if a prompt isn’t yielding good images, just ditch it and move on to something else. However, once you create a good prompt, you seem to get an endless supply of cool images. For example, the above image was created with the prompt “A scary carved jack-o-lantern smoke around it, modern H.R. Giger stylized oil on canvas”. Making subtle tweaks to that prompt you can get all sorts of good stuff.

“A scary carved jack-o-lantern in the clouds with smoke around it, modern H.R. Giger stylized oil on canvas”

And almost any kind of image you can think of it can generate. For example, you can create medical cut-away diagrams with this prompt: “Detailed anatomical cut-away diagram of ___” (I didn’t come up with this one myself, someone told me about it). It can yield all sorts of wild images.

“Detailed anatomical cut-away diagram of a smiling emoji”
“Detailed anatomical cut-away diagram Stay Puft Marshmallow Man from Ghostbusters”

And If you don’t like blood and guts, you can describe what you think should be inside and it’ll do that instead.

“Detailed anatomical cut-away diagram of Santa Claus with tiny elves inside working machinery”
“Detailed anatomical cut-away diagram of Snorlax with tiny pikachus inside operating a computer”

The cut-away effect can also be used in descriptions to create interesting looking stuff:

“A large skull in the clouds with a skeleton living inside of it. A cut-away view shows the skeleton inside drawing on at a desk. modern H.R. Giger stylized oil on canvas”

For some of these images if you look closely you’ll see mistakes. And in the skull one above I actually used Photoshop’s AI generator to fix some of the parts I didn’t like (basically I used the lasso tool to select what I didn’t like, then I had Photoshop’s AI generate something new). However, Photoshop’s AI is waaaaay behind Dalle3.

This thing is also great for memes and in-jokes. At work we have this in-joke about Alf (too complex and long of a story to go into here). I’m able to generate an endless supply of goofy Alf images.

“Profile view of 80’s Alf with a beard and sunglasses. Image is in a fantasy or cartoon or painted style.”

I also have had this weird obsession with Billy Idol’s Cyberpunk album. I actually really like the album, it’s not his best, but it’s so bizarre and off brand, yet I still like the music. I can make all sorts of weird art for the album:

“It’s the 1980’s. Billy Idol is sitting at a computer, his back is to the camera. Inside the computer screen is another world. He’s working on his new album, Cyberpunk 2.0. The world is beginning to come out of the screen. Image is in a fantasy style.”

Are AI Artists Artists?

That’s a good question. I feel like even Bing considers Dalle3 the artist and not the user, otherwise it wouldn’t be blocking so many prompts. After all, you don’t see Photoshop implementing such draconian censorship for what its users can create. But the refining of prompts and editing images after the fact isn’t nothing. Even though my brother considers himself an artist and the AI creations his art, I’m still on the fence about it. I feel more like a slot machine junkie than an artist when creating this stuff. It’s fun and cool to look at – and even functionally useful in some cases too (even if just for a laugh at work). At what point does someone become an artist in anything? And even though this stuff is cool – is it actually art? Is the user’s prompt (the idea for creation) what makes it art? Questions for a longer think piece I suppose, for now I’ll just enjoy the stuff.

What to do with all of this stuff?

At the moment I don’t know. I was putting it on my Flickr, but then quickly deleted it all because that seemed like the wrong place. I started posting some to Twitter, that seems like the most logical place (especially since I’ve never really used my Twitter account). If you’re doing AI art feel free to hit me up over there. For now I’ll leave you all with a random assortment of AI art images I generated in the last few days (a lot of these prompts have suggestions from others – I’m including them so you see how I got the images).

“Painting of an Armageddon of elemental wind, air, and gust, people cowering, raging colored gases and wind, clear details painted in the style of “The Last Day of Pompeii” by Karl Bryullov”
“Painting of an Armageddon of elemental wind, air, and gust, raging colored gases and wind, clear details painted in the style of “The Last Day of Pompeii” by Karl Bryullov”
“whimsical illustration, femininity in a box, vibrant colors, geometric shapes, layered paint, M.C. Escher stylized homage”
“In the distance we see an old man looking up at a black hole sun. modern H.R. Giger stylized oil on canvas”
“Inside a labyrinth in Dracula’s castle, modern H.R. Giger stylized oil on canvas”
“Alice from Alice in wonderland is sitting at a computer, her back is to the camera. Inside the computer screen is another world. The world is beginning to come out of the screen. Image is in a fantasy style.”

Some ESLint rules to better your React code

ESLint is a tool for analyzing your JavaScript code and finding potential problems. A couple months ago I taught myself how to create plugins for it so I could write my own linting rules. I wound up writing two rules, both of which I’ll go into below.

prefer-use-state-lazy-initialization

React has a neat optimization trick for its useState hooks. When doing something like this:

const [data, setData] = useState(expensiveFunctionCall());

You’ll wind up calling expensiveFunctionCall on every render, when all you really wanted was to call it on the first render. To resolve this, React allows you to pass an initializer function to useState rather than an actual value:

const [data, setData] = useState(() => expensiveFunctionCall());

Now expensiveFunctionCall will only be called on the first render.

I was honestly pretty surprised that you could do this, and it’s such a neat little trick that I thought there should be a linting rule that would detect function calls in useState and alert you to using this optimization… and that’s what this rule does. If you’re not taking advantage of this trick, it’ll alert you so that you can change your code to do so.

I thought the rule was cool enough to submit to the React team, but it’s been languishing for months in their PR queue so I don’t see it getting added to their set of eslint rules.

no-named-useeffect-functions

There are a lot of coding tips out there, and not all of them are good. One such tip is naming useEffect functions. On the surface this might seem harmless, but it bloats the code, puts naming any kind of callback into question (for consistently), and is just in general pretty obnoxious. Now you may not agree with me, but if you do and want a rule to find such cases, well, this is that rule.

Only 2?

Yeah, for now at least. 

Is it easy to write these things?

If you’ve ever wondered about how to write your own eslint rule, just check out the project for the rules above. They’re surprisingly easy to write. Once you have the basic boiler plate down, all you really need is an AST Explorer and you can write them pretty quickly (this generator is also pretty useful).

New patrickgillespie.com

2021 Update: I’ve since re-done the site again, when I get a chance I’ll write something up on it. The post below refers to an older design.

***

Another redesign, this time a good one, I swear! I decided to learn ReactJS, and for my first project I redesigned my photography website, patrickgillespie.com

My previous design was pretty bad, I guess no one had the heart to tell me. For this new one I studied several other designs and took elements I thought worked best. It’s simple, responsive, and the code is up on github if anyone is looking for a portfolio template.

patrickgillespie.com had been pretty dead for about a year, receiving an average of 2-3 visitors a week, probably bots. The domain was about to expire earlier this month, when I noticed a big uptick in visitors leading up to the expiration day (~20 a day). Were these other Patrick Gillespies eyeing the domain? Domain vultures looking to scoop up a site that was about to fall into the abyss? I guess I’ll never know.

patorjk.com, on the other hand, has been alive and kicking, at least visitor wise. No one reads this blog, but the apps on the site see hundreds or thousands of visitors a day, making me feel sort of bad about neglecting the site. It’s like a rudderless ship that has somehow managed to successfully sail the ocean.

Anyway, if you’re reading this, I hope you enjoy the new portfolio site or at least find some use in the code. The most useful piece of it is probably the create-image.js script, which creates multiple sizes of a photo and extracts it’s exif data into a JavaScript object which the application can use.

New YouTube Channel

I’ve started a YouTube channel. So far I’ve only created a few videos, and I’m still trying to figure out what I want the channel to center around, though below you can see a couple of the videos I’ve created.

I figured the keyboard one might be of interest to some who visit this site, since it ties into the Keyboard Layout Analyzer app. The drone videos are fun, and there are a lot of neat places around me. Right now I’m trying to think of things the utilize photography and technology, though I’m still not sure what I want the channel to center around. Anyway, hope you like the videos.

McDonald’s 2014 Monopoly Game Odds Analysed

McDonald’s is running their annual Monopoly Game until the end of the month. The highest prize is $1,000,000 – which goes to the lucky soul who’s able to find the coveted Boardwalk stamp amongst the 651,841,628 game pieces. That equates to every person in the US eating 2 Big Macs before the prize is guaranteed to be given out. Even the odds of winning the Powerball jackpot are higher (1 in 175,223,510), and its minimum jackpot is $40 million.

Our brains aren’t really wired to intuitively grasp probabilities, and the marketing departments of big companies know this. With McDonald’s eclectic mix of a hand full of large prizes and a ton of small prizes, it’s clear they’ve put some serious research into what will get customers through their doors. And it works. Hell, the only time of year I eat at McDonald’s is when they run this contest – though I always sort of regret it later. It’s a fun contest, but I think knowing the odds gives you a more clear picture of what to expect.

The Basics

  • There are 651,841,628 game pieces in play. Each game piece contains 2 stamps.
  • 156,210,425 prizes will be given out.
  • The prizes falls into 4 categories: food prizes, instant wins, online prizes, and monopoly prizes. See the below table for a statistical breakdown.
Prize Category Number of Prizes Odds of Winning
Food 128,769,022 19.75%
Instant Win 25,780,151 3.95%
Online 1,661,242 ??? (see below)
Monopoly 1,359 0.0002084862245%

Chance of Winning Illusion

There might be some interesting psychology going on with how the game is played. Each game piece is 2 stamps, making you feel like you have 2 chances to win. However, the official rules only talk about the odds of game pieces, not stamps. This makes me wonder if only the game pieces matter, which would mean that at least one stamp on a game piece is always a loser. This would mean that half of the stamps you peel are just there for psychological effect of playing the game. You end up feeling like you have twice as many chances to win, when in reality, its just an illusion.

Unfortunately it’s hard to confirm this hypothesis. If the odds of a game piece winning are 25%*, then each stamp should have an individual winning probability of 13.4%**. This means the odds of both stamps winning on a game piece are 1.8%***. This means you’d need a really large same set to confirm that both pieces can’t win. I have around 56 stamps from friends and family, none of which were double winners – but that doesn’t mean much, since the odds of getting a double winner with 28 game pieces is only 40% (1 – 0.982^28). To be over 99% certain that double winning pieces don’t exist, you’d need to peel at least 254 game pieces.

This is just a theory though, and it could all be easily disproven if a double winning stamp shows up. This should happen 1.8% of the time, so if you’re really hungry you can test this out.

* The rules claim you have a 1 in 4 (25%) chance of being a winner. However, this number is rounded. If you add up the number of prizes and compare it with the number of pieces, you see that the number is closer to 24%.

** I worked backwards for this number by finding the probability of both stamps not winning: (1 – 0.134) * (1 – 0.134) = ~75%

*** Both stamps winning would have a probability of 0.134 * 0.134 = ~1.8

Odds for Rare Pieces

I’ve seen some sites structure their odds around finding a complete monopoly, but that’s just silly. There are only two types of pieces: rare ones, and ones that show up all of the time. If you find one of the rare pieces, you’ve basically won the prize.

Stamp Odds Prize Number Available
Mediterranean Avenue 1 in 651,842 $50 1000
Vermont Avenue 1 in 144,583,163* Free Gas for a Year ($2,350 ARV) 4
Tennessee Avenue 1 in 2,429,970 Mobile Wallet Prize ($3,150 ARV) 238
Virginia Avenue 1 in 690,723,394 $5,000 5
Short Line 1 in 57,833,265 $5,000 Target Shopping Experience 10
Ventnor Avenue 1 in 8,691,222 Beach Resort Vacation ($6,500 ARV) 75
Kentucky Avenue 1 in 32,592,082 Delta Vacation ($7,500 ARV) 20
Water Works 1 in 162,960,407 $10,000 4
Pennsylvania Avenue 1 in 1,686,343,601 Cessna Private Jet Trip ($16,900 ARV) 2
Boardwalk 1 in 651,841,628** $1,000,000 1

What do these odds mean? The best analogy I found was on a page for grasping large numbers. It gave the following example of how big 100,000,000 was: if you stacked 100,000,000 one dollar bills on-top of each other, they would reach 6.79 miles into the sky. That’s high enough to touch an airplane at cruising altitude.

* These odds appear to be wrong, as they differ from Water Works which also only has 4 stamps available. However, this is what the rules page lists.

** The Boardwalk odds come from the rule page, however, the winning stamp is apparently guaranteed to be on a Big Mac. If you focus your energy on eating Big Macs, this means your odds of winning are 1 in 37,955,000.

Online Game

Not much has been written about the online game, there are two main reasons for this:

  • There are no set odds. This is because the chances of winning are based on how many people decide to play their pieces online.
  • The prizes are very “meh”. Most of the 1,661,242 prizes are Red Box Rentals (1,400,000) and My Coke Rewards Points (250,000). However, there are a few decent prizes, and there is a top prize of $50,000.

Your odds of winning the $50,000 prize are the number of stamp codes you submit to the total number stamp codes submitted. Based on the 56 game stamps I’ve entered in, 3 were red box rentals. Extrapolating that out, the red box rental odds could be 1 in 20, which would mean McDonald’s expects 28,000,000 stamps to be entered in. This would mean your chance of winning the 50k per game piece would be 1 in 14,000,000. Now, 3 data points is too small a data set to make this assumption, so this should be thought of as just a back of the envelop calculation.

However, assuming these odds were true, that would mean if you spent the next week buying Hash Browns and entering in the max number of stamps a day (10), you could bring your odds of winning the 50k up to 1 in 400,000. This seems like a neat idea until you consider that if you spent the same amount of cash ($35) on Maryland Monopoly Lotto tickets, you would have a 1 in 385,031 chance of winning twice as much.

Food Items with Stamps

For those interested, Hash Browns have the best price to stamp ratio.

Name Price # Stamps Price Per Stamp
Bacon Clubhouse $4.69 2 $2.35
Big Mac $3.99 2 $2.00
Egg McMuffin $2.79 2 $1.40
Egg White Delight McMuffin $2.79 2 $1.40
Fruit & Maple Oatmeal $1.99 2 $1.00
Filet-O-Fish $3.49 2 $1.75
Hash Browns $1.00 2 $0.50
Large Fries $2.19 4 $1.10
Medium Fountain Drinks $2.49 2 $1.25
Medium or Large Hot McCafe Drink $2.59 – $3.39 2 $1.30 – $1.70
Premium McWrap $3.99 2 $2.00
Sausage McMuffin with Egg $2.79 2 $1.40
10-piece McNuggets $4.29 2 $2.15
20-piece McNuggets $4.99 4 $1.25

For legal reasons, McDonalds also allows you to request free pieces through the mail. A couple of individuals tried this out by requesting 500 pieces and comparing the outcome to buying 500 hashbrowns. It’s neat as an experiment, but unless you’ve got a lot of free time, you’re best bet is just buying Hash Browns.

Conclusion

Unless you’re in the mood for McDonald’s, don’t make your lunch decision based on the Monopoly Game. If a game of chance is what you’re after, you’re better off playing the lottery. However, if you’re going to McDonald’s anyway, get an item with pieces, as the game does make their food experience a little more fun.

Une Bobine Review

phone

My wife’s phone

A couple weeks ago I was offered a review copy of an Une Bobine. The device looked kind of fun, so I decided to try it out.

Une Bobine is an iPhone charger, sync, and stand that’s made from a flexible metal cable. This cable can be bent and shaped to create unique setups. In the pic to the right you can see it twisted both into a practical stand and into a stand where I’m just seeing how high I can get the phone. The pluses for this device are that you can facetime without needing to hold onto the phone, that you can take time lapse photos, and that you can shape the cable so that it isn’t in your way.

The product made its original debut into the marketplace in 2012 after a very successful Kickstarter campaign. This success ended up breathing life into the small company behind the device, and since that time they’ve repeated this recipe by funding most, if not all, of their products through either kickstarter or indiegogo crowd sourcing campaigns. I mention this only since it’s kind of interesting – 10 years ago this kind of company probably wouldn’t have been able to exist.

Anyway, to give the product a thorough look I let my wife take it to work for a few weeks to see what she thought. It seemed pretty durable and she liked that the cable didn’t get in her way. It was also fun to play around with, making it sort of like an adult tech toy. The only negatives either of us could see with the product were that you couldn’t have your phone in its case while charging and that it was a little troublesome to use in the car. If you choose to use it in your car, you will want to test out your setup to make sure it wont fall over or get in the way of the radio.

Overall its a fun product. If you’re looking for a tech device to play around with, it’s something that can provide you some entertainment and utility while you’re at your computer. Lastly, the cable’s name is a little strange, but that’s because it’s French. Translated, “Une Bobine” simply means “a coil”.

Nomad ChargeKey Review

DSC_0082I don’t normally do reviews of tech devices, but I was recently offered a review copy of Nomad’s ChargeKey, and since it seemed like a neat little device, I decided to check it out.

ChargeKey is a portable lightning cable that fits on a keychain. It comes in both a lightning (iPhone) and micro-usb format (Android / Windows Phone). The idea behind it is to allow people to always have a cable to plug-in to a USB port if they need to charge or sync their phone. If you use a laptop or have a keyboard with a USB port this is really convenient. The cord is also flexible, so technically you could also plug it into the a USB slot on the back of a desktop tower too.

Priced at $29, it costs $10 more (or 53% more) than a normal lightning cable from Apple. This means you’re basically paying $10 more for the added convenience of a short portable cable. That’s a little high, but not too bad.

One thing I’m not completely certain on is its durability. Their marketing material mentions that its made with “high grade plastics from Bayer”, but I wasn’t able to find any information on if it was water proof (so I assume its not). I also wonder about the long term wear and tear the device can take, though for something this new its probably too early to tell. After 3 weeks I haven’t encountered any problems though.

Other than that, there’s honestly not a whole lot to say. It’s a simple product that lives up to its expectations. If you think its something you’d like, I’d definitely recommend it.

Scaling Back Ads

I figured I’d announce that I’ve decided to scale back the ads on this web site. Something about putting ads on this blog has always felt a little odd to me. The extra revenue is nice, but I’m not sure its actually worth the commercialization ads bring.

There are still two ads on the site, the Google Custom Search box on this blog’s sidebar, and an ad on the Text Ascii Art Generator (TAAG). The search box is actually functionally useful and the ad on TAAG will still allow a little bit of change to trickle into the site. I don’t plan on adding any more ads until I need to upgrade hosting services.

Part of me wanted to justify my decision with the idea that “ads turn away visitors”, so I decided to make a chart pitting TAAG (which has an ad) and against the VB Array Tutorial (which doesn’t have any ads). Surprisingly, it appears that the ad on on TAAG didn’t have a noticeable negative impact on the number of visitors it received:

This might be like comparing apples to oranges, since both pages probably appeal to a different group of people. However, TAAG’s ad was added in April, so if it bothered visitors I’d expect its growth to go down after April, but instead it seems to have continued on with the normal growth of this site (the spike in June is due to it being popular on StumbleUpon for a few days). This doesn’t change my opinion on removing ads from the blog, I still feel they add an unwanted commercial element to a personal outlet, however, I figured I’d post up this chart for those of you interested in how ads may/may not effect site growth.

Live.com’s linkfromdomain Operator

Most people are pretty familiar with Google’s Advanced Search Operators. You can use them to more preciously search for web pages or particular data. Anyway, earlier today I discovered that Microsoft’s search engine, live.com, has an amusingly useful search operator that Google doesn’t have. It’s called linkfromdomain. Now, this isn’t new news. I did some Googling and the operator has been around since late 2006, however, since not very many people use live.com, I figured some of you might find this info useful.

The linkfromdomain operator allows you to search the websites that a particular website links to. For example, if you search for “linkfromdomain:patorjk.com“, you’d get a list of all of the sites I link to throughout this website. At first glance this may not seem that useful, however, it allows you to ask some interesting questions as an individual and as a webmaster. Here are some examples:

I don’t think Google currently has the ability to answer any of those questions, which is a little surprising. Anyway, there are probably lots of other neat questions you can form using the linkfromdomain operator. It’s definitely something to keep in mind when you’re surfing the web.

New Web App: Typing Speed Test

I figured a good companion for my Keyboard Layout Analyzer would be a Typing Speed Test. Right now the program is pretty bare bones, however, it does have a few neat configurable options. You can test your typing speed skills against typing words drawn from a database of the 978 most common English words or against words drawn from a database of the 1000 most common “SAT words”. You can also vary the time settings. You can type for 60 seconds or until you’ve finished typing a certain number of words.

In the next week or two I hope to add output stats about which fingers and keys were typed the fastest. I think I also want some more creative text inputs that a user can select from. Maybe programming code, text from popular books, and song lyrics. How fast you can type a given programming language probably isn’t that useful, but it might add to the fun factor. If you have any suggestions or comments about the app please let me know. It was written pretty hastily in my spare time during the past week, so it’s still a little wet behind the ears. However, I did test it in IE 6.0, IE 7.0, FireFox 3.0.3 and Opera 9.24, so it should work fine.

DoFollow WordPress Plug-in

As a way of saying thank you to people who comment and as a way to encourage more people to comment (as long as they don’t spam), I’ve installed the DoFollow WordPress plug-in. Basically, it makes it so linkjuice is passed onto the websites of people who comment. I will nofollow links of people who I think are being spammy, but I figured I’d be a nice/easy way of saying thanks to the people who do decide to say something.

Happy Halloween

Lastly, since the 31st is approaching…

My pumpkin is on the far left, it’s supposed to be two bats. I should probably stick to programming… it was a lot of fun though. If you have a few extra hours, it’s worth revisiting. For me, it’d been almost a decade since I’d carved a pumpkin.