Below you will find pages that utilize the taxonomy term “Technical”
Cascading Updates
Having been a bit lazy in not updating my Hugo version since I started which was recently breaking one of my Github actions, I decided do do that.
This lead to an cascading update cycle.
- Updating Hugo version broke the theme I was using.
- Updating the theme broke the Tweet shortcode, no longer on Twitter so edited those post which referenced my old Twitter account.
- Updating the Hugo version, broke the Github Action which was building and uploaded to S3. This was due to newer versions of Hugo now having an “extended” and “with_deploy” versions.
- Raised a PR against the Github action to update to use the “with_deploy” version.
Still a couple of deprecated warning and fixing background and social icon links to sort out but at least now running against the latest version of Hugo.
Clipboard History
I wrote a simple Python script to monitor the clipboard and write any unique text content out to a YAML file for a history. It might turn into something better eventually.
Update
Updated to use a settings file for file location and size.
#!/usr/bin/env python3
import pyperclip
import time
import yaml
import toml
import os
from yaml.loader import SafeLoader
script_path = os.path.dirname(os.path.abspath(__file__))
settings = toml.load(os.path.join(script_path, "clippy.toml"))
history = settings["history"]
max_size = settings["size"]
cliptext = ""
clip_array = []
with open(history, "r") as f:
clip_array = list(yaml.load_all(f, Loader=SafeLoader))
clip_array = sum(clip_array, [])
while True:
tmptext = pyperclip.paste()
if tmptext != cliptext:
cliptext = tmptext
if cliptext not in clip_array:
clip_array.insert(0,tmptext)
if len(clip_array) > max_size:
clip_array.pop()
with open(history, "w") as f:
f.write(yaml.dump(clip_array))
time.sleep(1)
Script on GitHub https://github.com/alastairhm/automate_python/blob/main/clippy.py
CA Thumbprint from Python
Recently had a need to get the CA Thumbprint from the Root certificate of a domain. This was for creating OIDC provider for an AWS EKS cluster.
This is the solution I came up with.
Puppy linux 9.5
One of my favorite low foot print Linux installs is Puppy Linux been using it on and off for years.
It has saved my bacon on a few times used to boot and restore or save data from a dead OS install.
New version looks good so far.
Processing
Make learning programming fun
It is funny how things come around again, when I started learning to programming back in the 1980s on my 8 bit machines (ZX81, Acorn Electron, BBC Micro) I used to play with graphics a lot. It gave instant feedback and visually showed the results of things like recursion. I had great fun playing with Fractals and other procedural generated images.
Recently I discovered a YouTube channel and programming platform which took me right back to those days.
Which Shell?
I made the switch from Bash shell to the FISH shell a couple of years ago now and never looked back.
Customization and auto-complete features was the killer features for me.
Jump to the 20 minute mark for the shell discussion if you want.
Video Source Destination Linux
Links
Hugo Lbry Shortcode
One thing I like about Hugo is how easy it is to expand its functionality with your own code.
For example was able to create a shortcode to embed Lbry.tv videos into a post in around five minutes.
First I created an empty file layouts/shortcodes/lbry.html
which I pasted the basic embed code take from the share button on one of their videos.
<iframe id="lbry-iframe" width="560" height="315" src="https://lbry.tv/$/embed/this-new-fedora-powered-thinkpad-p53-is/097106eb68aebc90b33d83bb053467af942a8e20" allowfullscreen></iframe>
Then parameterized this so that the src url can be changed.
Markor Android App
Found this useful Android Mark down application.
Markor it has a Hugo template to use for blank documents which is useful.
It’s on FDroid so it’s easy to install o on my kindle as well.
Then use Github website to upload the new file to my Hugo blog repo.
Posting from Android 2
Testing github Web upload.
Update
Edited on mark down app, uploaded again via github web page.
Mgit
Found mGit App which looks like it would do the job of repo management on Android.
First trial not so good.
Wondering if its an issue with having MFA enabled on my Github account, although using my personal access token instead of the password should work I would have thought.
I’ve submitted an issue on their Github page, so wait and see what they say about it.
Posting from Android
Trying to think of a way to be able to post content from my Android devices (phone/ Fire Tablet).
Basically would need just the following;
- Text editor for creating markdown for the post.
- Git to checkout, commit and push updates to GitHub.
My Travis CI pipeline would then handle the publishing.
Finding a text editor app isn’t a problem there are any number of them on both Google Play and Amazon Kindle stores which could be used.
Automation
Automate publishing
To make the publishing of new content easily I am using Travis CI to publish changes.
I did try installing Hugo from source but this took longer and was producing errors so it was easier to download the binary.
Using this as the Travis CI pipline yaml.
Travis CI Pipeline
# Auto deploy repo from Github to Amazon S3 bucket via Travis CI
# * Set env vars for ACCESS_KEY_ID, BUCKET_NAME and SECRET_ACCESS_KEY on Travis
# * Update `bucket.name` in `sync` command
# * Assumes your `publishDir` is the default (`public`) - if not update `sync` command
language: go
before_install:
addons:
apt:
packages:
- libcurl4-openssl-dev # required to avoid SSL errors
install:
- curl -LO https://github.com/gohugoio/hugo/releases/download/v0.74.3/hugo_0.74.3_Linux-64bit.deb
- sudo dpkg -i hugo_0.74.3_Linux-64bit.deb
before_script:
- python --version
- sudo pip install s3cmd
script:
- hugo
after_success:
- s3cmd sync -v --delete-removed --no-preserve --access_key=$ACCESS_KEY_ID --secret_key=$SECRET_ACCESS_KEY -r public/ s3://$BUCKET_NAME
notifications:
email: true