Skip to content

Instantly share code, notes, and snippets.

View craigfurman's full-sized avatar

Craig Furman craigfurman

  • London
  • 05:41 (UTC)
View GitHub Profile
@craigfurman
craigfurman / update_libs.sh
Last active September 21, 2015 11:00
Update Go dependencies after installing a new language version
go list -f '{{join .Deps "\n"}}' ./... | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | xargs go install -a
@craigfurman
craigfurman / firehose.go
Created June 12, 2017 15:38
Process CF firehose while pushing app
package main
import (
"crypto/tls"
"fmt"
"os"
"os/exec"
"github.com/cloudfoundry/noaa/consumer"
"github.com/cloudfoundry/sonde-go/events"
@craigfurman
craigfurman / garden-unix-sockets.md
Last active August 30, 2017 14:41
Thoughts on how we use unix sockets in garden-runc.

General Notes

  1. The unix socket is executable. Let's change this.
  2. All users have read+write permissions on the socket. This has been the case for a long time. I deployed grr 1.0.0, and as expected we don't chmod the socket in our bosh release there. As far as I can see we never have.
  3. Its default path is /var/vcap/data/garden/garden.sock. This default is unchanged in typical CF deployments. The ancestor dirs in that default path
@craigfurman
craigfurman / 0001-Update-to-version-6.32.0.patch
Created October 4, 2017 17:02
bump CF CLI version in AUR package
From 5fbff5f152bc032c54dce72623d9a047e0596138 Mon Sep 17 00:00:00 2001
From: Craig Furman <[email protected]>
Date: Wed, 4 Oct 2017 18:00:13 +0100
Subject: [PATCH] Update to version 6.32.0
---
.SRCINFO | 18 ++++++++----------
PKGBUILD | 10 +++++-----
2 files changed, 13 insertions(+), 15 deletions(-)
@craigfurman
craigfurman / gotta-push-em-all.sh
Created October 16, 2017 20:59
Push all submodules, old school
#!/bin/bash
set -euo pipefail
for sub in $(git submodule | awk '{print $2}'); do
(
cd "$sub"
if git status | grep "Your branch is ahead of" >/dev/null 2>&1 ; then
git push
fi
)
@craigfurman
craigfurman / keybase.md
Created March 20, 2018 17:42
keybase proof

Keybase proof

I hereby claim:

  • I am craigfurman on github.
  • I am craigfurman (https://keybase.io/craigfurman) on keybase.
  • I have a public key ASBV_NaR1wAph0IABRagkJVrX8jKeZ_Y7QRfUSU2ii_fswo

To claim this, I am signing this object:

@craigfurman
craigfurman / postgres-pgx-distributed-lock.go
Created March 31, 2023 09:59
Example of using postgres+pgx to implement a distributed mutex in Go
package main
import (
"context"
"fmt"
"log"
"math/rand"
"os"
"time"
@craigfurman
craigfurman / host_header_test.go
Created June 23, 2023 14:56
Does golang's net/http.Client set a default Host header? Nope!
package headers
import (
"net/http"
"net/http/httptest"
"testing"
"github.com/stretchr/testify/require"
)