Skip to content

Instantly share code, notes, and snippets.

@hichihara
hichihara / exec.go
Created May 31, 2018 06:10
Golang exec command unit test
package main
import (
"fmt"
"os/exec"
"strconv"
"strings"
)
var execCommand = exec.Command
@ego008
ego008 / multiple-host-reverse-proxy.go
Last active September 20, 2024 09:14
Multiple host reverse proxy in Go
package main
import (
"log"
"net/http"
"net/http/httputil"
"net/url"
)
var (
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active February 27, 2025 22:16
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux
@ldez
ldez / gmail-github-filters.md
Last active January 10, 2025 15:41
Gmail and GitHub - Filters

Gmail and GitHub

How to filter emails from GitHub in Gmail and flag them with labels.

The labels in this document are just examples.

Pull Request

Filter Label
@so0k
so0k / kubectl.md
Last active February 4, 2025 17:16
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
@ngauthier
ngauthier / timeout_and_tick.go
Created February 10, 2015 18:14
Golang timeout and tick loop
// keepDoingSomething will keep trying to doSomething() until either
// we get a result from doSomething() or the timeout expires
func keepDoingSomething() (bool, error) {
timeout := time.After(5 * time.Second)
tick := time.Tick(500 * time.Millisecond)
// Keep trying until we're timed out or got a result or got an error
for {
select {
// Got a timeout! fail with a timeout error
case <-timeout: