Month: January 2024

AI Personas

I’ve seen people have a bit of fun with AI personas — pre-prompts that say “be a pirate” or something similarly silly, but you can use the personas to gear answers toward yourself as the target audience too — deeply technical or “explain it like I’m five”.

Although the AI takes “like I am 5” a little too literally — don’t need smart little elves or castles.

The technical pre-prompt, though, avoids getting high level basic facts that you already know.

Tangzhong Chocolate Chip Cookies

Ingredients:

  • 2 cups (426g) light brown sugar, packed
  • 2 teaspoons table salt
  • 16 tablespoons (226g) unsalted butter, cut into 1″ pieces
  • 1/2 cup (113g) milk, whole preferred
  • 2 3/4 cups (330g) flour
  • 2 large eggs, cold from the refrigerator
  • 1 tablespoon vanilla extract
  • 1 3/4 teaspoons baking powder
  • 1/4 teaspoon baking soda
  • 2 cups (340g) semi-sweet chocolate chips
  • In a large bowl, combine the brown sugar and salt. Set aside.
  • In a saucepan over medium-high heat, melt the butter. After several minutes, the butter will sizzle and may spatter. Continue to cook the butter, swirling the pan regularly, for about 5 to 7 minutes, until it’s a dark golden brown color and brown bits start collecting at the bottom of the pan; the butter will have stopped sizzling and may also have a layer of foam on the surface.

  • Once the butter is browned, immediately pour it over the sugar mixture (be sure to scrape out the brown bits at the bottom) and whisk vigorously to combine; this helps dissolve the sugar slightly and creates the shiny surface of the baked cookies. (The mixture will stay lumpy and won’t become smooth at this point.) Set the empty saucepan aside to cool slightly.
  • In the same saucepan used to brown the butter, combine the milk with 3 tablespoons (23g) of the bread flour and whisk until no lumps remain.
  • Place the saucepan over low heat and cook the mixture, stirring regularly with a whisk and then a flexible spatula, until it’s thickened, paste-like, and starts to come together into one mass, about 2 to 3 minutes.
  • Remove from the heat and transfer directly to the bowl with the butter and sugar. Whisk until mostly smooth; some lumps are OK.

  • Add the eggs and vanilla and continue whisking until smooth.

  • Weigh or measure the remaining 2 1/2 cups plus 1 tablespoon (307g) bread flour by gently spooning it into a cup, then sweeping off any excess. Add the bread flour to the bowl with the butter and sugar, then add the baking powder and baking soda. Using a whisk or flexible spatula, stir until well combined and no dry spots remain.
  • Place the bowl, uncovered, in the refrigerator and allow it to cool for 10 to 15 minutes.

  • While the batter is cooling, use a serrated knife to roughly chop the chocolate into coarse pieces. Avoid chopping the chocolate too fine, as small pieces will melt when mixed into the dough.

  • Remove the dough from the refrigerator and fold in the chopped chocolate. Cover the bowl and return to the refrigerator for 24 to 72 hours to allow the flavors to intensify.

  • To bake, remove the chilled cookie dough from the refrigerator and let it rest at room temperature for about 10 to 15 minutes to allow it to warm up slightly. Meanwhile, preheat the oven to 350°F with a rack in the center.

  • Scoop the dough into balls about 2 1/4″ in diameter.

  • Arrange the scooped cookie dough on parchment-lined baking sheets, spacing them 3″ to 4″ apart. For consistently shaped cookies, roll each piece of dough into a smooth ball before baking.

  • Bake the large chocolate chip cookies for 18 to 22 minutes, until the edges are set and the cookies are browned, rotating the pan halfway through baking to ensure even browning. Remove the cookies from the oven and let them rest on the baking sheets until cool enough to handle, at least 15 minutes.

Baked Corndogs

Baked corndogs aren’t quite a success. The basic idea is to make a fairly doughy corn bread that can be rolled out and wrapped around the hotdog / veggie dog / sausage.

Rollable Cornbread Dough

1 cup all purpose flour + 1 cup cornmeal
1/4 cup sugar
1 tsp baking soda
1/2 tsp salt
1/2 tsp ground mustard
6 tbsp butter
2 Tbsp honey
1 tbsp yeast
1/4 cup buttermilk

Combine dry ingredients, cut in butter, then add honey. Hydrate the yeast in a few tablespoons of water. Mix yeast and buttermilk in until you’ve got a firm dough.

After it sits for an hour, roll it out and cut strips to wrap the dogs. Allow to rest for about half an hour. Bake at 375 for 20 minutes.

The dough was very crumbly and a little dry. Next time, maybe a little more butter and all purpose flour to make something a little more like a croissant

Updating Fedora — System Boots to Grub Error After Update

If you film the boot sequence and look frame by frame, you’ll see that it very briefly flashes a TPM error

error: ../../grub-core/commands/efi/tpm.c:150:unknown TPM error.

 

From what I’ve been able to glean, this secure boot stuff works off of signatures. Microsoft has signatures in BIOS. Everyone else kind of inserts their keys on the fly … so you can run out of space to save these keys and be unable to boot. To work around this, every time an update gets us over the limit, we go into the secure boot DBX management menu and reset the “Forbidden Signatures” from factory default. This is 13 keys instead of 373, and the OS is able to do it’s “thing” and boot.

 

