Skip to content

Instantly share code, notes, and snippets.

let lastFireworksTime = 0;
let originalBodyProperties = {};
function perform_fireworks_show() {
console.log("Starting fireworks show");
// Store original body properties
originalBodyProperties = {
backgroundColor: $("body").css("background-color"),
opacity: $("body").css("opacity")
@jheitzeb
jheitzeb / cache.rb
Created January 19, 2025 20:09
Ruby code to benchmark Google Gemini Prompt Caching to understand runtime performance of caching.
# Copyright (c) 2024 Joe Heitzeberg
# Released under MIT License
module RedisUtil
module Cache
def self.redis
redis_host = ENV['REDIS_HOST']
redis_port = ENV['REDIS_PORT']
redis_db_num = 0
$redis ||= Redis.new(host: redis_host, port: redis_port, db: redis_db_num)
@jheitzeb
jheitzeb / dump_all_contacts.sh
Last active October 8, 2025 05:05
Export iMessages by year
#!/bin/bash
# MIT License
# Copyright (c) 2025 Joe Heitzeberg
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@jheitzeb
jheitzeb / currencies.rb
Last active October 19, 2022 21:30
USD's Buying Power vs. 1 Year Ago
# Ruby code to print the US dollar relative buying power vs 1 year ago at various popular travel destinations
CURRENCY_API_KEY = "get one for free at https://apilayer.com/marketplace/exchangerates_data-api?live_demo=show"
def self.currency_report
# using a public exchange rate API, get the historic rate vs. today's and compute the % change.
# List currencies of popular travel destinations
currencies = [
{code: "JPY", name: "Japanese Yen"},
{code: "EUR", name: "Euro"},
@jheitzeb
jheitzeb / blink_osx_network_monitor.sh
Created December 11, 2012 07:01
blink(1) script to light up osx network usage
@jheitzeb
jheitzeb / gist:1573333
Created January 7, 2012 01:06
Work activity log emailer
function myFunction() {
var email_lists = ["Cam Site", "Personal"];
var to_emails_by_list = ["[email protected], [email protected]", "[email protected]"];
var ss = SpreadsheetApp.getActiveSpreadsheet();
var spreadsheet_name = ss.getName();
var sheet = ss.getSheets()[0];
var data = sheet.getRange("A1:D4000").getValues();
var today = new Date();
@jheitzeb
jheitzeb / gist:1104924
Created July 25, 2011 19:15
Google Docs Survey Emailer
function onFormSubmit(e) {
var to_email = "[email protected]";
var ss = SpreadsheetApp.getActiveSpreadsheet();
var spreadsheet_name = ss.getName();
var sheet = ss.getSheets()[0];
var columns = sheet.getRange("A1:U1").getValues()[0];
var email_subject = "New response for [" + spreadsheet_name + "]";
var email_body = "Spreadsheet: " + spreadsheet_name + "\r\n\r\n";
var email_body_html = "<p><b>Spreadsheet: " + spreadsheet_name + "</b></p>";