Skip to content

Instantly share code, notes, and snippets.

View magnetikonline's full-sized avatar
🌴
Taking a small hiatus.

Peter Mescalchin magnetikonline

🌴
Taking a small hiatus.
View GitHub Profile
@magnetikonline
magnetikonline / README.md
Last active August 31, 2026 06:05
Google spreadsheet auto sort rows after cell change.

Google spreadsheet auto sort rows after cell change

Example: Spreadsheet of expenses (sheet name Expenses) starting from the sixth row (allowing for headers/etc.) with each expense date in column A. After update of any expense row date cell, all line items are automatically resorted by date.

How to implement:

  1. From Google spreadsheet goto: Extensions -> Apps Script.
  2. Enter the following JavaScript code:
include "/usr/local/share/nano/*.nanorc"
set mouse
set tabsize 2
bind M-f nextword main
bind M-b prevword main
@magnetikonline
magnetikonline / README.md
Last active May 3, 2026 23:15
Sending AWS SNS message subscription into Slack workflow.

Sending AWS SNS message subscription into Slack workflow

Inspired by: https://stackoverflow.com/a/72574950

A no-code solution to push messages sent to an AWS SNS topic into Slack via a workflow webhook.

  • Create a new Slack Workflow, using From a webhook as the triggering event.
  • Include the following Data variables:

Message

@magnetikonline
magnetikonline / npm-package-regenerate.js
Last active August 11, 2026 00:27
Generate Node.js `npm install` commands from existing package.json.
import fs from 'node:fs';
// const fs = require('fs');
function buildCommand(deps,flag = '') {
if (!deps) return;
const packages = Object.entries(deps)
.map(([name,version]) => `${name}@${version.replace(/^[\^~]/,'')}`)
.join(' ');
if (flag) {
@magnetikonline
magnetikonline / README.md
Last active February 18, 2026 00:10
Jira ticket comments remove threading bookmarklet.

Jira un-thread item comments bookmarklet

Atlassian added the concept of Threaded Comments around September 2025.

Currently there is no formal method to "un-thread" a conversation into a sequential list of comments. This bookmarklet is a (hacky) attempt to un-thread ticket comments and place in descending date order.

Usage

  • Create a new empty bookmark. Name it appropriately (e.g. Jira comment un-thread).
  • Copy contents of bookmarklet.js place into the URL of the new bookmark.
@magnetikonline
magnetikonline / README.md
Last active August 16, 2026 04:02
Chrome extensions I use.
@magnetikonline
magnetikonline / README.md
Last active October 3, 2025 03:28
Locate unused AWS security groups.

Locate unused AWS security groups

For an AWS Security Group to be considered in-use/active it will be assigned to an Elastic network interface (ENI's).

The following Python script will determine currently unused security groups by:

  • Query AWS for all active ENI's in an account region.
  • For each interface, extract the attached security group(s).
  • Query AWS for all security groups within the same account region.
  • Determine where and output a security group which currently has zero assignments to any active ENI's.
@magnetikonline
magnetikonline / README.md
Last active September 25, 2025 01:17
Extract AWS IAM action list tables to JSON.

Extract AWS IAM action list tables to JSON

A quick-and-dirty browser script for extracting action list tables from AWS Identity and Access Management pages to JSON documents.

Once in JSON, these IAM action lists can be easily queried using tools such as jq to answer questions such as:

  • List all Write IAM actions for service X.
  • List all Read IAM actions for service X resource type Y.

Usage example

@magnetikonline
magnetikonline / README.md
Last active August 25, 2026 04:19
macOS - Install Rsync from source.

Install Rsync on macOS from source

Bash script to install a much more recent version of rsync from source on macOs.

Requires as a minimum Xcode CLI tools (no need for a full install). Can be installed via the following:

$ xcode-select --install
@magnetikonline
magnetikonline / README.md
Created April 23, 2025 03:49
PostgreSQL query to list all tables without a defined primary key.

PostgreSQL list tables without defined primary key

This query can be handy for tasks such as setting up a logical replication publication, where by default a table's PRIMARY KEY is used to identify subscriber side rows for update or delete.

By locating tables without a PRIMARY KEY (tisk!), we're able to either update the table schema, or use an alternative replica identity type.

SELECT tbl.table_catalog,tbl.table_schema,tbl.table_name
FROM information_schema.tables tbl
WHERE