Skip to content

Instantly share code, notes, and snippets.

View harrisoncramer's full-sized avatar

Harrison (Harry) Cramer harrisoncramer

View GitHub Profile
@harrisoncramer
harrisoncramer / fetch-image.go
Last active April 13, 2023 00:58
Image Scraping Script
/*
This is a simple script that uses Google's CSE (custom search engine)
to query for images and store them into a folder locally. It expects
you to have in your environment path two variables: GOOGLE_CSE_ID
and GOOGLE_API_KEY. The first one is the ID of your custom search
engine and the second is your google API key. Create a folder
called images alongside the binary and then execute it. It expects
a CSV file strcutured as follows:
some cool looking cars,cars
@harrisoncramer
harrisoncramer / Camelot
Created April 8, 2023 17:27
GPT Voice Recognition Script
# vi: ft=bash
#!/bin/bash
TOKEN="your_token"
MODEL="text-davinci-003"
MAX_TOKENS=500
TEMPERATURE="0.5"
STOP_WORD="Camelot"
# Use the "hear" CLI tool (w/ Mac's built-in voice recognition)
@harrisoncramer
harrisoncramer / query.md
Last active June 18, 2022 20:17
C2C_Weighted_Query

Problem Summary

We need to write two queries, that will return:

  1. The weighted rate of growth for graduates who studied certain fields
  2. The weighted rate of growth for jobs in those fields

We need these rates in order to calculate the "spread": the difference between the rate of growth for graduates and jobs per job type.

@harrisoncramer
harrisoncramer / notes.md
Last active November 7, 2022 12:01
VueConf 2022 Notes

Vue3

  • 25% of all VueJS downloads are Vue3
  • Johnson Chu is working full-time at Vue since March on Volar

Vite

  • Not part of Vue anymore technically
  • Planning 3.0 -- moving to internal ESM
    • Goal: Both production and dependency handle CommonJS modules the same
  • ESBuild is a Golang-written compiler that compiles to native code
  • Uses parallelism (Golang's strong suit)
@harrisoncramer
harrisoncramer / sql_technical_spec.md
Last active April 10, 2022 16:00
Query Technical Document

Query Technical Design Document

This document is meant to provide context to the data team on our SQL query strategy, as well as to provide context for some manual work that would be helpful to verify that these queries are working as intended. This document can also serve as a point of reference for other engineers who could later optimize these queries or rewrite them.

The Query: Overview

The query is divided into smaller segments, which are joined together to form the final result. The goal is to return a table that gives us the total over/undersupply of graduates for each region.

+---------------------------------------------------------------------------------------+---------+
# Set colors appropriately.
set -g terminal-overrides ',xterm-256color:Tc'
set -g default-terminal "tmux-256color"
set -as terminal-overrides ',xterm*:sitm=\E[3m'
# Make escape faster for editing in Nvim
set -s escape-time 0
# Change Bind Key
set -gu prefix2
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
server_name www.loql.land loql.land;
listen [::]:443 ssl ipv6only=on; # managed by certbot
listen 443 ssl; # managed by certbot
/*
https://rickandmortyapi.com/graphql
I'm trying various queries, but they all seem to be working. Here's an example:
*/
function normalizeResult(result) {
const rootQueryObject = {};
const denestedObjects = [];
/*
query {
characters {
info {
count
}
results {
id
name
}
# : << EOF
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# -- turn on mouse by default (for resizing windows) ----------------
set -g mouse on
# -- change-bind-key -------------------------------------------------