Skip to content

Instantly share code, notes, and snippets.

View nikokultalahti's full-sized avatar

Niko Kultalahti nikokultalahti

View GitHub Profile
@nikokultalahti
nikokultalahti / gist:4a2714915888daae5c23ab951c41853f
Created May 15, 2026 08:37
This SQL query is designed for Google Cloud Asset Inventory query. It identifies running VM instances that have Shielded VM Secure Boot enabled and were created before November 7, 2025. These instances are at risk of boot failure or security update issues starting in mid-2026 due to the expiration of the Microsoft UEFI Certificate Authority (CA)…
WITH
Instances AS(
SELECT
SPLIT(name, '/') as nameComponents,
-- Extracting the creation timestamp
resource.DATA.creationTimestamp as createTime,
-- Extracting the current lifecycle status (RUNNING, TERMINATED, etc.)
CAST(resource.DATA.status AS STRING) AS instanceStatus,
-- Access the nested Secure Boot boolean
CAST(resource.DATA.shieldedInstanceConfig.enableSecureBoot AS BOOL) AS secureBootEnabled,
@nikokultalahti
nikokultalahti / gcloud_cli_schema_as_json
Created October 27, 2025 08:03
Google Cloud CLI command for getting table/view schema as json
bq show --schema --format=prettyjson project_id:dataset_id.table_view_id | pbcopy
@nikokultalahti
nikokultalahti / wallabag-json-to-html-karakeep
Created August 28, 2025 16:23
This ruby script convers a link list exported from Wallabag as json to html that can be imported into Karakeep
#!/usr/bin/env ruby
require 'json'
require 'time'
abort "Usage: ./script import-file [export-file]" if ARGV.empty?
input_file = ARGV.shift
export_filename = ARGV.shift
export_filename = 'exported_bookmarks.html' if export_filename.empty? || export_filename.nil?
@nikokultalahti
nikokultalahti / script.js
Created September 17, 2024 05:32
Sort table rows by column
function sortTableByColumn(col, table) {
// Get all rows
let rows = Array.from(table.rows);
// Ignore the header row
rows = rows.slice(1);
// Sort the rows
rows.sort((row1, row2) => {
@nikokultalahti
nikokultalahti / Google Sheet MX Lookup
Last active September 25, 2023 17:30
Google App Script to find MX records of domains in Google Sheet
// Function to check if the MX records point to Google, Microsoft or somewhere else
function checkMXRecords() {
// Open your Google Spreadsheet
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
// Show error if there's no Sheet linked to the script
if (spreadsheet == null) {
throw 'No active spreadsheet';
}