Skip to content

Instantly share code, notes, and snippets.

View mattetti's full-sized avatar

Matt Aimonetti mattetti

View GitHub Profile
@macournoyer
macournoyer / Dockerfile
Last active December 14, 2019 16:31
Playing w/ Dockerfile on OS X
FROM base
MAINTAINER Marc-Andre Cournoyer "macournoyer@gmail.com"
RUN apt-get -y update
RUN apt-get install -y -q curl
RUN curl -L https://get.rvm.io | bash -s stable --ruby
RUN /bin/bash -l -c rvm requirements
package backup_downloader
import (
"bytes"
"io"
"log"
"os"
"os/exec"
"sync"
)
@fujin
fujin / gist:6094233
Last active December 20, 2015 07:38
thoughtworks go-server / go-agent powered with @dot_cloud Docker
ubuntu@continubus:~/dockerfiles/go-agent$ docker ps
ID IMAGE COMMAND CREATED STATUS PORTS
d89f44c4df5b fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
a132f54a0442 fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
da8b513fbb2a fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
c100df11f9d7 fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
929adf4cbc3b fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
79720ed86e0b fujin/go-agent:latest /bin/sh -c /start.sh About a minute ago Up About a minute
ca9403fe93e2 fujin/go-agent:latest /b
$ ROLE=$(curl http://169.254.169.254/latest/meta-data/iam/security-credentials/)
$ curl http://169.254.169.254/latest/meta-data/iam/security-credentials/$ROLE
BEFORE:
sam@ubuntu discourse % rm -fr tmp/cache
sam@ubuntu discourse % rm -fr public/assets
sam@ubuntu discourse % time RAILS_ENV=production bin/rake assets:precompile
58.55s user 1.79s system 100% cpu 1:00.02 total
AFTER:
@avdi
avdi / gist:9038972
Created February 16, 2014 19:00
Get syntax highlighted source code for pasting into e.g. Google Docs on Linux
# You will need the pygments and xclip packages
# This example highlights some Bash source code
# '-O noclasses=true' tells pygments to embed colors inline in the source
# the '-t text/html' option tells xclip what "target" to specify for the selection
pygmentize -l bash -f html -O noclasses=true mysource.sh | xclip -selection clipboard -t text/html
@bradleypeabody
bradleypeabody / gist:185b1d7ed6c0c2ab6cec
Last active November 29, 2023 22:08
golang, convert UTF-16 to UTF-8 string
package main
// http://play.golang.org/p/fVf7duRtdH
import "fmt"
import "unicode/utf16"
import "unicode/utf8"
import "bytes"
func main() {
@zankich
zankich / 01-getting_started.md
Last active May 2, 2019 01:42
Gophercon getting started with Gobot

First go to the Gobot Intel Edison Readme (https://github.com/hybridgroup/gobot/tree/master/platforms/intel-iot/edison#how-to-install) and follow the getting started guide. Your Edison has already been updated to the latest firmware version,
so you can skip that part! You will not need to download the Intel XDK, you only need to go through the steps detailing how to connect through the serial interface and then configure your edison.

Find the box called "Base Shield" and open that up and place the grove "Base Shield" onto your Intel Edison. This will allow you to use the Grove connectors shields and cables!

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

@nathan-osman
nathan-osman / win32.go
Last active May 14, 2024 14:18
Simple Windows GUI application written in Go
package main
import (
"log"
"syscall"
"unsafe"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")