Skip to content

Instantly share code, notes, and snippets.

@judell
judell / javier.sp
Last active April 13, 2023 22:37
dashboard with code reuse
dashboard "javier" {
with "tls_data" {
sql = <<EOQ
select
'domain.com:443' as address,
max(distinct version) as max_version
from
net_tls_connection
where
@judell
judell / oss-spotlight.md
Last active April 17, 2023 19:23
platform weekly oss spotlight

Steampipe is an open-source tool that can query cloud services rapidly, at scale, using SQL as the common way to access the APIs of AWS, GitHub, Kubernetes, M365, and more than 100 others. For example, Steampipe maps the AWS APIs to over 400 tables, with extensive copy-and-run examples for each table. If you've been writing Python scripts to gather and analyze data from these APIs, you'll want to give Steampipe a try. We bet you'll retire those Python scripts because accessing APIs with Steampipe, both within and across providers, is an easier, faster, and better way to get the job done.

Compliance benchmarks layered on the Steampipe core provide suites of controls that implement recommendations from CIS, GDPR, HIPAA, NIST 800-53, PCI, SOC2, and other frameworks. Use these be

@judell
judell / transfer.go
Last active April 5, 2023 23:03
transfer mastodon lists
package main
import (
"context"
"database/sql"
"fmt"
"strings"
"time"
_ "github.com/lib/pq"
@judell
judell / spc-snapshot-cleanup.py
Created April 3, 2023 19:14
delete all but most recent 3 spc snapshots matching a title
import os, requests, time
org_handle = "acme"
workspace_handle = "jon"
url = f"https://cloud.steampipe.io/api/v0/org/{org_handle}/workspace/{workspace_handle}/snapshot"
headers = {
"Authorization": f"Bearer {os.environ['STEAMPIPE_CLOUD_TOKEN']}"
}
# Fetch all snapshots with the specified title
@judell
judell / server-to-server-boosts.csv
Created February 4, 2023 00:24
server-to-server-boosts
to_id id title properties from_id
infosec.exchange infosec.exchange {"reblog_server":"cyberplace.social","server":"infosec.exchange"}
mstdn.social mstdn.social {"reblog_server":"mastodon.social","server":"mstdn.social"}
infosec.exchange infosec.exchange {"reblog_server":"infosec.exchange","server":"infosec.exchange"}
dan.mastohon.com dan.mastohon.com {"reblog_server":"toot.thoughtworks.com","server":"dan.mastohon.com"}
mstdn.social mstdn.social {"reblog_server":"mastodon.social","server":"mstdn.social"}
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
mstdn.social mstdn.social {"reblog_server":"mas.to","server":"mstdn.social"}
mstdn.social mstdn.social {"reblog_server":"climatejustice.social","server":"mstdn.social"}
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
@judell
judell / home-timeline-boosts.csv
Created February 4, 2023 00:24
home-timeline-boosts
id title properties from_id to_id
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
sciences.social sciences.social {"reblog_server":"sciences.social","server":"mastodon.social"}
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
mastodon.social mastodon.social {"reblog_server":"mastodon.social","server":"mastodon.social"}
@judell
judell / mastodon-peers-and-blocks.md
Last active February 2, 2023 04:35
mastodon peers and blocks

Count peers of servers in the home timeline

with data as (
  select
    'https://' || server as server
  from
    mastodon_toot
  where
    timeline = 'home'
@judell
judell / steampipe-external-contributors.py
Created December 14, 2022 02:15
steampipe external contributors
import json, psycopg2, psycopg2.extras, os, re
conn_str = f"host='localhost' dbname='steampipe' user='steampipe' port='9193' password='{os.getenv('STEAMPIPE_LOCAL_PASSWORD')}'"
def get_repos():
sql = f"""
select
full_name
from
github_my_repository
where
@judell
judell / find-followers-and-follows-not-on-lists.sql
Created December 6, 2022 02:58
find followers and follows not on lists
with data as (
select
l.title as list,
a.*
from
mastodon_list l
join
mastodon_list_account a
on
l.id = a.list_id
@judell
judell / rendering-html-in-dashboard-tables.md
Last active December 2, 2022 06:58
rendering-html-in-dashboard-tables

Rendering HTML in dashboard tables

The Mastodon API returns HTML which dashboards display raw. The Mastodon plugin deals with that by stripping HTML tags which is minimally OK but not great. Here is rough go at a way to enable HTML to render in table cells.

Code

In ~/steampipe/ui/dashboard/src/components/dashboards/Table/index.tsx:

Add these imports: