Changing the commit author

So, you made some commits and then realise you used the wrong author and email address. No problem, use the following command to update them all and then you can push with consistent happiness.

This assumes you are doing this in PowerShell, if in bash you may need to escape the quotes differently.

The GIT commit id is the one before the commits with the wrong author. For the Author use the format name <>


git rebase --onto 6b4b751 --exec "git commit --amend --author='Fred Smith <>'" 6b4b751

Getting a PI to update when on a network

Now we have a RV I wanted the pi to copy media files over when it is on the network. I have a share for our DVR where the media files are placed (HD Homerun + Emby) and wanted to copy certain TV shows over automatically when the RV is home and I put it on the network.

Now I can go down the BASH scripting route but I do not know that space very well. However I do know the PowerShell space well so installing it made sense. Following the instructions Installing PowerShell on Linux I made a cheat sheet so it is faster if I have to rebuild t a later time.

# Prerequisites

# Update package lists
sudo apt-get update

# Install libunwind8 and libssl1.0
# Regex is used to ensure that we do not install libssl1.0-dev, as it is a variant that is not required
sudo apt-get install '^libssl1.0.[0-9]$' libunwind8 -y

# Download and extract PowerShell

# Grab the latest tar.gz

# Make folder to put powershell
mkdir ~/powershell

# Unpack the tar.gz file
tar -xvf ./powershell-7.0.3-linux-arm32.tar.gz -C ~/powershell

# Start PowerShell

# Check version

# Start PowerShell from bash with sudo to create a symbolic link
sudo ~/powershell/pwsh -c New-Item -ItemType SymbolicLink -Path "/usr/bin/pwsh" -Target "$PSHOME/pwsh" -Force

# Exit

# Test link

# Check version

Now we have PowerShell installed we can get to the script, this will be run every hour via cron. You may have to update some of the paths. It assume that the remote server is mounted under /mnt/tv and the local drive is under /mnt/videos/tv. You will also have to update the IP address of the server that has the DVR files, replace with your server IP.

For this to work make a file called test.txt in the remote mount share so the script can validate access. Then in the root folders you want to copy put a empty file called .rcopy. In the tv share I have a folder for every show and then folder under it for each season where the DRV has recorded. Emby has automation to make this so it is tidy and I can delete a season simply when I have watched it.

I use cron to schedule this to run once a hour, if the PI can see my home server then it will start the copy if not it will just skip the copy and exit. If the copy takes more than a hour having two instances running could be problematic so I drop a file int he pi profile directory. If it is there the process exits, if not it proceeds. Also handy to disable the copy process if you want to run manually without having to edit cron.

$serverIp = ""
$remoteMount = "/mnt/tv"
$localMount = "/mnt/videos/tv"

