Skip to content

Instantly share code, notes, and snippets.

@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

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 / go-cmd.bat
Created November 6, 2013 11:42
go-cmd.bat
@echo off
setlocal
:: EXAMPLE:
:: set GOPATH=c:\gopath1;c:\gopath2
:::::::: meat ::::::::
set GOROOT=%~dp0
@akavel
akavel / results.txt
Created August 20, 2013 18:42
convert codepage win1252 to utf8
0x00 0x0000 []byte{0x0}
0x01 0x0001 []byte{0x1}
0x02 0x0002 []byte{0x2}
0x03 0x0003 []byte{0x3}
0x04 0x0004 []byte{0x4}
0x05 0x0005 []byte{0x5}
0x06 0x0006 []byte{0x6}
0x07 0x0007 []byte{0x7}
0x08 0x0008 []byte{0x8}
0x09 0x0009 []byte{0x9}
function throbber()
{
local rs="${1-\n}"
gawk '
BEGIN {RS="'"$rs"'"; ORS=RS; s="/-\\|"}
{print $0}
NR%100==0 {printf(substr(s,(NR/100)%4+1,1)"\b") > "/dev/stderr"}
NR%1000==0 {printf(".") > "/dev/stderr"}
END{print "" > "/dev/stderr"}
'
@akavel
akavel / git.bat
Last active December 14, 2015 14:39
pseudo-"git", using Mercurial + hg-git plugin to cheat on "go get"
@echo off
:: Homepage: https://gist.github.com/akavel/5102393
:: Author: (c) 2013 by Mateusz Czaplinski
:: License: MIT/X11
if "%1"=="clone" goto :clone
if "%1"=="show-ref" goto :showref
if "%1"=="checkout" goto :checkout
goto :unknown
:clone
@akavel
akavel / mg.bat
Last active October 10, 2015 15:47
mg - Tool for easy building Go (http://golang.org) programs out of the main $GOPATH tree (Windows variant). DOWNLOAD: https://gist.github.com/raw/3713260/mg.bat
@echo off
:: "Make Go" v1.06 2013-02-22
:: Tool for easy building Go (http://golang.org) programs out of the
:: main %GOPATH% tree.
:: SOURCE: https://gist.github.com/3713260
::
:: TODO:
:: - add subcommands, especially: install, clean (rmdir /q /s _gopath)
:: - add info that when importing, you must prefix with current dir name
:: OTHER IDEAS:
@akavel
akavel / ascii-table.lua
Created March 14, 2012 17:49
Print ASCII table (using Lua)
-- compact/one-line form (note: all strings in '', so you can run it with: lua -e "..." )
s=' 01234567 89abcdef\n' for y=0,0xf0,0x10 do s=s..('%02x '):format(y) for x=0,0xf do s=s..string.char(y+x):gsub('%c','.') if x==7 then s=s..' ' end end s=s..(' %02x\n'):format(y) end print(s)
-- expanded/pretty-printed form
s=' 01234567 89abcdef\n'
for y=0,0xf0,0x10 do
s=s..('%02x '):format(y)
for x=0,0xf do
s=s..string.char(y+x):gsub('%c','.')
if x==7 then
@akavel
akavel / lua+parser.min.js
Last active September 30, 2015 18:07
Dump of a lua+parser.min.js file from mherkender/lua.js repository
/*
Copyright 2011 Maximilian Herkender
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software