Skip to content

Instantly share code, notes, and snippets.

View kyleconroy's full-sized avatar
⌨️
Developing sqlc

Kyle Gray kyleconroy

⌨️
Developing sqlc
View GitHub Profile
@kyleconroy
kyleconroy / render.sh
Last active September 13, 2016 05:40
Bash templating made easy (Only works on Linux)
#!/bin/bash
export FOO=foo
export BAR=bar
envsubst < template.txt > output.txt
local Gamestate = require 'vendor/gamestate'
local Prompt = require 'prompt'
local Timer = require 'vendor/timer'
local hiddendoortrigger = {}
hiddendoortrigger.__index = hiddendoortrigger
-- Nodes with 'isInteractive' are nodes which the player can interact with, but not pick up in any way
hiddendoortrigger.isInteractive = true
function hiddendoortrigger.new(node, collider)
@kyleconroy
kyleconroy / linux.sh
Last active December 28, 2015 22:39
Install dependencies for Love2D
sudo apt-get install mercurial autoconf libtool make libopenal-dev build-essential pkg-config
sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev
sudo apt-get install libopenal0a libopenal-dev
sudo apt-get install libdevil1c2 libdevil-dev
sudo apt-get install freetype*
sudo apt-get install mpg123 libmpg123-dev
sudo apt-get install lua5.1 liblua5.1-0-dev
sudo apt-get install libvorbis-dev
sudo apt-get install xmms2-plugin-modplug modplug-tools libmodplug-dev libmodplug1
sudo apt-get install libenet-dev libphysfs-dev

Keybase proof

I hereby claim:

  • I am kyleconroy on github.
  • I am conroy (https://keybase.io/conroy) on keybase.
  • I have a public key whose fingerprint is AFA2 924D 91A7 9620 3E4C F58A BA7A CAFD 92B7 3D02

To claim this, I am signing this object:

// SetBPFFilter compiles and sets a BPF filter for the pcap handle.
func (p *Handle) SetBPFFilter(expr string) (err error) {
p.activate.Do(p.activation)
var bpf _Ctype_struct_bpf_program
cexpr := C.CString(expr)
defer C.free(unsafe.Pointer(cexpr))
if -1 == C.pcap_compile(p.cptr, &bpf, cexpr, 1, 0) {
return p.Error()
}

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

@kyleconroy
kyleconroy / gist:9524282
Created March 13, 2014 08:25
crosstool-ng go build output
> CC=x86_64-build_unknown-linux-gnu-gcc GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 /usr/local/go/pkg/tool/linux_amd64/6l -o cgoecho -L $WORK -v -extld= $WORK/_/mnt/crosstool-ng/cgoecho.a
HEADER = -H12 -T0x2000 -D0x0 -R0x1000
searching for runtime.a in /tmp/go-build397666235/runtime.a
searching for runtime.a in /usr/local/go/pkg/darwin_amd64/runtime.a
0.08 deadcode
0.10 mkfwd
0.10 patch
0.10 follow
0.10 span
0.14 pclntab=269152 bytes, funcdata total 20164 bytes
package main
import (
"fmt"
"github.com/kyleconroy/soup"
)
func main() {
doc := soup.NewSoup(reader)
@kyleconroy
kyleconroy / CMakeError.log
Last active August 29, 2015 14:02
OpenRCT2 Notes
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: i586-mingw32-gcc
Build flags: -masm=intel;-std=gnu99;-fpack-struct=2
Id flags:
The output was:
No such file or directory
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.