Shell Script: Path To Script

We occasionally have to re-home our shell scripts, which means updating any static path values used within scripts. It’s quick enough to build a sed script to convert /old/server/path to /new/server/path, but it’s still extra work.

The dirname command works to provide a dynamic path value, provided you use the fully qualified path to run the script … but it fails spectacularly whens someone runs ./scriptFile.sh and you’re trying to use that path in, say, EXTRA_JAVA_OPTS. The “path” is just . — and Java doesn’t have any idea what to do with “-Xbootclasspath/a:./more/path/goes/here.jar”

Voila, realpath gives you the fully qualified file path for /new/server/path/scriptFile.sh, ./scriptFile.sh, or even bash scriptFile.sh … and the dirname of a realpath is the fully qualified path where scriptFile.sh resides:

#!/bin/bash 
DIRNAME=`dirname $(realpath "$0")`
echo ${DIRNAME}

Hopefully next time we’ve got to re-home our batch jobs, it will be a simple scp & sed the old crontab content to use the new paths.

Oat Nut Bread

Oat Nut Bread

Recipe by LisaCourse: BreadCuisine: BreadDifficulty: Easy
Prep time

6

hours 
Cooking time

35

minutes

Ingredients

  • 2 1/2 tsp active dry yeast

  • 1 1/4 c warm water

  • 2 c all-purpose flour

  • 2 c white whole wheat flour

  • 1/2 c rolled oats, chopped

  • 2 T honey

  • 1 t salt

  • 1/4 c walnuts, chopped

  • 1/4 c sunflower seeds, chopped

Method

  • In a large bowl, combine the yeast (about 1/4 oz.) and 1/4 cup warm water. Stir and let stand for 5 minutes, until foamy.
  • Stir in remaining water, 1 cup of flour, the oats, and honey. Mix well. Add in salt, nuts, and an additional 1 1/2 – 2 cups flour. Stir, adding remaining flour gradually, until the dough comes together into a ball a begins to pull away from the sides of the bowl (this can also be done in an electric mixer with the dough hook attached).
  • Turn dough out onto a lightly floured board and knead, adding flour a tablespoon at a time as necessary to prevent sticking, until dough is smooth and elastic, about 5-8 minutes.
  • Place dough in a lightly greased bowl, cover with plastic wrap and let rise until doubled in size, about 1 – 1 1/2 hours.
  • Lightly grease a 9×5-inch loaf pan.
  • After dough has risen, turn dough out onto a lightly floured surface again. Gently deflate dough into a rectangular shape. Fold up the two long sides of the rectangle and pinch the seam together. Place seam-side down into prepared loaf pan.
  • Again cover the bread with a piece of plastic wrap and let rise until almost doubled in size, about 45 minutes.
  • While the bread is going through its final rise, preheat oven to 375F.
  • Bake loaf for 35 minutes, until an instant-read thermometer inserted into the bottom reads about 200F.
  • Cool loaf outside of pan on a wire rack completely before slicing.

One-Pot Pasta With Mascarpone

One-Pot Pasta With Mascarpone

Recipe by LisaCourse: DinnerCuisine: ItalianDifficulty: Easy
Servings

4

servings
Prep time

10

minutes
Cooking time

20

minutes

Ingredients

  • 16 oz fusilli

  • 1 T olive oil

  • 1/2 large red onion, chopped

  • 5 cloves garlic, crushed

  • 1 T Italian herb blend

  • 1 T salt

  • 28 oz petit diced tomatoes

  • 5 oz tomato paste

  • 2 T balsamic vinegar

  • 4 c vegetable stock

  • 1 T fresh basil

  • 16 oz fresh spinach

  • 4 T butter

  • 1/4 c mascarpone

Method

  • Heat a large pot, add olive oil, and sauté onions.
  • Add garlic and dried herbs, sauté for a minute.
  • Add tomatoes, tomato paste, salt, balsamic vinegar, and vegetable stock. Bring to a boil.
  • Add fusilli. Reduce heat and simmer for 12 minutes.
  • Add basil, spinach, and butter. Stir to combine.
  • Remove from heat and stir in mascarpone.

Understanding the law

It irks me how many government officials fail to understand the law (or, at least, make statements that are legally absurd). Today, Devin Nunes says he will sue CNN for defamation. Why? Because CNN reported that a lawyer for Lev Parnas said Parnas knows something about some meetings Nunes scheduled with former Ukrainian prosecutors (and Parnas is willing to testify before Congress).

What’s the requirement for a defamation case? (1) False statement and (2) malicious intent. If Nunes said he intended to sue Parnas, that would be reasonable — still have to prove that the statement was false and uttered with malicious intent, but at least Parnas could have made a maliciously false statement. But a defamation suit against CNN would be an assertion that CNN made up a conversation with Parnas’ lawyers and did so maliciously to harm Nunes.

I’m certain Nunes statement was dramatization — and a way to avoid answering when asked if he did have involvement with the whole Ukraine fiasco. But someone who is responsible for writing laws shouldn’t demonstrate such ignorance of those laws.

Memory upgrade on Flex 3 1580

The vendor specs for a Lenovo Flex 3 1580 say it supports up to 8GB of RAM. There are some forum threads that say the D3CN35WW BIOS update supports up to 16GB, but the vendor spec hasn’t been updated so it’s chancy. I finally decided to chance it – I’ve got a few Docker VMs that I use for development, a Citrix published app that I need to access, and I like to have a dozen tabs open in Firefox. All of this means that I regularly run out of memory.

