Skip to content

Instantly share code, notes, and snippets.

@psvo
psvo / syncedTabsToBookmarksHTML.js
Created October 12, 2025 10:14 — forked from jscher2000/syncedTabsToBookmarksHTML.js
Export Synced Tabs List to "bookmarks.html" file (Browser Console script)
// Run code in Browser Console after enabling chrome debugging --
// about:config => devtools.chrome.enabled => true
// https://developer.mozilla.org/docs/Tools/Browser_Console
try {
var tabPromise = SyncedTabs._internal.getTabClients();
tabPromise.then((arrDevices) => {
if (arrDevices && arrDevices.length > 0){
// Generate a string with the format of a bookmark export file
var d, e, out = '<!DOCTYPE NETSCAPE-Bookmark-file-1>\n<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">\n<TITLE>Bookmarks</TITLE>\n<H1>Bookmarks Menu</H1>\n<DL><p>\n';
const escapeHtmlEntities = function(aText){return (aText || '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;').replace(/'/g, '&#39;')};
@psvo
psvo / reject-annotated-tag-changes.sh
Last active July 13, 2021 15:41
GitHub hook to reject annotated tag changes
#!/usr/bin/env bash
# Protect existing annotated tags from changes. New annotated tags
# can be created, but existing ones cannot be changed, updated or
# deleted.
# Plain (unannotated) tags are not affected. Useful for protecting
# release tags from accidental changes.
fail() {
echo "*** $@" >&2
###########################################################
# Automation of Everything #
# How To Combine Argo Events, Workflows, CD, and Rollouts #
# https://youtu.be/XNXJtxkUKeY #
###########################################################
# Requirements:
# - k8s v1.19+ cluster with nginx Ingress
# Replace `[...]` with the GitHub organization or the username
@psvo
psvo / expand_placeholders.sh
Last active March 2, 2019 11:10
Simple but safe text placeholder replacement for bash
#!/bin/bash -e
# assumes SUBST_USER and SUBST_PASS environment variables
# no assuptions made about the actuall text
replace_credentials1() {
sed -e 's/[$]/${DOLLAR}/g; s/@username_placeholder@/${SUBST_USER}/g; s/@password_placeholder@/${SUBST_PASS}/g' | DOLLAR='$' envsubst
}
# assumes SUBST_USER and SUBST_PASS environment variables
# (!) hopefully (!) no assuptions made about the actuall text