Skip to content

Instantly share code, notes, and snippets.

View brandur's full-sized avatar

Brandur Leach brandur

View GitHub Profile
@brandur
brandur / github-actions-first-impressions.md
Last active November 7, 2019 19:45
GitHub Actions first impressions

Overall: very good experience. My migration from Travis involved quite a few prerequisites to get everything working in the same way again, and I was pleased to find all of them available in some form on GitHub Actions.

Here a couple problems I ran into:

  • Although there's a story for running background services like Postgres, there doesn't seem to be much of one for interacting with them with client tooling. After Postgres is running, I often want to createdb or raise a schema with psql. I ended up installing postgres via apt-get to get these tools, but it's mostly just good luck that the version drift between these old LTS versions and Postgres running in my container hasn't been too great for things not to work.

  • The above is true for all command line utilities. If I want Imagemagick, I have the choice between (1) Ubuntu's ancient version, and (2) running everything through a Docker container, and

@brandur
brandur / aeropress.md
Created June 5, 2015 18:59
Coffee Collective Aeropress Recipe

Coffee Collective Aeropress Recipe

  • Use standard orientation (i.e. not inverted).
  • 16g coffee.
  • Add water to get to 40-50g combined. Allow grinds to bloom for 15s.
  • Add water to get to 230g.
  • Do not stir.
  • Press over a period of 25s. Stop when you hit the top of the grinds.
@brandur
brandur / main.go
Created August 10, 2018 22:52
Request re-use
package main
import (
"bytes"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
@brandur
brandur / main.go
Created May 23, 2018 12:51
stripe-go API candidate #3: types with an interface, working
// This example is similar to candidate #2, but compiles because we make sure
// to define an alternate type for int64 (Int64) that we're allowed to add the
// Convert function to.
//
// This approach works, and is fairly clever, but ergonomically it looks very
// similar to the pointer approach in candidate #1. You use a type conversion
// instead of a function call when invoking Int64, but they look identical in
// code.
//
// Arguably, it has a small advantage over pointers in that because Int64 here
@brandur
brandur / main.go
Last active May 21, 2018 17:35
stripe-go API candidate #3: types with an interface, working
// This example is similar to candidate #2, but compiles because we make sure
// to define an alternate type for int64 (Int64) that we're allowed to add the
// Convert function to.
//
// This approach works, and is fairly clever, but ergonomically it looks very
// similar to the pointer approach in candidate #1. You use a type conversion
// instead of a function call when invoking Int64, but they look identical in
// code.
//
// Arguably, it has a small advantage over pointers in that because Int64 here
@brandur
brandur / stoicreviews.md
Last active October 29, 2017 14:07
SSL Issues

Probably issues (see details below):

  • The certificate returned is invalid.
  • You are not using SNI.

The server is returning an invalid SSL certificate. By the "ST=Some-State" note, I would guess that this was probably self-signed at some point:

$ openssl s_client -showcerts -connect stoicreviews.com:443
CONNECTED(00000003)
@brandur
brandur / build-failure.md
Created November 25, 2016 20:07
Build Failure

The linter is expecting that whitespace line up with an open parenthesis. In particular, this section starting on line 115:

        try:
            try:
                if(session is not None):
                    result = session.request(method,
                                                url,
                                                headers=session.headers,
                                                data=post_data,
@brandur
brandur / releases.rb
Created December 27, 2013 21:17
Heroku app releases this year
require "json"
require "time"
#
# usage: releases.rb <app>
#
def get_releases(app)
# use curl for -n
JSON.parse(`curl --silent -n -H "Accept: application/vnd.heroku+json; version=3" -H "Range: seq ..; order=desc, max=1000" https://api.heroku.com/apps/#{app}/releases`)

Fenced code blocks inside ordered and unordered lists

  1. This is a numbered list.

  2. I'm going to include a fenced code block as part of this bullet:

    Code
    More Code
    
@brandur
brandur / api-update-with-notes.md
Last active December 22, 2015 16:29
API Update

Current Projects

V3 GA

  • Blocked on security in releases
  • Need to finish up some client libraries -- JSON schema designed, and doc.json is being ported over

Orgs

  • Product is being shipped