Write-Host "Starting Test..."
if(Test-Path /home/pi/.mediacopyrunning) {return}
if ((Test-Connection -TargetName $serverIp -IPv4 -TimeoutSeconds 5).Status[0] -eq 'Success') {
"" | Set-Content /home/pi/.mediacopyrunning
Write-Host "Connected to network, checking share..."
umount $remoteMount
mount $remoteMount

if (Test-Path $remoteMount/test.txt) {
$tvFolders = (Get-ChildItem -Path $remoteMount -Recurse -Depth 1 -File -Force -Filter .rvcopy | ForEach-Object { Split-Path (Split-Path $_.FullName) -Leaf })
Remove-Item $remoteMount/rsynctv.log -Force
foreach ($folder in $tvFolders) {
Write-Host "Copying $folder"
rsync -rDvz --log-file=$remoteMount/rsynctv.log --partial --inplace --progress --no-perms --omit-dir-times --size-only "$remoteMount/$folder/" "$localMount/$folder"
Remove-Item /home/pi/.mediacopyrunning -Force

Make the Calendar in Microsoft Teams use the same keyboard shortcut as Outlook

I use keyboard shortcuts a lot and in outlook I am used to the Ctrl+1/2/3/4 to go between mail, calendar, contacts, etc. In teams I found myself using Ctrl + 2 to go to the calendar which actually brings you to the Chat tab. I know I could use Ctrl + 4 but you know muscle memory…

Then I found out you can reorder all the tabs on the left, so not I have Chat at the top just like my mail Ctrl + 1 followed by Calendar which means it is Ctrl + 2 which is now very similar to Outlook!

This may or may not help someone but I found it handy.

Getting Night Light to work with a docking station in Windows 10

This comes from How to enable Night Light feature on DisplayLink devices in Windows 10.

I have a Targus docking station and luckily it used DisplayLink, the key does not exist with the Targus drivers installed so…

  1. Go to and download the DisplayLink drivers.
  2. Install them.
  3. Start RegEdit
  4. Navigate to HKEY_LOCAL_MACHINE\SOFTWARE\DisplayLink\Core
  5. Create new String value with name EnableGammaRamp and set the data to be: true
  6. Unplug and plug your DisplayLink device
  7. Enable Night light in Windows

All your monitors should now be at the same gamma settings.

Work at home and being a team

Now that we are dealing with COVID-19, a lot of companies are getting their employees to work remotely. For some this will be great and for other who crave social interaction not so great. For me the key thing is making sure that my team feels like a team still.

Keeping the routine going is pretty important. For yourself and your team. There are lots of great posts about this so I will just list the key points.

  • Get up and get ready for work. Do not sit around in your pajamas.
  • Have a work space separate to your daily living. If you have a spare bedroom put a table in there. I even heard of a person using a large walk in closet as a impromptu office.
  • Eat well. If you have lots of snack foods in the kitchen it is easy to graze all day. If it is Girl Scout cookie season lock then somewhere and throw the key away.
  • Stop working at lunch and walk or sit with the family to eat. If there is no one in the house get out for some fresh air or watch a short show or video. Like the list of Ted talks you have been putting off watching for a year because you do not have time.
  • Set working hours and stop for the day. Walking out of your temporary office and close the door or put the laptop away or put a sheet over your monitors.

When it comes to your team there are a few things you can do.

Firstly make sure you keep the same rhythm where possible, if you have a normal morning meeting make it a online meeting. I use Microsoft teams and it is great as it integrates well with the rest of office and makes meeting management and scheduling easy. Microsoft has made teams free during the outbreak to help businesses and educational institutions. Even individuals can get it if they want.

State working hours for the team, if people have to work from home and schools are closed they may have to deal with child care or taking children to different locations during the day. I usually start with core hours of 10am until 4pm, during this time the team should be availble to talk, take a cll or be able to make a meeting. No meetings should be scheduled outside of this window.

If you need to talk about a topic do not book a meeting! Make a chat in teams with the right people and renamed the chat to be the subject of the dicussion. This allows:

  • Ability to add people later with them being able to see the full chat history if needed.
  • People to respond when they are at their computer so they can fit the work around the day.
  • Ability to use a shared whiteboard.

Get them to put a meeting in the calendar for lunch so they have a dedicated block to step away from the computer.

Set up a weekly or even better daily 15-30 minute meeting with a teams channel for social interaction. You can even theme it so one day can be what is the best meme, another is photos of their working environment. On Fridays it can be cocktails hour and make the event at the end of the day.

Any other suggestions if you are managing a team remotely?

Auto Update Git Aliases

Because I am lazy I wrote a script so I can update all my machines from the one location which is the gist below. This works in powershell core. Again this is mostly for me but feel free to use as needed.

Update your $profile to have th following environment variable set. This will allows the wid and pid aliases to work correctly.

$env:GIT_WORK_EMAIL = ""
$env:GIT_WORK_USERNAME = "myworknameoralias"

Script to update aliases. Add to your profile or a function in your profile that you can call when you want.

$gitConfig = Get-Content $env:userprofile\.gitconfig
$hasAliasInclude = $false
$aliasIncFile = "$env:userprofile\"

# Update inc. 
if((Test-Path $aliasIncFile)) {
    Remove-Item -Path $aliasIncFile -Force | Out-Null
Write-Host "Updating the Alias Include"
Invoke-WebRequest -UseBasicParsing -Uri "" -OutFile $aliasIncFile
(Get-Content $aliasIncFile) | Foreach-Object { $_ -replace "ENTERPERSONALEMAILADDRESS", $env:GIT_PERSONAL_EMAIL } | Set-Content $aliasIncFile
(Get-Content $aliasIncFile) | Foreach-Object { $_ -replace "ENTERPERSONALUSERNAME", $env:GIT_PERSONAL_USERNAME } | Set-Content $aliasIncFile
(Get-Content $aliasIncFile) | Foreach-Object { $_ -replace "ENTERWORKEMAILADDRESS", $env:GIT_WORK_EMAIL } | Set-Content $aliasIncFile
(Get-Content $aliasIncFile) | Foreach-Object { $_ -replace "ENTERWORKUSERNAME", $env:GIT_WORK_USERNAME } | Set-Content $aliasIncFile

for ($i = 0; $i -lt $gitConfig.Count; $i++) {
    if ($gitConfig[$i].Contains("[include]") -and $gitConfig[$i+1].Contains("path =")) {
        Write-Host "Found include, skipping add."
        $hasAliasInclude = $true

if (!$hasAliasInclude) {
    Write-Host "Missing include, adding."
    $includeStatement = @"
`tpath =
    $includeStatement | Add-Content $env:userprofile\.gitconfig

Using PowerShell core in Visual Studio Code on windows

This is more for me than anyone else. If you want to move to PowerShell core in Visual Studio Code then do the following.

  1. Press CTRL + , to open settings.

  2. Enter Shell: Windows in the search box.

  3. Scroll down to Terminal > Integrated > Shell: Windows

  4. Click on ‘Edit in settings.json’ and add the following.

    “”: “C:/Users/${env:USERNAME}/scoop/apps/pwsh/current/pwsh.exe”,
    “”: “C:/Users/${env:USERNAME}/scoop/apps/pwsh/current/pwsh.exe”,

Now when the terminal is opened it will be using PowerShell Core. As I use Scoop to install items on my computers the path above reflects that, if you have powershell elsewhere then use that path.

To install the PowerShell Core / 6 got to

Using git aliases

I work with git for home and work project, I recently found you can use alias across all platforms due to the way it runs on windows. So all these aliases will work happily on git for windows and hopefully will make you work day more streamlined.

Some are from sites I have found and other I have created myself.

To access the global git configuration run the following command and then add this to the bottom if you do not have a alias section already. This command will use your default editor.

git config --global -e

These are all the aliases, just cut and paste into the configuration.

  co = checkout
  ec = config --global -e
  ecl = config -e
  up = !git pull --rebase --prune $@ && git submodule update --init --recursive
  cob = checkout -b

  # Create a new branch with static naming and switch to it.
  cobm = "!f() { git checkout -b users/$USERNAME/$1; git push --set-upstream origin users/$USERNAME/$1; }; f"

  cm = !git add -A && git commit -m
  cmp = "!f() { msg=${1-Lazy commit and push}; echo \"Commiting with message: $msg\"; git add -A; git commit -m \"$msg\"; git push; }; f"
  save = !git add -A && git commit -m 'SAVEPOINT'
  wip = commit -am "WIP"
  undo = reset HEAD~1 --mixed
  amend = commit -a --amend

  # Want to start again, this will add you current changes and then reset the HEAD. You can always get back the files you abandoned.
  wipe = !git add -A && git commit -qm 'WIPE SAVEPOINT' && git reset HEAD~1 --hard

  # To get the WIPE changes back again.
  unwipe = "f() { SavePoint=$(git reflog --pretty=format:'%h|%s' | grep 'WIPE SAVEPOINT'); IFS='|'; read -ra HASHES <<< $SavePoint; git checkout $HASHES; }; f"

  # This will delete any branches already merged to master to keep you local repo clean.
  bclean = "!f() { git checkout ${1-master} && git branch --merged ${1-master} | grep -v " ${1-master}$" | xargs git branch -d; }; f"

  # Run this after your PR is in to switch back to master and cleanup branches.
  bdone = "!f() { git checkout ${1-master} && git up && git bclean ${1-master}; }; f"

  logg = log --oneline --graph --color --decorate
  pid = !git config 'ENTERPERSONALEMAILADDRESS' && git config 'ENTERPERSONALUSERNAME' && git config && git config
  wid = !git config 'ENTERWORKEMAILADDRESS' && git config 'ENTERWORKUSERNAME' && git config && git config
  whois = "!sh -c 'git log -i -1 --pretty=\"format:%an <%ae>\n\" --author=\"$1\"' -"
  whatis = show -s --pretty='tformat:%h (%s, %ad)' --date=short
  graphviz = "!f() { echo 'digraph git {' ; git log --pretty='format:  %h -> { %p }' \"$@\" | sed 's/[0-9a-f][0-9a-f]*/\"&\"/g' ; echo '}'; }; f"
  aliases = !git config --get-regexp 'alias.*' | cut -c 7- | sed 's/[ ]/ = /'
  lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative    
  open = "!f() { REPO_URL=$(git config remote.origin.url); explorer ${REPO_URL%%.git}; }; f"
  browse = !git open
  churn = !git log --all --find-copies --find-renames --name-only --format='format:' "$@" | sort | grep -v '^$' | uniq -c | sort | awk 'BEGIN { print \"count\tfile\" } {print $1 \"\t\" $2}' | sort -g
  remote-merged = "!f() { for branch in $(git branch -r --merged | grep -v HEAD);    do echo -e $(git show --format=\"%ci %cr %an\" $branch | head -n 1) \\t$branch; done }; f | sort -r"
  remote-merged-me = "!f() { for branch in $(git branch -r --merged | grep -v HEAD); do echo -e $(git show --format=\"%ci %cr %an\" $branch | head -n 1) \\t$branch; done }; f | grep $USERNAME | sort -r"
  remote-merged-query = "!f() { for branch in $(git branch -r --merged | grep -v HEAD | grep -i \"$1\"); do echo -e $(git show --format=\"%ci %cr %an\" $branch | head -n 1) \\t$branch; done }; f"
  remote-age = "!f() { for ref in $(git for-each-ref --sort=-committerdate --format=\"%(refname:short)\" refs/remotes); do git log -n1 $ref --pretty=format:'%Cgreen%cr%Creset | %C(yellow)%d%Creset% | %C(bold cyan)%an%Creset%n'; done }; f"

Filling your calendar for the week, increase productivity! Mileage may vary

I like to ensure my calendar gets filled for the next week, this way I know what is happening and it is hard to book a last minute meeting to surprise me. I guess this is a productivity hack. If you book more than a week out then you can take whatever time you want that is open.

Ideally no one books last minute but they do and it is really annoying to deal with. Just call me!!

Anyway here is a PowerShell script to block out your calendar for the next week using the Outlook COM API locally. I’m sure I can do the same with rest but I am not up for doing OAuth in PowerShell today. The code is not clean and tidy and has issues which I could fix if I could be bothered but it meets MVP. Feel free to suggest updates.

Loading message from the API: ...