Skip to content

Instantly share code, notes, and snippets.

View bakkerpeter's full-sized avatar

Peter Bakker bakkerpeter

  • Groningen, The Netherlands
View GitHub Profile
@pdecat
pdecat / gcs-signed-url-main.go
Created January 31, 2020 17:39
Creating a GCS Signed URL without a Service Account Key from a GCE instance or a GKE Pod using Workload Identity
package main
import (
"context"
"flag"
"log"
"net/url"
"time"
"cloud.google.com/go/compute/metadata"
@CJEnright
CJEnright / gzip.go
Last active December 19, 2023 19:40
Idiomatic golang net/http gzip transparent compression, an updated version of https://gist.github.com/bryfry/09a650eb8aac0fb76c24
package main
import (
"net/http"
"compress/gzip"
"io/ioutil"
"strings"
"sync"
"io"
)
@grav
grav / render.js
Created June 25, 2017 18:47
Save a dynamically rendered page with Chrome Headless browser
// Needs a running Chrome Headless, eg:
// /Applications/Google\ Chrome\ Canary.app/Contents/MacOS/Google\ Chrome\ Canary --headless --remote-debugging-port=9222 https://chromium.org
// Run with node, eg `node render.js output.html`
const CDP = require('chrome-remote-interface');
const fs = require('fs')
CDP((client) => {
// Extract used DevTools domains.
const {Page, Runtime} = client;
@ismasan
ismasan / sse.go
Last active March 19, 2024 18:13
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@ogrrd
ogrrd / dnsmasq OS X.md
Last active May 14, 2024 08:39
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install