Skip to content

Instantly share code, notes, and snippets.

View robconery's full-sized avatar
😍

Rob Conery robconery

😍
View GitHub Profile
@robconery
robconery / azure_webapp_setup.sh
Last active November 23, 2023 08:31
az webapp creation
#!/bin/bash
USER=deployer
PASS=[pick something]
APPNAME=[your app name]
RG=[your resource group]
SP=[your service plan]
#you can see a list of runtimes using
#az webapp list-runtimes --linux
@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>",
# 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 / 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 / gist:a84381b5631cf3b597fa
Last active September 28, 2023 16:23
Simple Node/PG DB Command Runner
We couldn’t find that file to show.
@robconery
robconery / gist:1636b3797d89f2c9b64f
Last active September 28, 2023 16:23
Baseline PG Connection Bits for Node
We couldn’t find that file to show.
@robconery
robconery / gist:98d4653c7b11633e6e74
Last active September 28, 2023 16:22
Jekyll to Ghost Export
We couldn’t find that file to show.
@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