Writing about learning Python and the odd bit of Linux related stuff I come across and find helpful. A bit about cycling. Long distance audax. The odd comment on unrelated ideas that I feel benefit from thinking about, writing down and sharing. That kind of thing. Enough is plenty. Good enough will do.
5449 words

Wednesday 20th January 2021

Read the manual. Learning how to code command line interfaces. Discovered Typer. If I'd read the manual it would not have taken so long to figure out how to have a function invoked without entering a command and also not executing the callback if there's another command specifed. The code below included with a bunch of @app.command()'s did it...

def main(ctx: typer.Context):
    functon is invoked if no command entered.
    if ctx.invoked_subcommand is None:
        typer.echo(os.system('ls -p | grep -v /'))

Good Mood Foods to Add to Your Menu

Probiotics and Prebiotics

To reset your gut microbiome, increase the probiotics and prebiotics you eat. Probiotic-rich foods contain bacteria that help your body and brain. An animal study in 2017 from the University of Virginia School of Medicine indicated that Lactobacillus can reverse depression in rats. Similar findings have been established in humans.

Prebiotics are essentially food for probiotics. Probiotics break down prebiotics to form short-chain fatty acids that help reduce gut inflammation, block the growth of cancerous cells, and help the growth of healthy cells.

Certain species of gut bacteria have the ability to boost levels of brain chemicals such as gamma-aminobutyric acid (GABA), which may speed relief from depression and other mental health conditions.
Eat this:

Probiotics. Yogurt with active cultures (avoid yogurts high in added sugars), tempeh, miso, and natto (fermented soybean products), sauerkraut, kefir, kimchi, kombucha, buttermilk, and some cheeses such as cheddar, mozzarella, and Gouda.

Prebiotics. Beans and other legumes, oats, bananas, berries, garlic, onions, dandelion greens, asparagus, and leeks.

Foods Rich in Good Mood Vitamins

Many vitamins play key roles in preventing and easing depression. A deficiency in vitamin B12 and folate (B9) can contribute to a loss of brain cells which is associated with depression.

Vitamins B1 (thiamine) and B6 (pyridoxine), vitamin A, and vitamin C all play crucial roles in brain function and mood regulation.
Eat this:

Find B12 and folate in legumes, citrus fruits, bananas, avocados, leafy greens and crucifers, asparagus, beets, nuts, seeds, fish and shellfish.

Vitamins B1 and B6 in the foods in the B12 and folate section, as well as in soybeans and whole grains.

Vitamin A in sweet potatoes, carrots, spinach, and black-eyed peas.

Vitamin C in citrus, cantaloupe, strawberries, broccoli, cauliflower, Brussels sprouts.

Foods Rich in Iron and Good Mood Minerals

Iron, magnesium, and zinc all play vital roles in proper brain function, and deficiencies
in these minerals has been linked to depression in clinical studies. Several case studies in which patients were treated with 125-300mg of magnesium have demonstrated rapid recovery from major depression, often in less than a week.
Eat this:

Iron-rich foods. Shellfish, lean red meats and organ meats (in moderation), eggs, legumes, pumpkin seeds, broccoli, spinach, and dark chocolate (also in moderation).

Magnesium-rich foods. Avocados, bananas, dried apricots, nuts and seeds, legumes, whole grains, and some omega- 3-rich fish (such as salmon and mackerel).

Zinc-rich foods. Seafood (especially cooked oysters), lean beef, and poultry, with lower amounts found in beans (chickpeas and lentils), nuts, and whole grains.

Foods Rich in Omega-3 Fatty Acids

Omega-3s are crucial to mental health. But since we cannot produce them on our own, we must get our omega-3s from our diet. The three main omega-3 fatty acids are alphalinolenic acid (ALA), eicosapentaenoic acid (EPA), and docosahexaenoic acid (DHA). EPA and DHA are the omega-3s most critical in mood disorders, so it’s particularly important to ensure that you get enough of them. Omega-3s lower inflammatory markers and protect neurons from excessive inflammation.
Eat this:

Cold-water fatty fish such as salmon, mackerel, tuna, herring, and sardines, contain high amounts of omega-3s. Trimmer fish like bass and trout are good sources, too.

Grass-fed beef contains more omega-3s than conventional beef.

ALA sources include edamame, walnuts, and chia seeds.

Omega-3- fortified foods on the market, especially eggs, milk, and yogurt.

Herbs and Spices

Many seasonings help the brain fight off free radicals and prevent oxidative stress, which can damage tissues. Pair them with the antidepressant foods to double their mood-boosting effects.
Eat this:

Saffron. A 2017 study revealed that 15 mg of saffron is as effective as 20 mg of Prozac in decreasing depressive symptoms. In animals, saffron increases levels of the good mood neurotransmitters glutamate and dopamine.

