Skip to content

Instantly share code, notes, and snippets.

@jvarn
jvarn / apply_ssl_cert_to_WD_my_cloud_nas.md
Last active August 26, 2024 06:54
Apply SSL cert to WD My Cloud NAS

How to apply your wildcard SSL certificate to a WD My Cloud NAS device

I have tested this on WD My Cloud EX4 (an obsolete model).

  1. Enable SSH access through the NAS web interface, choosing a suitable password when prompted.

  2. Copy the certificates over from where they are stored.

cd /home/user/certs # e.g.
@jvarn
jvarn / reverse-table-columns.vb
Last active March 26, 2024 09:54
Reverse order of table columns in MS Word VBA
' Reverses LTR tables with visually RTL content and vice versa
' Tested with simple table (no merged cells) on Microsoft 365 versions of:
' Microsoft Word for Mac, Version 16.83
' Microsoft Word for Windows, Version 2402
Sub ReverseTableColumns()
Dim tbl As Table
Dim colCount As Long
Dim i As Long
Dim j As Long
Dim tempContent As String
@jvarn
jvarn / markdown-parsing.html
Last active July 17, 2023 06:05
Markdown parsing with code highlighting using Marked JS and Marked Highlight
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>Markdown Parsing</title>
</head>
<body>
<h1>Markdown Parsing using Marked JS</h1>
<p>Fetches Marked JS Readme.md as an example.</p>
<section id="content"></section>
@jvarn
jvarn / ubuntu_post_install.sh
Last active July 12, 2023 06:02
Ubuntu post-install script (installs my usual packages and apps)
#!/bin/bash
sudo apt update && sudo apt upgrade -y
### APT
function install_apt_packages {
apt_packages=""
read -e -p "Install Gnome Tweaks? (n) " choice
[[ "$choice" == [Yy]* ]] && apt_packages="${apt_packages}gnome-tweaks "
@jvarn
jvarn / find_installed_software.sh
Created July 10, 2023 09:07
Quick search for installed dpkg, flatpak, snap packages
#!/bin/bash
BoldGreen='\033[1;32m'
NoColour='\033[0m'
## Parameter specified?
if [ $# -eq 0 ]; then
echo -e "No package specified"
exit 1
fi
@jvarn
jvarn / make_windows_usb.sh
Last active August 22, 2024 07:57
Make Windows USB Installer on Mac
#!/bin/bash
# Installs Homebrew and Wimlib if not already installed,
# then formats and prepares an external USB device as
# a bootable Windows installer from your Windows ISO.
#
# Usage: ./make_windows_usb.sh windows_installer.iso
# (first make executable with: chmod u+x ./make_windows_usb.sh)
#
# Insert a single external USB target device before running.
# Do not use blindly – bad things can happen.
@jvarn
jvarn / mobile-number-formatter.php
Created August 1, 2022 05:19
PHP function to make mobile numbers in full international format
<?php
/**
* Formats mobile numbers as international.
*
* @access public
* @param string $number is a mobile phone number
* @param array $args is an associative array of variables (see $defaults)
* @return string
*/
@jvarn
jvarn / geolocation.js
Last active April 4, 2022 05:57
Insert Latitude and Longitude into Formidable Forms
var geomaptarget = document.getElementById("geomaptarget");
var field_latitude = document.getElementById("field_latitude");
var field_longitude = document.getElementById("field_longitude");
function getLocation() {
if ( geomaptarget !== null ) { // for paginated forms
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition( // https://developer.mozilla.org/en-US/docs/Web/API/Geolocation/getCurrentPosition
// Success function
@jvarn
jvarn / excel-url-encode-decode.vb
Last active September 16, 2024 11:00
URL Encode and Decode VBA functions for Excel on Mac or Windows including UTF-8 support
Option Explicit
'------------------------------------------------------------------------------
' Module: URL Encode and Decode Functions
' Author: Jeremy Varnham
' Version: 1.1.0
' Date: 22 August 2024
' Description: This module provides two functions: URLEncode and URLDecode.
' These functions allow you to encode and decode URL strings,
' supporting ASCII, Unicode, and UTF-8 encoding.