And I’m actually writing this down this time because I had spent a lot of time researching this last time Scott’s laptop failed to boot and dumped out to a grub menu. This time, I kinda know what we did and why but lost a lot of the details.

RSync to Mirror Local Files

The rsync utility was meant to be used to sync files across the network — to or from an rsync server. For some time, I had a group of friends who shared documents off of my rsync server. Anyone with access could run an rsync command and sync their computer up with the group’s documents. With the advent of online file storage and collaborative editing, this was no longer needed. But I still use rsync to make sure my laptop has a local copy of a folder on the server. Mount /path/to/folder/contents/to/copy to the SMB or NFS share, and the following rsync command ensures the laptop’s /path/to/where/contents/should/be/placed has an exact mirror of the contents of the server folder

rsync –archive –verbose –update –delete “/path/to/folder/contents/to/copy/” “/path/to/where/contents/should/be/placed/”

–archive is a grouping of:
-r recursive
-l copy symlinks
-p preserve permissions
-t preserve modification timestamps
-g preserve group
-o preserve owner
–devices preserve device files (su only)
–specials preserve special files

Python: Generate Transcript of Video File

There’s a speech_recognition module in Python that transcribes an audio file — since ffmpeg can convert a video file to mp3, that means you can also use Python to transcribe a video file.

# requires pocketsphinx from CMU if using sphinx for speech to text recognition
import os
import speech_recognition as sr
import ffmpeg

strFFMPEGBinaryLocation = 'c:/tmp/ffmpeg/bin/ffmpeg.exe'
strCurrentDirectory = os.getcwd()

strInputVideo = "\"Z:/Path To/My Video/file.MP4\""
strOutputFileName = "converted.wav"
# Convert mp4 to wav file
strffmpeg_convert_mp4_to_wav = f'{strFFMPEGBinaryLocation} -i {strInputVideo} {strCurrentDirectory}/{strOutputFileName}'
os.system(strffmpeg_convert_mp4_to_wav)

# Run converted wav file through speech recognizer
r = sr.Recognizer()
audio = sr.AudioFile(f'{strCurrentDirectory}/{strOutputFileName}')

with audio as source:
	#audio = r.record(source, 90)				# Would need API key to process longer audio?
	#text = r.recognize_google(audio)
	audio = r.record(source)
	text = r.recognize_sphinx(audio)
print(text)

PowerShell: Mass Active Directory Password Changes

We have a bunch of accounts that function as extra mailboxes — all conveniently housed in on OU. The following PowerShell command sets the password for all of the accounts in one go. Not terribly useful for “real world” use … but useful for testing (and probably something I’ll end up using again)

$OUpath = ‘ou=Mail Aliases,dc=example,dc=com’
$strNewPassword = “What3v3rYu0W@nt1tT0B3”

Get-ADUser -Filter * -SearchBase $OUpath | Set-ADAccountPassword -Reset -NewPassword (ConvertTo-SecureString -AsPlainText $strNewPassword -Force)

Beany Soup

Ingredients:

  • Onion, diced
  • Garlic, minced
  • 1 tsp butter or olive oil
  • Ham bone or bones from smoked pork shoulder (not completely clean)
  • Dried bean assortment: pinto, red kidney, white kidney (cannellini), pink beans, great northern, baby lima, huge lima, black beans, green split peas, black-eye peas, yellow split peas, chickpeas, red lentils, green lentils
  • Smoked pork

Method:

In a pressure cooker, saute onions and garlic for a few minutes in butter or olive oil.

Remove from heat. Add about a pound of the bean mixture to a pressure cooker, add the bones (if using ham bone, don’t add salt; if using pork bones, add salt), then fill the pot with water to slightly under halfway. Pressure cook on high for about 35 minutes. Allow to naturally depressurize.

Liquid should be thickened from the beans cooking and flavored from the bones. Remove the bones and add more salt as needed.

Add smoked pork, and stir to combine. Allow to simmer until pork is heated.

Notes: We keep containers of various dried beans and peas. They’re really cheap, keep practically forever (especially since we got the vacuum sealer attachment that seals up Ball jars!), and cook fairly quickly in the pressure cooker. For this dried bean mixture, I just grabbed about half a cup of all of the larger beans and a quarter cup of the smaller split peas and lentils. In total, it’s about a pound of dried beans.

For Anya — Bill of Rights QuickRef

Since Anya is working on memorizing the Bill of Rights, I wanted a really quick list for her to review:

  1. Religion, speech, press, assembly, and petition government for redress
  2. Keep and bear arms
  3. No quartering soldiers
  4. Freedom from unreasonable search and seizure (secure in person, house, papers)
  5. Right to due process, freedom from self incrimination, no double jeopardy
  6. Right to speedy trial, public trial, jury of peers
  7. Right to trial by jury in civil cases
  8. Freedom from excessive bail, cruel and unusual punishment
  9. Other rights reserved for people
  10. Other rights reserved to states