This article is now published on my website: Prefer Subshells for Context.
package main | |
import ( | |
"fmt" | |
"net" | |
"os" | |
"os/signal" | |
"time" | |
) |
package main | |
import ( | |
"context" | |
"github.com/go-redis/redis" | |
"sync" | |
"time" | |
) | |
type RedisConsumer struct { |
// Tee plus LimitWriter. | |
// LimitWriter taken from: https://github.com/kubernetes/kubernetes/blob/579e0c74c150085b3fac01f6a33b66db96922f93/pkg/kubelet/util/ioutils/ioutils.go#L39-L70 | |
// | |
package main | |
import ( | |
"bytes" | |
"flag" | |
"io" | |
"io/ioutil" |
WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
package main | |
import ( | |
"crypto/tls" | |
"golang.org/x/crypto/acme/autocert" | |
"log" | |
"net" | |
"net/http" | |
) |
There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.
All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.
- Loop variables are scoped outside the loop.
What do these lines do? Make predictions and then scroll down.
func print(pi *int) { fmt.Println(*pi) }
TL;DR: Melodics runs out-of-the-box with the current version of Bottles and its default settings. However Melodics uses your browser to handle logins, and expects your browser to be able to call the Melodics app once logged-in. Read "Melodics Desktop Integration" below to set that up.
Versions tested:
A very brief guide to Rust syntax. It assumes you are already familiar with programming concepts.
This was written in 2014. It is not a good reference for Rust today, though the content is still correct.
cheats.rs looks like a good alternative.
As configured in my dotfiles.
start new:
tmux
start new with session name: