Skip to content

Instantly share code, notes, and snippets.

View arschles's full-sized avatar
🎯
Focusing

Aaron Schlesinger arschles

🎯
Focusing
View GitHub Profile
@arschles
arschles / install-gh-cli.sh
Last active March 31, 2024 17:42
How to install the GitHub CLI without Homebrew
#!/bin/bash
echo "This will install the GitHub CLI (gh) onto your system"
echo "When this is done, you'll have a new 'gh' command line tool..."
echo "in your /usr/local/bin directory. On most Mac and Linux systems..."
echo "That directory will be in your 'PATH' environment variable..."
echo "If it isn't, please add it. You can temporarily do so by running this:"
echo "\n export PATH=\"/usr/local/bin:\$PATH\""
RELEASE="0.6.2"
@arschles
arschles / monorepo.md
Last active November 16, 2023 11:32
Why We Should Use Monolithic Repositories

I think we should have all our code in a monolithic repository.

I've detailed the big benefits to having one, addressed possible issues to having one, and mentioned a few risks to not moving to a monorepo below.

Benefits To Adopting a Monolithic Repo

Golang package dependencies

  1. Single vendor/ dir at the top level of deis/deis
  2. All internal packages use the same external dependencies
@arschles
arschles / keep-cool-with-fans.go
Last active August 19, 2023 10:10
Fan-out and Fan-in with Go
package fans
// this code was inspired by https://talks.golang.org/2012/concurrency.slide#36
//
// it uses the context package (which wasn't available when that presentation was made) instead of a timer to
// do timeouts
import (
"context"
"time"
@arschles
arschles / more-resources.md
Last active January 13, 2023 15:44
Tuning an HTTP Client for Great Good!

Other Go Libraries to Help With Doing HTTP Clients

  • ctxhttp - use HTTP clients but do requests timeouts with a context
    • httptrace - a good library to pair with ctxhttp; you can use this to trace requests up to the server. this is pretty advanced usage, so I recommend you go here once you have basic performance issues sorted out
  • fasthttp - slightly easier-to-use HTTP client. you still have to deal with connection pool details though. still useful if you like the API better
  • go-cleanhttp - battle-tested HTTP client. useful to compare against the above code
  • gorequest - nicer API, not as geared toward load testing. recommend against this for load tests, but for business logic it's good
@arschles
arschles / aoc.md
Created February 1, 2021 20:27
aoc 5

--- Day 5: Binary Boarding --- You board your plane only to discover a new problem: you dropped your boarding pass! You aren't sure which seat is yours, and all of the flight attendants are busy with the flood of people that suddenly made it through passport control.

You write a quick program to use your phone's camera to scan all of the nearby boarding passes (your puzzle input); perhaps you can find your seat through process of elimination.

Instead of zones or groups, this airline uses binary space partitioning to seat people. A seat might be specified like FBFBBFFRLR, where F means "front", B means "back", L means "left", and R means "right".

The first 7 characters will either be F or B; these specify exactly one of the 128 rows on the plane (numbered 0 through 127). Each letter tells you which half of a region the given seat is in. Start with the whole list of rows; the first letter indicates whether the seat is in the front (0 through 63) or the back (64 through 127). The next letter indicates which h

// Package scale provides functionality to calculate chromatic scales based on
// tonics, major/minor, sharp/flat, and intervals
//
// This requires extensive music understanding
//
// This is not an easy exercise and is not production ready.
// Hic sunt dracones 🤡
package scale
import "strings"
@arschles
arschles / melkey-docker-compose.txt
Created September 23, 2020 00:50
docker-compose with letsencrypt
```❯ docker-compose -f docker-compose-prod.yml -p melkey up
Creating network "melkey_default" with the default driver
Creating melkey_client_1 ... done
Creating melkey_server_1 ... done
Creating melkey_certbot_1 ... done
Creating melkey_nginx_1 ... done
Attaching to melkey_server_1, melkey_certbot_1, melkey_client_1, melkey_nginx_1
nginx_1 | 2020/09/23 00:50:04 [emerg] 1#1: no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/conf.d/app.conf:8
nginx_1 | nginx: [emerg] no "ssl_certificate" is defined for the "listen ... ssl" directive in /etc/nginx/conf.d/app.conf:8
client_1 |
@arschles
arschles / delete.sh
Created March 17, 2020 17:55
Delete GlobalProtect on Mac OS X
ps -ef | grep GlobalProtect
# take note of the GlobalProtect PID, store in $GP_PID
sudo kill -9 $GP_PID
sudo rm -f /Library/LaunchAgends/com.paloaltonetworks.gp.*
# this will restart the machine. Continue below after it comes back
sudo shutdown -r now
# finally, clear the staging kernel cache
sudo kextcache --clear-staging
@arschles
arschles / .envrc
Last active October 5, 2019 00:06
Installing PhantomOS on Azure, kinda
export RES_GROUP=photon
export AZURE_STORAGE_ACCOUNT=photonimages
export AZURE_STORAGE_CONTAINER_NAME=photonimages
export BLOB_NAME=photon3.vhd
export ADMIN_USERNAME=arschles
export VM_NAME=photon3
export LOCATION=eastus2
export PHOTON_VHD_PATH=photon3.vhd
@arschles
arschles / 00-install-gnome-core.sh
Last active October 4, 2019 00:07
Set up Gnome and VNC server on an Azure Ubuntu Server VM
#!/bin/bash
set pipefail
set -eou
apt install gnome-core ubuntu-gnome-desktop
echo "Now go and click 'reboot' on your VM in the portal"