How do I use xargs with a function in bash?

Question: How do I use xargs with a function that I’ve defined in bash?

Answer:

The following example uses the export and runs in a new process which is why the export f switch is needed.


doEcho() {
  echo $1
}

export -f doEcho
echo You echo | xargs -d' ' -t -n1 -P2 bash -c 'doEcho "$@"' _

Note: This function works in bash and will not work in zsh.

In Ubuntu how can I use a shell alias that hasn’t taken effect yet

Question: In Ubuntu how can I use a shell alias that hasn’t taken effect yet?

Answer: After creating an alias during a session the alias doesn’t take effect often until you logout and log back in, an action which triggers a reparse of the alias file. You can immediately execute your new alias though with the eval command. Here is a brief example that will create a ‘test’ alias and map it to ‘ls’ to show you the current directory:


alias test=ls;eval test

How do I brew a sweeter beer?

To increase sweetness without nullifying the yeast you will need to add non-fermentable sugars to the wort. To add sweetness and some body in an extract brew, lactose is the usual adjunct: 1/8 to 3/8 pound in a 5 gallon batch. Lactose is non-fermentable and can be used to increase the sweetness either by adding at boil time or at bottling time.

I can barely hear the call on my iPhone, is my speaker broken?

Symptom: You can barely hear the audio when making a phone call but the quality is fine when using the speaker phone.  Turning the volume all the way up has no effect.

Fix: iOS during an update likely enabled the noise cancellation setting.  Although this can be useful, it has a habit of making phone calls very difficult to hear when you use the phone with it up to your ear.  Disabling this setting immediately returns phone call volume back to normal.  This setting is located at:

Settings –> Accessibility Phone > Noise Cancellation

In MRI’s, what does pixel shift mean?

Question: In MRI’s, what does pixel shift mean?

Answer: A pixel shift, or chemical shift is the signal intensity change in magnetic resonance imaging (MRI) that results from the differences in the resonant frequencies of moving protons. By observing differences in resonant frequencies of lipid and water, fatty elements within tissue can be confirmed with dedicated chemical shift MRI pulse sequences. Alternatively, the the shift on images obtained with standard MRI pulse sequences may corroborate the diagnosis of lesions with substantial fatty elements. Chemical shift can aid in the diagnosis of lipid-containing lesions of the brain (teratoma, lipoma, and dermoid) or the body (focal fat within the liver, angiomyolipoma and adrenal adenoma). In addition, chemical shift can be implemented to make visceral margins significantly more distinguised from the surrounding tissue.

How can I create a shortcut to start a command prompt as an administrator?

  • Right click on the desktop or a folder in Explorer and choose “New->Shortcut”
  • Enter “cmd” (without quotes) as the location of the item.
  • Give any name you like
  • Right click on the shortcut icon you created, choose “Properties” and then choose “Advanced”
  • On the “Advanced Properties” dialog choose “Run as Administrator” and then click “OK”
  • Click “OK” again on the properties dialog.

Although this is tagged for Windows 11, it should work for all supported Windows versions.

Why does coffee taste worse if the bag has been left open?

An age old question.  The answer mostly boils down to the molecules responsible for aromas.  A lot of what humans interpret as smell comes from aromas that we smell from the food or drink we’re partaking in (ever noticed how when you have a cold and can’t breath through your nose how food often loses it’s flavor?).

If a bag of coffee is left closed it gives the volatile aromas time to work their way from the interior of the bean outwards (and into the open air of the bag where it’s sealed providing the rush of smell when the bag opens).  To that point, when a whole bean is ground it allows those aromas that were trapped inside the bean out.

Bags that are left open allow these aromas to easily evaporate and over time much of what we interpret as taste will go with it.

Useful tips for patching a bike tire

  • Most patching kits will come with a sandpaper or a file. The purpose of this is to make the texture rough near the puncture (but don’t wear it totally away, this is to create a surface that will grip better).
  • Make sure the solven you apply is over an area larger than your patch.
  • After applying the solven be patient and allow the solven to work. 10 minutes is a good amount of time for this (the solvent melts the surrounding rubber, when done not that the solven should not look wet).
  • When applying the patch to the tire try to not touch the underside making contact to the tire (if you do, don’t panic, but try not to in order to give the patch the best chance to take).
  • Use an object (not your hand) to press down on all sections of the patch to ensure the patch is adhesion is evenly taking place over the entirety of the patch. A paint roller or baking roller is a nice tool for this (although note not to get solvent on a baking roller you intend to use for cooking).
  • When done, inflate the tube to around 5 PSI which will allow you to peel the plastic backing off (again be patient).

It would be wise to let the tire sit for a few hours to ensure it holds air before taking it on any lengthy excursions if you have that opportunity.

How do I clean shoelaces?

The easiest way is to put them in the clothes washer.  To prevent damage to the laces you can put them in a mesh bag which will somewhat protect them from machinery (as you can do with anything including delicate items like children’s stuffed animals).

For disinfecting you can soak them in bleach for 5-10 minutes or vinegar for 60 minutes before washing.  However note, if you choose to soak them in bleach you should wash them seperately from colored items (or include them in your whites cycle in case any of the bleach bleeds onto the other clothing items).