Skip to content

Instantly share code, notes, and snippets.

@andrewgilmartin
andrewgilmartin / launch.json
Created December 27, 2025 17:20
VSCode launch.json configuration for debugging Streamlit application. Most of the details where found at https://discuss.streamlit.io/t/vs-code-debug/520
{
"version": "0.2.0",
"configurations": [
{
"name": "debug streamlit",
"type": "debugpy",
"request": "launch",
"program": ".venv/bin/streamlit",
"args": [
import streamlit as st
import pandas as pd
def main():
st.title("Cities Explorer!")
cities = load_cities()
populations = cities.groupby('state_id', as_index=False)['population'].sum()
st.bar_chart(populations, x='state_id', y='population')
@andrewgilmartin
andrewgilmartin / node-line.html
Last active November 20, 2024 18:45
Node Line
<!DOCTYPE html>
<html>
<body>
<H1>Node Line</H1>
<div id="c1"></div>
<script>
function createNodeLineElement(nodes, nodeWidth = 10, lineColor = 'gray', lineWidth = 4) {
const n = nodeWidth;
const n2 = nodeWidth / 2;
package org.openrewrite.starter;
import org.openrewrite.ExecutionContext;
import org.openrewrite.Recipe;
import org.openrewrite.SourceFile;
import static org.openrewrite.Tree.randomId;
import org.openrewrite.java.JavaIsoVisitor;
import org.openrewrite.java.tree.J;
import org.openrewrite.java.tree.JLeftPadded;
import org.openrewrite.java.tree.JavaType;
@andrewgilmartin
andrewgilmartin / SSLUtilities.java
Created March 9, 2022 20:58 — forked from bekce/SSLUtilities.java
Ignore SSL/TLS trust/certificate errors in Java. Call SSLUtilities.trustAllHttpsCertificates() at init
package utils;
import java.security.GeneralSecurityException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
@andrewgilmartin
andrewgilmartin / updateTableOfTodos.js
Last active June 13, 2021 05:45
A Google App Script to build a Table of TODOs from TODOs distributed in a Google Doc document.
/*
See https://www.calliopesounds.com/2019/10/adding-table-of-todos-to-google-document.html
This Google App Script script collects the text of all the TODO paragraphs
and organizes them under a Table of TODOs heading. The TODO paragraph is
normal-styled and starts with the string "TODO: ". The Table of TODOs is a
heading-styled paragraph and contains only the text "Table of TODOs". The
TODO texts are organized in to numbered list items under the heading. In
addition, the script adds a Bookmark to each TODO paragraph so that it can
be referenced from the numbered list item.
@andrewgilmartin
andrewgilmartin / illiterate.pl
Last active October 8, 2019 16:48
Simpleminded Java + Javadoc to HTML Converter
#!/usr/bin/perl -w
use strict;
use XML::Writer;
my $state = 0;
my $h = new XML::Writer();
$h->startTag("html");
$h->startTag("head");
@andrewgilmartin
andrewgilmartin / gist:68d1451e43cbcce8487a684e35dc9b1b
Last active September 27, 2019 15:28
Missing steps from Terraform's "Basic Two-Tier AWS Architecture" README.txt

Some missing steps from Terraform's "Basic Two-Tier AWS Architecture" README.txt

https://github.com/terraform-providers/terraform-provider-aws/tree/master/examples/two-tier

(1) If you have an AWS account that allows for "EC2 Classic" then this whole example might not work for you. I have an ancient AWS account that has EC2 Classic support and have found that other Hashicorp examples do not work. (The networking and security group defaults seem to be wrong.) You call tell if you have an EC2 Classic account as to will see "EC2" inaddition to "VPC" listed under the "Supported Platforms" of the "EC2 Dashboard." I advise you to create a new account and use that instead; I did.

(2) Generate an SSH key pair on your local machine, eg

ssh-keygen -f id_terraform_two_tier
#!/usr/bin/perl -w
use strict;
use Date::Calc qw/Today Delta_Days/;
my @today = Today();
my @events = ();
while ( <DATA> ) {
next if /^#/;
@andrewgilmartin
andrewgilmartin / gist:be3b01770245028633f4
Last active August 12, 2018 22:50
The Observer Pattern
/**
* The Observer pattern is used to create a relationship between two objects.
* The relationship is usually unidirectional with the observer waiting for
* notices from the observed. The relationships is a loose one as the observed
* only needs to know of the interest of the observer and the observer only
* needs to know of the set of and ordering of notice the observed will send. A
* downside of this looseness is that all notices pass through a single observer
* method for further dispatching.
*/
package com.andrewgilmartin.common.observation;