Skip to content

Instantly share code, notes, and snippets.

View mattetti's full-sized avatar

Matt Aimonetti mattetti

View GitHub Profile
+----------------------------------------------+
| |
| +----------------------+ +------------+ |
+---------------+ +--------------------+ | | | | | |
| | | +----->| 1 0 1 1 1 0 0 1 0 1 0+-->| Processing | |
| +-------->+ | | | | | | |
| Voice | | Analog to Digital | | | 0 1 1 0 0 1 0 1 1 0 1|<--+ | |
| | | |<-----+ | | | |
+---------------+ +-------+------------+ | +----------------------+ +------------+ |
| | |
{
/*
// Place your snippets for Go here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
// example of parallelism
package main
import (
"flag"
"fmt"
"io"
"os"
"sync"
"time"
--- FAIL: TestCmdGoNoHTTPServer (0.11s)
http_test.go:87: cmd/go unexpectedly links in HTTP server code; found symbol "net/http.http2Server" in cmd/go
http_test.go:87: cmd/go unexpectedly links in HTTP server code; found symbol "net/http.(*Server).Serve" in cmd/go
http_test.go:87: cmd/go unexpectedly links in HTTP server code; found symbol "net/http.(*ServeMux).ServeHTTP" in cmd/go
http_test.go:87: cmd/go unexpectedly links in HTTP server code; found symbol "net/http.DefaultServeMux" in cmd/go
FAIL
FAIL net/http 9.664s
@mattetti
mattetti / go.json
Created April 7, 2016 22:20
VSCode custom settings - nothing fancy really
"test case": {
"prefix": "test",
"body": [
"func Test_$1(t *testing.T) {",
" testCases := []struct {",
" input string",
" output string",
" }{",
" {\"\",\"\"},",
" }",
@mattetti
mattetti / CGO.md
Created September 25, 2015 14:23 — forked from dwbuiten/CGO.md

Problems & Solutions for Interaction Between C and Go

At Vimeo, on the transcoding team, we work a lot with Go, and a lot with C, for various tasks such as media ingest. This means we use CGO quite extensively, and consequently, have run into bits that are perhaps not very well documented, if at all. Below is my effort to document some of the problems we've run into, and how we fixed or worked around them.

Many of these are obviously wrong in retrospect, but hindsight is 20/20, and these problems do exist in many codebases currently.

Some are definitely ugly, and I much welcome better solutions! Tweet me at @daemon404 if you have any, or have your own CGO story/tips, please! I'd love to learn of them.

Table of Contents

@mattetti
mattetti / morning.playlist.itunes.plist
Created September 2, 2015 06:17
launch agent to start an app (wakeup.app) every day of the work week at 5:55am
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>morning.playlist.itunes</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/open</string>
<string>-a</string>
@mattetti
mattetti / morning.scpt
Created September 2, 2015 06:00
JXA (JS) automation script to play the "morning" playlist, only works on recent versions of OS X
app = Application('iTunes')
app.activate()
app.stop()
playlist = app.sources["Library"].userPlaylists["morning"]
try {
playlist.play()
}
catch(err) {
console.log("The playlist probably doesn't exist", err)
}
package main
import "fmt"
func main() {
type key struct {
door string
}
keys := []key{key{door: "x"}, key{door: "y"}, key{door: "z"}}
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #