Skip to content

Instantly share code, notes, and snippets.

@Roy-Orbison
Roy-Orbison / acmebase64
Created July 19, 2024 07:03
A simple tool for decoding & encoding data saved in acme.sh conf files, denoted by __ACME_BASE64__START_ & __ACME_BASE64__END_.
#!/bin/sh
ts=__ACME_BASE64__START_
te=__ACME_BASE64__END_
case $# in
0)
# loop ensures no final newline is added to input
printf '%s%s%s\n' "$ts" "$(
q=false
f='%s'
@Roy-Orbison
Roy-Orbison / README.md
Last active May 28, 2024 03:06
MozillaPPA files

Quick setup of Mozilla's PPA

The easy way to enable installation of packages, adapted from [Mozilla's guide][1]. Files should be saved to /etc/apt/preferences.d/mozilla-ppa and /etc/apt/sources.list.d/mozilla-ppa.sources. The PGP key is [Mozilla's][2], which you can compare to the one embedded in the .sources file. The fingerprint should match the required value 35BAA0B33E9EB396F59CA838C0BA5CE6DC6315A3 (as per their guide), which can be extracted like so:

grep -zoP 'Signed-By:\s*\K.*(?:[\r\n]+ .*)+' mozilla-ppa.sources \
    | sed 's/^ \(\.$\)\?//' \
 | gpg --show-keys
@Roy-Orbison
Roy-Orbison / dropbox-filenames-fix
Created January 22, 2024 07:02
A bash script to make filenames created on Mac/Linux compatible with Windows for shared Dropbox folders (or similar file syncing services).
#!/bin/bash
set -e
#shopt -s compat32
# illegal on windows
re_ctrl='[:cntrl:]'
re_ctrl="^([^$re_ctrl]*)[$re_ctrl]+(.*)"
re_punct='<>:"\\/|?*'
re_punct="^([^$re_punct]*)[$re_punct]+(.*)"
re_ts_td='[. ]+$'
@Roy-Orbison
Roy-Orbison / slash-search-fallback.html
Last active April 12, 2023 07:58
A contrived example to demonstrate that you can listen for "/" as a shortcut key *and* still fall back to the native Quick Find, so your site does not completely commandeer a useful browser feature.
<input type=search placeholder=search><br>
<textarea placeholder="won't respond to / shortcut"></textarea>
<script>
document.addEventListener(
'keydown',
(function() {
let lastWasSlash = false,
thisIsSlash,
input = document.querySelector('input');
return evt => {
@Roy-Orbison
Roy-Orbison / com.mattermost.calls-config.md
Last active June 9, 2023 12:52
Configure integrated calls plugin for Mattermost

Configure calls plugin for Mattermost

Simple case of Single-instance Team edition

Setting Value
RTC Server Address 0.0.0.0 or [::]
RTC Server Port Leave blank for 8443 default, or change to another available port
ICE Host Override Your chat server's host name, e.g. mm.organisation.example, unless that may not resolve to your public IP address when queried locally on that server. The latter can occur if you have an entry in your hosts file that resolves to a loopback address, or split-horizon DNS, in which case you need to enter the IP address or a different (sub)domain that always resolves to it, e.g. calls-mm.organisation.example.
ICE Servers Configurations Leave blank
@Roy-Orbison
Roy-Orbison / dl_ext_webstore_console.js
Last active May 1, 2022 04:56 — forked from tim-hub/dl_ext_webstore_console.js
Download the CRX file of a Chrome extension for inspection or manual installation.
window.location.href = (function() {
var browser = (function() {
var ua = navigator.userAgent,
tem,
M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
if (/trident/i.test(M[1])) {
tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
return {
name: 'IE',
version: (tem[1] || '')
@Roy-Orbison
Roy-Orbison / import-from-dir.php
Last active May 21, 2023 09:08 — forked from joshcangit/folder-import.php
Import any .sql[.gz] file, from a specifiable directory, rather than only the default adminer.sql[.gz], with Adminer.
<?php
/**
* Import SQL files from a directory
*
* @author joshcangit, https://github.com/joshcangit
* @author Roy-Orbison, https://github.com/Roy-Orbison
*/
class AdminerImportFromDir {
@Roy-Orbison
Roy-Orbison / maestral-open-dropbox.sh
Last active October 10, 2023 06:36
Simple link from Dolphin file manager to file/folder on Dropbox.com using Maestral GUI under KDE. The .desktop file goes under `~/.local/share/kio/servicemenus/` and the script should be anywhere in your PATH, I used `~/.local/bin/`. Script depends on realpath, xdg-open, notify-send, and of course maestral.
#!/bin/bash
if maestral status | grep -qFi 'not running'; then
err='Maestral not running'
elif ! droot="`maestral config get path`"; then
err='Maestral not found'
elif ! real="`realpath -eLPq "$1"`"; then
err='Path does not exist'
elif [[ ${#real} -le ${#droot} || "${real:0:${#droot}}" != "$droot" ]]; then
err="The path $real is not below the Dropbox root directory $droot"
else
@Roy-Orbison
Roy-Orbison / thunderbird-latest-update
Last active January 19, 2021 05:12
Basic shell script to install && update the latest Thunderbird on Linux (specifically Ubuntu)
#!/bin/bash
set -e
# Installation of this script:
# Delete one of the url variables below, or get another from
# https://www.thunderbird.net/thunderbird/all/
# and substituting its version number with 'latest'
#
url='https://download.mozilla.org/?product=thunderbird-latest-SSL&os=linux64&lang=en-US'
url='https://download.mozilla.org/?product=thunderbird-latest-SSL&os=linux64&lang=en-GB'
@Roy-Orbison
Roy-Orbison / firefox-dev-edition-update
Last active May 17, 2022 18:06
Basic shell script to install && update Firefox Developer Edition on Linux (specifically Ubuntu)
#!/bin/bash
set -e
# Installation of this script:
# Delete one of the url variables below, or get another from
# https://www.mozilla.org/firefox/all/#product-desktop-developer
# by selecting your language and platform, then copying the link on the
# Download button.
#
url='https://download.mozilla.org/?product=firefox-devedition-latest-ssl&os=linux64&lang=en-US'