Skip to content

Instantly share code, notes, and snippets.

Patch to cross compile to android with net/http support

Installation instructions

We need to patch Go's source code to allow cgo when cross-compiling and make Android-specific changes since it sometimes differs from linux (e.g.: it doesn't use /etc/resolv.conf for DNS config)

  1. Clone the go source: hg clone -u release https://code.google.com/p/go
  2. Enter the go source directory: cd go
  3. Apply the patch in this gist: patch -p1 < /path/to/patch/go_android.patch
  4. Enter the go/src directory: cd src
@akavel
akavel / rpi-as-avr-programmer.md
Last active July 4, 2023 11:33
[copy] Raspberry Pi as an AVR Programmer (by Kevin Cuzner)

Source: Kevin Cuzner's blog

Raspberry Pi as an AVR Programmer

Introduction

Recently, I got my hands on a Raspberry Pi and one of the first things I wanted to do with it was to turn it into my complete AVR development environment. As part of that I wanted to make avrdude be able to program an AVR directly from the Raspberry Pi with no programmer. I know there is this linuxgpio programmer type that was recently added, but it is so recent that it isn’t yet included in the repos and it also requires a compile-time option to enable it. I noticed that the Raspberry Pi happens to expose its SPI interface on its expansion header and so I thought to myself, “Why not use this thing instead of bitbanging GPIOs? Wouldn’t that be more efficient?” Thus, I began to decipher the avrdude code and write my addition. My hope is that things like this will allow the Raspberry Pi to be used to explo

--[[ This script automatically saves the global environment periodically
and restores it when this script is run. Recommended usage is with
the standalone Lua interpreter like this:
lua -i autosave.lua
It was coded for and tested with Eris (https://github.com/fnuecke/eris).
@akavel
akavel / piper.go
Created May 7, 2014 11:12
piping experiment for Go, by egon
// https://groups.google.com/d/msg/golang-nuts/LqDtKSpo5YY/bd5Z5xbNIVgJ
// by egon
package main
import (
"fmt"
"reflect"
)
@akavel
akavel / ast2xml.py
Created May 16, 2014 18:30
Python AST to XML (Python recipe). Converts Python ASTs to XML files for reading in other languages. http://code.activestate.com/recipes/578625-python-ast-to-xml/ Created by Ryan Gonzalez on Wed, 7 Aug 2013 (MIT) meta:license=mit
import ast, re, sys
from xml.dom import minidom
try:
from xml.etree import cElementTree as etree
except:
try:
from lxml import etree
except:
from xml.etree import ElementTree as etree
@akavel
akavel / build
Created May 21, 2014 18:26 — forked from elimisteve/build
#!/bin/bash
# This is a simple build script and will be executed on your CI system if
# available. Otherwise it will execute while your application is stopped
# before the deploy step. This script gets executed directly, so it
# could be python, php, ruby, etc.
tarball="https://go.googlecode.com/files/go1.0.3.linux-amd64.tar.gz"
# Set GOROOT since we don't use GOROOT_FINAL
mkdir -p $OPENSHIFT_HOMEDIR/app-root/data/go
@akavel
akavel / gist:ae3eae104d050208c01e
Created February 12, 2015 01:27
AkavelListGoImports.vim
function! SystemFirstLine(cmd)
" Drop CR from CR-LF sequences on Windows OS
return split(system(a:cmd), "\n")[0]
endfunction
function! AkavelListGoImports()
" Note: http://stackoverflow.com/a/6146663/98528
" and :help feature-list
if has('win32') || has('win64') || has('win16') || has('win32unix')
let pathsep = ';'
@akavel
akavel / gist:4acd7e163774f337b84a
Last active November 27, 2015 14:23
rsrc WIP
C:\prog\gopath\src\github.com\akavel\rsrc\tmp-amd64>go version
go version go1.5.1 windows/amd64
C:\prog\gopath\src\github.com\akavel\rsrc\tmp-amd64>gcc --version
gcc.exe (GCC) 4.7.0 20111220 (experimental)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
C:\prog\gopath\src\github.com\akavel\rsrc\tmp-amd64>git clone https://github.com/jhowardmsft/sql1.5.1
@akavel
akavel / luvit-bootstrap.bat
Created February 25, 2016 20:27
luvit bootstrap/build script
@echo off
:: This file (bootstrap.bat) is a helper for building "luvit.exe" and "lit.exe"
:: with pre-built "luvi.exe".
:: We require luvi.exe.
:: TODO: find out a way to auto-download it on "bare" Windows?
if not exist luvi.exe (
echo error: luvi.exe missing!
echo Please download luvi-*.exe from https://github.com/luvit/luvi/releases, then copy it here and rename to "luvi.exe".
@akavel
akavel / usage.txt
Created May 2, 2016 13:14
vendo --help
$ vendo --help
Usage:
vendo [command]
Available Commands:
check [TODO][NIY] for use as a git pre-commit hook
recreate clone third-party packages from GOPATH to _vendor/ subdirectory
update update a third-party repo in _vendor/ from the Internet (like `go get -u`)
help Help about any command