Skip to content

Instantly share code, notes, and snippets.

@boltronics
boltronics / get-current-firefox-ver.sh
Created December 28, 2023 09:08
Print the current version number of Firefox for Desktop.
#!/bin/sh
# Print the current version number of Firefox for Desktop.
FIREFOX_RELEASE_FOLDER_URL='https://download-installer.cdn.mozilla.net/pub/firefox/releases/'
get_current_firefox_ver()
{
elinks -dump 1 -no-numbering "${FIREFOX_RELEASE_FOLDER_URL}" |
grep -E '^ \. ' |
#!/bin/bash
# Add supplementary group permissions and update the shell prompt.
# Requires adding the following to .bashrc after PS1 has been set:
# if [ -n "${PS1_PREFIX}" ]
# then
# export PS1="${PS1_PREFIX}${PS1}"
# unset PS1_PREFIX
# fi
declare newsubgrp="${1}"
@boltronics
boltronics / shell_output_and_notes.txt
Created September 29, 2020 07:24
Convert GPG public key to base64 on Salt Master
$ # Problem:
$ # * Official Debian GNU/Linux AMIs don't have gpg pre-installed.
$ # * We want to bootstrap a host using a salt-cloud deploy script.
$ # * This will add the key to the new host to add the Salt repository.
$ # * We cannot use apt-key so must add the gpg binary into trusted.conf.d
$ # directly.
$ # * We can base64 encode (base64 command is part of coreutils)
$ # but ideally won't store the key base64-encoded in pillar.
$ # Solution:
$ # A) Run `apt-get update`, install GnuPG, add the Salt repo key,
@boltronics
boltronics / xmlhttprequest-localstorage-test.html
Created July 26, 2019 07:51
Retrieve a huge image via XMLHttpRequest() to local storage using localForage, and load on demand.
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline'; img-src * data: blob: 'unsafe-inline';" />
<title>Local storage test</title>
</head>
<body>
<h1>This is a local storage test</h1>
<script src="localforage.min.js"></script>
I am Dev
Dev I am
That Dev-I-am
That Dev-I-am!
I do not like
That Dev-I-am
Do you like
Malware and spam
@boltronics
boltronics / fixme
Last active January 2, 2022 20:27
<!DOCTYPE html>
<html>
<body>
<h1>Help me, Arno-Wan Kenobi. You're my only hope.</h1>
</body>
</html>
@boltronics
boltronics / gitfind
Created September 13, 2018 05:50
Locate the git commit of a file that contains a specific MD5 checksum
#!/bin/bash
#
# Find a specific version of a file in the current directory by
# searching back through Git commit history. The file version is
# identified by the MD5 checksum.
#
declare -r check_file="${1}"
declare -r target_hash="${2}"
@boltronics
boltronics / asciinema-to-scriptreplay
Created September 9, 2018 23:44 — forked from izabera/asciinema-to-scriptreplay
convert between asciinema and scriptreplay
#!/bin/bash
exec {times}> times {typescript}> typescript < "${1-/dev/stdin}"
while read -r; do [[ $REPLY = ' "stdout": [' ]] && break; done # skip to this line
LANG=C
printf "Script started on %(%c)T\n" -1 >&"$typescript" # dummy
while read -r open; [[ $open = '[' ]]; do
read -r elapsed; read -r string; read -r close
eval printf %b%n "$string" characters >&"$typescript" # put count in $characters
printf "%s %s\n" "${elapsed%,}" "$characters" >&"$times"
done
@boltronics
boltronics / salt-pkg-builder.sh
Created July 17, 2018 02:12
Hacky script to build Salt packages for Debian with pbuilder and repo.saltstack.com packaging data
#!/bin/bash -e
# The tag name (or branch) of whatever you want to package.
declare -r tag="${1-v2017.7.5}"
declare -r pbuilder_target="${2-stretch}"
declare -r git_dir=./salt
# This makes no sense to me. Why are these different?
declare -r salt_upstream_version="${tag:1}"
@boltronics
boltronics / apt-changer
Created October 4, 2017 22:59
apt-changer
#!/bin/bash -e
# Copyright (c) 2017 Adam Bolte
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.