Skip to content

Instantly share code, notes, and snippets.

View robconery's full-sized avatar
😍

Rob Conery robconery

😍
View GitHub Profile
# 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
@robconery
robconery / sql-setup-pg.md
Created September 28, 2023 00:17
Setup Postgres

There are numerous ways to get a PostgreSQL server up and running - the easiest is usually your best choice!

I like to run Postgres locally, so I typically run Postgres.app because I'm working on a Mac. It's very flexible and is a drag/drop install.

You can also work with Docker if you like, but beware that you might run low on resources later in the course as we dive into millllllions of records. Here's a docker-compose file for you to get started with:

version: "3"
services:
  postgres:
@robconery
robconery / mission-interview-skeet-binary-tree.md
Created September 27, 2023 19:20
Mission Skeet Binary Tree

This question is seemingly simple:

Decide if a tree is a binary tree

and then…

Decide if the tree is balanced

Another super common question you will likely be asked in one form or another. Interviewers just LOVE questions about binary tree traversal!

@robconery
robconery / mission-interview-skeet-linter.md
Created September 27, 2023 19:18
Mission Skeet Linter

We're going to start Jon off with a bit of a softball, asking him to create a linter for C#. Here’s the question:

Create a linter for C# which ensures that code structures are balanced. Specifically, code blocks starting with (, { and [.

Normally this question would take a candidate about 30 minutes, even if they haven't studied their interview questions.

Code is just a string and we're checking to make sure that certain characters have their counterparts. How would you solve this? Think about it for a minute and see if your ideas match Jon's.

We'll be using C# for this and the rest of the questions.

@robconery
robconery / mission-interview-k-range.md
Created September 27, 2023 19:18
Mission K-Range

This one is a bit tougher so don't feel bad if you don't finish. Again: the point is to demonstrate your thinking process and that you ask enough questions and think things through before you write any code.

Here’s the question:

You have k lists of sorted integers. Find the smallest range that includes at least one number from each of the k lists.

Here's some sample code

// For example,