Oregano. Researchers have connected carvacrol, an active ingredient in oregano, with neuroprotective and antidepressant effects in animal studies, although to date, there are no such studies in humans.

Turmeric. A meta-analysis in 2017 found that curcumin, an active ingredient in turmeric, reduces depressive symptoms by adjusting brain chemistry and protecting brain cells against toxic damage that leads to depression.

Other mood-boosting herbs. Lavender, passionflower, and chamomile are all herbs that can be helpful for depression too. They’re easiest enjoyed as teas.


Saturday 16th January 2021

It's 1451 hrs. On my break at work. Feeling good. Helps to have enough sleep.

Work is enjoyable. Helping people feel better in themselves. Enhancing their experience of the day to day during their admission to hospital. That's what I do in a nutshell.

Sounds easy? Knowing the person. Tuning to the emotional content of peoples' speech and behaviour helps. Figuring out what matters, what's important to that person. Acting on that insight.

I can and want to do this for most people I get involved with. Most people. There are those who seem unreachable. Every effort to connect is either ignored or rebuffed.

This used to leave me feeling a bit useless, inadeqaute and resentful. Been a while now though.

All it took was to process rejection with an acceptance of us all being flawed in some ways; of a back story not shared. Rejection may often reveal more about the person rejecting than it does about what's being rejected.

That's what comes to mind for now. It's 1518hrs. Time to go back to work.

Friday 15th January 2021

A command line program is built on commands and is run from the terminal. The Command Line Interface (CLI) of the program facilitates access to it's functionality by typing commands at the terminals.

Today I have been mostly getting to grips with coding a command line interface(CLI).

It's taken me down a few rabbit holes...

  1. argparse - Parser for command-line options, arguments and sub-commands
  2. Click - a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary.
  3. column command in Linux
  4. The os module.
  5. Formatted text in Linux Terminal using Python.
  6. Python file handling

Puzzling out how to make the output of the program print in a multi-column format similar to the output of the ‘ls’ command on Linux based systems. Still scratchin' my head...

Wednesday 13th January 2021

Cycling: Grim weather. Foggy. Drizzle. Dark. Muddy. 40km out in it on the bike. LEJOG was cancelled in 2021. Scheduled in for this July. Fingers crossed C19 will not put a stop to it this year. Putting in regular miles to build up to the event.

116-hours & 40-minutes to complete the 1402 km route. 289km a day for a bit under five days. Helps to have a big ride planned. Have to be a good way to match fitnes to complete the ride without harsh sufferation.

A driving force to get out the door. Just plodding out 40 - 50 km on days off along with a 30km commute and a couple of longer rides each month will get me there.

Push ups: Since late October press ups have been a thing in our house. The 100 push up training programme. It's caught the boys interest. One of them and I completed the program before Christmas though were still 50 short of doing 100 in one go. Him and two of his brothers have taken it up again now, working through the sets from week three. The oldest is joining in via video call from his place at university. It's good fun to be doing this with them all.

Markdown: To hyperlink an image...

[![Alt text](Web link or path)](web link to website)




and without the hyperlink...



Tuesday 12th January 2021

A meta introspective is the only thing that comes to mind. It's 22:49. Busy at work all day. Got things done and kept a handle on the shift. Enjoyed spending time with a new student. Have not got any coding done. Still an hour left to get some in. Writing this to maintain the streak more than anything else. Not a lot of effort or interest. Like white sliced bread. A filler.

Monday 11th January 2021

It's 1527hrs. Due back on the ward at 1550hrs. Having my break.

A patient died with C19 over the weekend. They were under 40. A member of staff also died over the weekend. Collapsed in reception when coming on shift. Died later in hospital. A brain anurism.

No doubt there are family and friends who will be feeling it this week. Dark days. Dark times.

Remember to look after yourself. Exercise. Cut down on consumption. Don't work overtime. Spend time with people you care about and enjoy being with.

Sunday 10th January 2021: Python Weekly Challenge

Today I came across Weekly Python ...

Python programming projects sent weekly to help you practice and perfect your programming skills while building your project portfolio.

There's a ton of such like out there and all vying for our attention. I like the understated and minimal style of this one. The first challenge was set just a week ago on. Listing all files in a directory.

Happy to have completed the beginner project. Went on and practised more by completing the beginner stretched goal. So far I have learned about using Pythons inbuilt os and argparse modules.

There's more to be rinsed from the challenge with the inclusion of intermediate and advanced projects and stretched goals.

For now though...

import argparse
import os

Beginner project: Create a python script that will print the names of every file in the directory you run it from in alphabetical 
order. Only print the names of files and not include folders in the returned list. Make sure the list is printed with 
one file per line of output. 

