Skip to content

Instantly share code, notes, and snippets.

View robconery's full-sized avatar
😍

Rob Conery robconery

😍
View GitHub Profile
@robconery
robconery / custom-instructions-snippet.json
Last active March 16, 2025 07:33
Code style Snippets
"Code Gen Instruction": {
"prefix": "instruction-codegen",
"body": [
"\t\"github.copilot.chat.codeGeneration.instructions\": [",
"\t\t{",
"\t\t\t\"text\": \"use JavaScript for all code. use camelCase for variable names, PascalCase for class names. Use spaces for indentation. Use single quotes for strings. Use 2 spaces for indentation.\"",
"\t\t}",
"\t],"
]
@robconery
robconery / Book.md
Last active March 15, 2025 13:19
Obsidian Bujo Templates
title description author created updated
{{title}}
{{description}}
{{author}}
{"DATE:YYYY-MM-DD HH:mm:ss" => nil}
{"DATE:YYYY-MM-DD HH:mm:ss" => nil}

cover|150

@robconery
robconery / foo.md
Created July 31, 2024 19:31
Thingy #rob

Something Amazing

@robconery
robconery / docker-compose.yml
Created May 6, 2024 01:35
Metabase Docker Compose
version: '3.9'
services:
metabase:
image: metabase/metabase:latest
container_name: metabase
hostname: metabase
volumes:
- /dev/urandom:/dev/random:ro
ports:
- 3000:3000
# Admin API key goes here
KEY="[FIND ME IN THE ADMIN SETTINGS]"
# Split the key into ID and SECRET
TMPIFS=$IFS
IFS=':' read ID SECRET <<< "$KEY"
IFS=$TMPIFS
# Prepare header and payload
NOW=$(date +'%s')
@robconery
robconery / csproj-snippet.json
Last active November 17, 2023 05:10
.NET Template JSON
"nuget": {
"prefix": "nuget",
"body": [
"\t<PropertyGroup>\t\t",
"\t\t<PackageId>$1</PackageId>",
"\t\t<PackageVersion>1.0</PackageVersion>",
"\t\t<Title>$2</Title>",
"\t\t<Authors>Rob Conery</Authors>",
"\t\t<Description>$3</Description>",
"\t\t<PackageTags>dotnet;</PackageTags>",
@robconery
robconery / sql-05-tangent-dates.md
Created September 28, 2023 18:11
SQL Tangent Dates

Bottom line: never trust a spreadsheet. You're going to hear me say that a lot in this production! Especially when it comes to dates.

Postgres is pretty good at dealing with dates... in fact it's amazingly powerful as well as correct:

select now(); -- what date and time is it where my server is located?
select now() + '1 day' as tomorrow; -- adding an interval is extremely easy
select now() at time zone 'America/New_York'; -- specifying a timezone
@robconery
robconery / sql-04-extraction-inspect.md
Created September 28, 2023 00:22
SQL Extraction Inspect

Postgres ships with a powerful binary client, psql. If you're not a command line person, it can take a little getting used to. It's worth the investment, however, because the speed and scriptability of psql is extremely powerful.

You can login to your database with a simple command:

psql cassini

Once you're in, you can have a look around and see what's there:

@robconery
robconery / sql-03-extraction-import.md
Created September 28, 2023 00:21
SQL Extraction Import

When importing data into Postgres from a CSV, it's imperative that you do not try to alter the data - do that by explicitly transforming the data later on.

That means we need to import everything as text, because that's the core string type in Postgres (as opposed to varchar etc).

To create our schema and table:

create schema csvs;
create table csvs.master_plan(
 start_time_utc text,
@robconery
robconery / sql-02-extraction-intro.md
Created September 28, 2023 00:19
SQL Extraction Intro

We need to setup our dev environment (quickly) with a few bash commands:

mkdir cassini
cd cassini
mkdir csvs
touch csvs/import.sql
touch README.md
createdb cassini