Skip to content

Instantly share code, notes, and snippets.

View jboursiquot's full-sized avatar

Johnny Boursiquot jboursiquot

View GitHub Profile
@jboursiquot
jboursiquot / sql.sql
Created July 17, 2023 00:05
pgsql list size on disk of all tables
SELECT
table_schema || '.' || table_name AS table_full_name,
pg_size_pretty(pg_total_relation_size('"' || table_schema || '"."' || table_name || '"')) AS size
FROM information_schema.tables
ORDER BY
pg_total_relation_size('"' || table_schema || '"."' || table_name || '"') DESC;
@jboursiquot
jboursiquot / point.go
Created March 6, 2023 19:11
Solution
package main
import (
"math"
)
type Point struct {
Val float64
Ts uint32
}

Capstone Project

Summary

The capstone project outlined here will be to create a CLI tool (named ziplook) that, given a postal code, opens a browser that takes the user to Google Maps and drops a pin at the latitude and longitude of said postal code. The project will involve creating a API server for the CLI to interact with. The API will be hosted online using a third party Platform as a Service (PaaS) provider (Zeet) and be reacheable by issuing HTTP GET requests (no authorization required).

I will demonstrate the following:

  1. Building a REST API in Go
  2. Integrating with a remote API (https://api.zippopotam.us)
@jboursiquot
jboursiquot / products.json
Created October 27, 2022 22:51
Sample products dataset
[{
"id": 1,
"name": "Water - San Pellegrino",
"description": "curae nulla dapibus dolor vel est donec odio justo sollicitudin ut suscipit a feugiat et eros vestibulum ac est lacinia",
"price": 80
}, {
"id": 2,
"name": "Cape Capensis - Fillet",
"description": "rutrum neque aenean auctor gravida sem praesent id massa id nisl venenatis lacinia aenean sit amet justo morbi ut odio",
"price": 53
@jboursiquot
jboursiquot / sample.json
Created October 24, 2022 21:35
Sample json data
{
"name": "Johnny Boursiquot",
"location": "Baltimore, MD"
}
@jboursiquot
jboursiquot / generics.md
Last active July 21, 2022 15:56
Generics in 2 Hours

Generics in 2 Hours

Starting with version 1.18, Go supports the concept of generic programming through the introduction of three major concepts to the language:

  • Type parameterization of functions and types
  • Type sets defined by interfaces
  • Type inference

Let's see how these feature enable us to write less code while still retaining the simplicity we've come to expect of Go.

@jboursiquot
jboursiquot / practical-go-prereqs.md
Last active May 26, 2021 16:41
Practical Go workshop prerequisites

Practical Go Workshop Prerequisites

Thanks again for signing up for the workshop. There's a lot to cover and we'll need to hit the ground running on time so it's important that you arrive prepared with all you'll need locally already configured and ready to go.

TL;DR

  • Have Git installed
  • Have Go 1.13+ installed
  • Have an editor/IDE with Go plugin installed.
  • Have some basic familiarity with Go, use gobyexample.com if you need a refresher or introduction.
@jboursiquot
jboursiquot / requirements.md
Last active September 23, 2020 14:27
BaltimoreGo Challenge: Build a Port Scanner

Your challenge is to write a port scanner in Go that uses a worker pool to efficiently scan multiple ports concurrently. It should meet the following requirements:

  1. Accepts a range of ports to scan as an argument (e.g. ./portscan -ports 8080-9090)
  2. Accepts a number of workers to use for performing the scans (e.g. ./portscan -workers 100)
  3. Outputs <PORT> CLOSED for closed ports as they are discovered.
  4. Outputs <PORT> OPEN for open ports as they are discovered.
  5. Extra credit: How could you informed the user of your port scanner of the likely service running on the open ports? (e.g. 5432 is likely a PostgreSQL server)

Hints:

package mypackage
import (
"context"
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/dynamodb"
@jboursiquot
jboursiquot / go to
Last active September 21, 2019 13:51
bit.ly/gobridge-practical-go-workshop
bit.ly/gobridge-practical-go-workshop