Skip to content

Instantly share code, notes, and snippets.

@judell
Created September 15, 2021 22:01
Show Gist options
  • Save judell/51f29f517dda52c27b2f2486dc91261d to your computer and use it in GitHub Desktop.
Save judell/51f29f517dda52c27b2f2486dc91261d to your computer and use it in GitHub Desktop.
find gists that illustrate patterns
> with filenames as (
select
id,
jsonb_object_keys(files) as name
from github_my_gist
)
select
f.name,
g.files -> f.name ->> 'language' as language,
g.description as pattern
from filenames f
join github_my_gist g using (id)
where g.description ~ '^PATTERN'
+-----------------------------------------+----------+-----------------------------------------------+
| name | language | pattern |
+-----------------------------------------+----------+-----------------------------------------------+
| find-unused-security-groups.sql | SQL | PATTERN: UNION similar things to combine them |
| untagged-ec2-instances-and-keypairs.sql | SQL | PATTERN: UNION similar things to combine them |
+-----------------------------------------+----------+-----------------------------------------------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment