Skip to content

Instantly share code, notes, and snippets.

View johnmccabe's full-sized avatar
💀

John McCabe johnmccabe

💀
View GitHub Profile
@alexellis
alexellis / FAASD_MULTIPASS.md
Last active July 31, 2021 01:50
FAASD_MULTIPASS.md
@JoeyBurzynski
JoeyBurzynski / 55-bytes-of-css.md
Last active November 4, 2024 07:33
58 bytes of css to look great nearly everywhere

58 bytes of CSS to look great nearly everywhere

When making this website, i wanted a simple, reasonable way to make it look good on most displays. Not counting any minimization techniques, the following 58 bytes worked well for me:

main {
  max-width: 38rem;
  padding: 2rem;
  margin: auto;
}
@johnmccabe
johnmccabe / timeout_buffered_error_channel.go
Created April 11, 2017 14:51
Dealing with Timeout via a buffered error channel
package main
import (
"fmt"
"log"
"time"
)
func work() error {
for i := 0; i < 1000; i++ {
@BretFisher
BretFisher / docker-for-mac.md
Last active November 8, 2024 13:45
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@taoyuan
taoyuan / npm-using-https-for-git.sh
Last active November 12, 2024 14:24
Force git to use https:// instead of git://
# npm using https for git
git config --global url."https://github.com/".insteadOf [email protected]:
git config --global url."https://".insteadOf git://
# npm using git for https
git config --global url."[email protected]:".insteadOf https://github.com/
git config --global url."git://".insteadOf https://
@julz
julz / main.go
Created November 20, 2015 12:39
containersched minicontainer
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
@mikezaccardo
mikezaccardo / same-server-entity-example.yaml
Last active November 10, 2015 14:27
SameServerEntity Example
name: "SameServerEntity Example"
location: localhost
services:
- type: org.apache.brooklyn.entity.software.base.SameServerEntity
id: parent
name: Parent Entity
children.startable.mode: background_late
brooklyn.children:
- serviceType: org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess

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.

  1. 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) }
@Integralist
Integralist / Ruby Lambdas.md
Last active August 8, 2023 05:10
Ruby lambdas

Lambda: standard

# Creating a lambda
l = lambda { |name| "Hi #{name}!" }

# Executing the lambda
l.call("foo") # => Hi foo!