Beginner stretch Goal: Add a command-line argument to also include the names of every folder in the current working 

path = os.getcwd()
file_list = []

# block executed if no command line argument entered. Just files from the CWD are sent to Stdout.
for files in os.listdir(path):
    if os.path.isfile(os.path.join(path, files)):
for file in file_list:
    # to exclude hidden files
    if file[0] == '.':

# block executed if command line argument entered. Files and directories from the CWD are sent to Stdout.
parser = argparse.ArgumentParser()
parser.add_argument("--dir", help="Include the names of every directory in the current working directory.")
args = parser.parse_args()

if args.dir:
    dl = os.listdir(os.getcwd())
    for i in dl:
        # to exclude hidden files
        if i[0] == '.':

Saturday 9th January 2021

Wife got sent home from work on Tuesday having had a close contact with a manager who tested positive for C19. Told to arrange testing and isolate pending the result.

This meant the rest of the family also had to isolate until the result arrived. Not a big deal but something to be done.

I was rostered to be at work on Wednesday, Thursday and Friday night. Phoned in and was correctly advised to stay at home until wife's result was recieved. This is not to discount the box of the Lateral Flow Test Kits (LFTK) given to me by work to self test.

Following the 'rules' meant staying off work to wait for my wife's PCR results rather than using a LFTK to self test. Says something about the governments investment and confidence in them.

The PCR test kit arrived for my wife on Wednesday. Result received on Friday night at around 8.30 pm. Negative. Hurray! No suprise though. We have all been symptom free and feeling fine. Back to work on Monday.

Friday 8th January 2021

Just noticed a habitual response.

I was getting stuck with a coding problem. I was not applying much method to my attempts at solving the problem. Relying on what I already know (limited) or worse still what I think I know (fuzzy). Hit and hope. Cyclical failed attempts. Allowing my failure to get the final solution to overshadow progress I was making towards it. I don't like the feeling and thoughts that come with being stuck.

I apply a workaround. I look for a distraction. To avoid feeling and thinking like this. Not a solution or means to find a solution but a distraction. Writing. Eating and drinking. Exercise. Housework. Company. Those are just the good ones.

I get no further with solving the problem. I am wilfully distracted and not making progress. It does not feel great.

Substitute coding problem with some other challenge. Given lack of progress over time and and the same behaviour follows. Find a distraction to avoid the feeling of being stuck, procrastinate and eventually avoid. Conciously the work; subconciously the feelings that come with being stuck. Feeling inadequate. Not good enough.

The risk now is to give up. Perhaps rationlise why it made sense to give up (lost interest, bored, something else came along...) to feel a better about doing so. Self belief and efficacy erodes.

A different response to getting stuck then. Notice what's being tried. Notice what's working and what's not. Break the process down into steps. Take some notes. Improve debugging skills. That might help. Revisit the key topics involved. Stick with it. Pomorodo time and keep coming back. It can help to chunk up focus time and breaks.

If though still choosing to be distracted then at least notice that and from time to time choose one that will do no harm and perhaps even some good! Like journaling perhaps?

Thursday 7th January 2021

Letting go. The benefit being freedom to act without undue reference to what's already been, what we already know. A future of possibility and freshness opening up before us.

Helps to have an awareness of what we are holding onto. It can be tricky. Some things might help...

  1. Noticing habits. Behavioural and thinking.
  2. Noticing relationship patterns.
  3. Noticing distractons.
  4. Honesty about and ownership of the past.
  5. Learning about attachment theory.
  6. Meditation.
  7. Having courage to be vulnerable.
  8. Curiosity in the process.

Wednesday 6th January 2021

Defining and solving problems is something I could do better with. Adapting to circumstance is the default. Dealing with a problem or making something work despite the problem. A workaround.

I have been learning to code without using code to do anything useful. It's been interesting but...

Coding contrived apps and completing code challenges / exercises to learn the lexis, semantics and syntax of Python is losing it's appeal. Cloning apps and such like does not inspire. Whilst there may be nothing new under the sun and greatness may come from iteration, novelty attracts me.

It's important to let go of any notion that a problem is a deficit and something to ignore or tolerate. It helps to have that out the way so we can move onto...

step 1: Problem identification
Identify and define what the problem is. Thinking of problems in terms of goals and barriers may help. There may be more than one of each. The process may reveal the goal is simply a stepping stone. Defining the problem will help understand and make it easier to describe to others.

step 2: Structuring the problem
Developing a fuller picture of the goal(s) and the barrier(s) involved. This might not be necessary for simple problems.

Before step 3 (exploring solutions) a bit of time with the first two would be in order. Seems like the next post is beginning to take shape.

Tuesday 5th January 2021

I have been given a box of SARS-CoV-2 Antigen Rapid Qualitative Test Kits manufactured by Innova. The plan is to self test twice a week (only if asymptomatic) before going into work. The idea is that this will help reduce the spread of C19 among the staff and patient group. Sound good?

498,000 residents in the City of Liverpool were offered testing using the Innova Lateral Flow Device. 25 % of them underwent a Lateral Flow Test from 6 November and up to 9 December. A sample of around 6,000 users received a pair of Lateral Flow and Polymerase Chain Reaction (LFT and PCR) tests. PCR testing is considered the gold standard in testing for the SARS-CoV-2 virus

The Liverpool COVID-19 Community Testing Pilot Evaluation Interim evaluation report is available to download here.

The researchers found that the Innova LFT device identified two fifths of the PCR positive cases and potentially two thirds of people with higher viral loads (asymptomatic?), who are more likely to be infectious. This reveals that statements by DHSC that the Innova Lateral Flow test achieves ‘high accuracy’ and ‘78% sensitivity’ are not valid.

Fit for purpose? The UK Government has paid £496 million for these test kits. A sunk investment and potential undeclared conflicts of interest. The pantomine must go on.

Having been given the box there is the expecation that I comply with request to test. It is not 'mandatory' though I suspect nonconformity will be frowned on.

Monday January 4th 2021

Yeah. So it's now 1.22 am. On a break. Working nights. I work in a mental health hospital. I am a mental health nurse. I have been since 1989.

Not so many people back then had the earnest interest and recognition of mental health issues that is currently fashionable in England to proclaim. It's not unusual for some 'celebrity' to grab a bit of publicity talking about recovering from some mental health issue they have labelled themselves with.

Mental health can now to be anything from feeling a bit miserable to headline grabbing tragedies involving someone known to mental health services. Much of what gets labelled nowadays as mental (ill)health is a normal reaction to life. It's what happens. It's part of being a human. We mostly move on and get over it. Like a cold.

The benefit of pathologising human experience often gets no further than drug companies, private therapists, to the self help / mindfulness app makers and how to be happy book sellers. It lets governments off the hook for failing to build nations that put welfare and people before business interests and profit.

Mental health issues talked about by 'celebrities' seem to be mostly a product of lifestyle choices. It's an odd mix of poor me / look at me and you could have it to. I bet there are those that have given likes / thumbs up / kudos to others talking about some mental health issue on social media. Kind of missing the point but hey ho.

Sunday January 3rd 2020

It is 3.34 am. Night shift. On my break till 4.30 am. Not feeling it. Still need to get on and do stuff. Not motivated or inspired to do anything much at all. Where did this need to be doing stuff all the time come from?

Be the best version of yourself. As if there are different versions we can put on and take off at will. What about those who do not aspire or have ambition? The satisficers who are happy to make do. Those who feel content?

It's now 1.17 am on Monday. Still working nights. I slept during day between 10 am and 4 pm. It is a challenge to maintain routines and good habits switching between days and nights.

Saturday 2nd January 2021

Well here goes. Still find it 'fun' to start new habits at this time of year. See how long I keep up intentions and interests. Coding and cycling are two. Press ups. 50 done this morning. Prepare my own food more. There is the garden and house to attend to as ever. Relationships with family, friends, colleagues, patients and so on. Be someone other people like to be around. Meditation. Got in 30 minutes this morning. The list goes on.

To do as is typical or do something different this time round.

Instead of or as well as looking back on what has been in 2020 perhaps imagine what I would like that to include at the end of 2021. A reflection and projection.

I am writing this note using a Standard Notes extension Theo Chu wrote and put out to the world for free. It's excellent. Theo had not coded much before building this extension. It took him 300 hours. That's 21.5 full days or 37 eight hour days or to stretch it out to something like real life 60 five days without a day off. The documentation is very well done. Detail and presentation. Goes along with his role at Standard Notes; maintain technical documentation; research and learn concepts in privacy, security, and technology and explain them in simple, digestible articles.

The functionality of the extension is fairly intuiative. I am enjoying using it. Theo writes about the devlopment of the extension at 300 Hours of code: Building projects that solve problems.

I have over the last year been learning to code without much if any focus on solving problems. It's been fun. I have learned a lot and benefited from doing so. This year would be good to do something tangible with code. Being adaptable is problem solving. Perhaps problems to build solutions for might become more apparent by thinking about how I and/or others adapt our behaviour to make things work.

Signed up to a couple of online courses. Started NDG Linux Unhatched today. Working through the topics and finding I am familiar with most of tthem so faar. I shall be starting PCAP: Programming Essentials In Python English 1220b just as soon as a glitch with the website is sorted out.

It's 1742hrs. Working tonight. Time to get ready and go...