diff --git a/content/courses/containers-for-hpc/using.md b/content/courses/containers-for-hpc/using.md index 9cdd2dcf..1d51c389 100755 --- a/content/courses/containers-for-hpc/using.md +++ b/content/courses/containers-for-hpc/using.md @@ -14,7 +14,7 @@ Log on to our HPC cluster - Make sure you have a few GBs of free space - Run `allocations` - Check if you have `hpc_training` -- Request an interative job +- Request an interactive job {{< code-snippet >}}ijob -A hpc_training -p interactive -c 1 -t 2:0:0{{< /code-snippet >}} - Run `module load apptainer` diff --git a/layouts/shortcodes/code-snippet.html b/layouts/shortcodes/code-snippet.html index c3ce44bb..494fbe87 100644 --- a/layouts/shortcodes/code-snippet.html +++ b/layouts/shortcodes/code-snippet.html @@ -1,15 +1,37 @@ {{ $id := delimit (shuffle (seq 1 9)) "" }} -
-
{{ .Inner }}
- -
+
{{ .Inner }}
+ + function copyToClipboard(id, btn) { + const copyText = document.getElementById(id).textContent; + const textArea = document.createElement('textarea'); + textArea.value = copyText; + + // Prevent scrolling to bottom by positioning it off-screen and fixed + textArea.style.position = 'fixed'; + textArea.style.left = '-9999px'; + textArea.style.top = '0'; + + document.body.appendChild(textArea); + textArea.focus(); + textArea.select(); + + try { + document.execCommand('copy'); + // Provide visual feedback + const originalText = btn.innerHTML; + btn.innerHTML = 'Copied! '; + + setTimeout(() => { + btn.innerHTML = originalText; + }, 2000); + } catch (err) { + console.error('Unable to copy', err); + } + + document.body.removeChild(textArea); + } + \ No newline at end of file