I ordered a 16GB module from Amazon, installed it … and

It works!

 

The Fifth and Executive Privilege

Intellectually, I know that invoking one’s Fifth Amendment right is not an admission of guilt. But, any time I hear someone taking the 5th, my subconscious assumption is either that they’re guilty of whatever is being asked or the answer brings up some other admission of guilt. Because, seriously, why refuse to answer if the content of the answer is exculpatory and doesn’t implicate someone important to me?

In the same way, I intellectually know that my subconscious brain went somewhere not legally valid when Dr. Fiona Hill refused to answer a question citing executive privilege. The line of questioning was basically “you’ve been high up on the Russia desk for some time, so you’ve been on a lot of these phone calls with foreign heads of state”, “yes”, “is the content of this (the declassified 25 July phone call with Zelensky) call unusual”, PRIVILEGE! Which only makes me think that demanding personal favors that run counter to national interest (or having favors that run counter to the national interest demanded of him) isn’t unusual.

November Debate

I like the point about putting more effort into turning the 50% of non-voters into voters … between single-issue voters who will never vote for a Democrat & the 30 or whatever percent that seriously think the Trump presidency is perfect, it’s not like there’s a lot of people to be swayed there. The huge pool of people who don’t vote? Offer free childcare & transportation. Get them engaged with some piece of the platform.

 

“The fragility of his ego stood in the way of national security” … Harris’ assessment of Trump’s interactions with N. Korea is a good quote, and not just about this particular issue.

I want nothing …

So, if I go jack, say, a Lambo … and when the cops show up say I’m heading out to return it … that’s OK?! Because chatting with an Ambassador and telling them he doesn’t want anything from the Ukraine after knowing the whistle-blower complaint is headed to the House isn’t exactly a great defense. Similarly, saying the money got released after the complaint … not exonerating.

Exchange Mail & Calendar In Teams (duct tape approach, not official MS solution)

The Exchange web client renders in the Teams website tab now – Chrome and Chromium-based Edge. I use the nightly build of FireFox and it says ‘Blocked by X-Frame-Options Policy’

This isn’t a way to get new mail notifications in Teams – you’ve got to click over to the tab. But it does let you send a quick message without leaving Teams.

It’s a little inconvenient, though, to have to navigate over to the right channel to find the website tab. You can also create a custom Teams application to access the Exchange website. That’s a little more complicated, but you basically need a manifest.json with static tabs to the inbox and calendar.

Install and open “App Studio” in Teams. Create a new app. Fill in the details — use the generate button to get an app ID. Since you’re not going to publish the app to the Microsoft app store, the info you use isn’t super important … the privacy and terms of use, specifically, aren’t something anyone is going to read.

And

In the “Capabilities” section, add a personal tab

Add a tab for the mailbox:

If you wish, add a tab for the calendar – I prefer the weekly view, but you can replace “week” with “workweek”, “day”, or “month”.

In the “Test and Distribute”, click “Download”.

You’ll get a zip file that you can side-load (i.e. it’s not an app published across the company). In “Apps”, select “Upload a custom app”

Locate the downloaded ZIP file and open it

Verify that your app looks right – the permissions are base permissions for all apps (we didn’t add anything special)

Click “Add” and you’ll be able to select the new app from the ellipses in Teams.

And you’ll have an app that can access your mailbox

Or a week view of your calendar

 

Direct Representation

I always wanted to run for federal office on the platform of direct representation — more a technology than a platform. Develop a system that allows constituents to log in and vote for any legislation — basically like proxy voting for shareholders. I’d deliver summary and full text content of anything in advance of the vote, and I’d cast my vote as dictated by my constituents. And constituents could see the vote totals for each piece of legislation to prove that I am voting based on real input. Obviously, this platform suffers an immense privilege problem — it’s great for a demographic with free time to read through legislation and convenient Internet access. It also suffers a civic disengagement problem — does anyone actually want to read through the text of everything that’s coming up in my committees and to floor votes? It’s quite possible that I’d be voting against the National Law Enforcement Museum Commemorative Coin Act (H.R. 1865) because five people bothered to lodge an opinion … and only to troll the entire idea behind direct representation. And none of that considers the threat of malicious actors.

Once there is a platform available for one legislator, expending it to others in the same chamber is trivial. Adding the other chamber or state legislatures is an undertaking from a content-development standpoint (what *is* on schedule for the Oregon Senate today?), but the underlying development effort is the same. Somewhat like the National Popular Vote compact is an end-run around formalizing the eradication of the Electoral College, this would be an end-run around indirect representation.

But I’ve thought, of late, that starting at the Federal level is misguided — if for no other reason than the incredible amount of money it takes to run a campaign for federal office. But also because getting the six million or so Ohio voters set up for direct representation by their state Senator would be a logistical nightmare. It seems better to begin implementation at the local level — run for school board or a Township Trustee position where you are concerned about a few thousand voters. Use local offices as small proof-of-concept experiments. Maybe it doesn’t work out — maybe no one cares enough to check what’s being discussed and vote for their position. Maybe running and supporting the platform is too expensive or time consuming. Hell, maybe no one is interested enough in direct representation for a direct representation candidate to win in the first place.