Skip to content

Instantly share code, notes, and snippets.

View freeformz's full-sized avatar

Edward Muller freeformz

View GitHub Profile
  1. General Background and Overview
@freeformz
freeformz / WhyILikeGo.md
Last active October 6, 2022 23:31
Why I Like Go

A slightly updated version of this doc is here on my website.

Why I Like Go

I visited with PagerDuty yesterday for a little Friday beer and pizza. While there I got started talking about Go. I was asked by Alex, their CEO, why I liked it. Several other people have asked me the same question recently, so I figured it was worth posting.

Goroutines

The first 1/2 of Go's concurrency story. Lightweight, concurrent function execution. You can spawn tons of these if needed and the Go runtime multiplexes them onto the configured number of CPUs/Threads as needed. They start with a super small stack that can grow (and shrink) via dynamic allocation (and freeing). They are as simple as go f(x), where f() is a function.

@freeformz
freeformz / gist:3107457
Created July 13, 2012 21:08
My GoTour Exercise #44 (http://tour.golang.org/#44) solution
package main
import (
"fmt"
"math"
)
func sqrt(target, guess float64) float64 {
return guess - (math.Pow(guess, 2)-target)/(2*guess)
}

Restaurants

import json
import platform
import subprocess
__metaclass__ = type
DOCUMENTATION = """
name: tailscale
plugin_type: inventory
short_description: Tailscale Inventory Source
@freeformz
freeformz / 2019_top_100_tasting_wine_and_spirits.md
Last active September 20, 2019 17:15
2019 Wine & Spirit Top 100 Tasting OR
@freeformz
freeformz / gist:4552031
Last active August 5, 2017 20:18
statvfs (cgo)
package main
// build +cgo
import (
"fmt"
"os"
"unsafe"
)
00096 (main.go:21) TEXT "".nooops(SB)
00097 (main.go:21) FUNCDATA $0, "".gcargs·4(SB)
00098 (main.go:21) FUNCDATA $1, "".gclocals·5(SB)
00099 (main.go:21) TYPE s(FP), type.[]int(SB)
00100 (main.go:21) TYPE .autotmp_14-8(SP), type.*int(SB)
00101 (main.go:21) TYPE .autotmp_13-16(SP), type.int(SB)
00102 (main.go:21) TYPE v-24(SP), type.int(SB)
00103 (main.go:22) MOVQ $0, AX // AX = 0
00104 (main.go:22) MOVQ "".s(FP), CX // CX = pointer to first value in array
00105 (main.go:22) MOVQ AX, ""..autotmp_13-16(SP) // autotmp_13 = 0
00135 (main.go:29) TEXT "".oopsy(SB)
00136 (main.go:29) FUNCDATA $0, "".gcargs·6(SB)
00137 (main.go:29) FUNCDATA $1, "".gclocals·7(SB)
00138 (main.go:29) TYPE s(FP), type.[]int(SB)
00139 (main.go:29) TYPE .autotmp_18-8(SP), type.int(SB)
00140 (main.go:29) TYPE i-16(SP), type.int(SB)
00141 (main.go:30) MOVQ $0, AX // AX = 0
00142 (main.go:34) MOVQ "".s+8(FP), CX // CX = 6 (len of the slice)
00143 (main.go:30) MOVQ AX, "".i-16(SP) // i = 0
00144 (main.go:34) MOVQ CX, ""..autotmp_18-8(SP) // autotmp_18 = 6
# func(string, string) (bool, error) does not implement testing.testDeps (missing MatchString method)