Skip to content

Instantly share code, notes, and snippets.

View kblomqvist's full-sized avatar

Kim Blomqvist kblomqvist

View GitHub Profile
@kblomqvist
kblomqvist / docopt.c
Last active December 15, 2015 10:29
Brainstorming the look of docopt.c struct
typedef struct {
/* flag options */
int h;
int help;
int moored;
int version;
/* options with arguments */
char *speed;
@kblomqvist
kblomqvist / fixhudson.py
Created November 17, 2012 21:55
Fix AVR Hudson problem
"""
https://gist.github.com/4100575
Usage: python fixhudson.py [path_to_avrtoolchain]
"""
import os
import subprocess
def which(executable):
""" Mimics Linux / Unix Command: which """
@kblomqvist
kblomqvist / avr32-gpp.definitions.list
Created August 19, 2012 14:31
avr32-g++'s #definitions
$ touch empty.c
$ avr32-g++ -mpart=uc3a1128 -E -dM empty.c
#define __DBL_MIN_EXP__ (-1021)
#define __FLT_MIN__ 1.17549435e-38F
#define __CHAR_BIT__ 8
#define __WCHAR_MAX__ 2147483647
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
#define __FLT_EVAL_METHOD__ 0
@kblomqvist
kblomqvist / main.cpp
Created August 1, 2012 22:21
Writing flash with Aery32 (debugging with display)
#include <cstring>
#include "board.h"
#include <aery32/all.h>
using namespace aery;
// ----------------------------------------------------------------------
// HD44780 instruction set
// ----------------------------------------------------------------------
#define HD44780_CLEAR_DISPLAY 0x01
@kblomqvist
kblomqvist / lufaery.lst
Created July 29, 2012 13:02
Aery32+LUFA, working build LSS and MAP
lufaery32.elf: file format elf32-avr32
Sections:
Idx Name Size VMA LMA File off Algn
0 .reset 00000008 80002000 80002000 00000400 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rela.got 00000000 80002008 80002008 00000408 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .init 0000001c 80002008 80002008 00000408 2**2
lufaery32.elf: file format elf32-avr32
Sections:
Idx Name Size VMA LMA File off Algn
0 .reset 00000008 80002000 80002000 00000400 2**2
CONTENTS, ALLOC, LOAD, READONLY, CODE
1 .rela.got 00000000 80002008 80002008 00000408 2**2
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .init 0000001c 80002008 80002008 00000408 2**2
@kblomqvist
kblomqvist / main.cpp
Created July 1, 2012 10:54
Analog-to-digital conversion with Aery32. Conversion result shown on display.
#include "board.h"
#include <aery32/all.h>
using namespace aery;
// ----------------------------------------------------------------------
// HD44780 instruction set
// ----------------------------------------------------------------------
#define HD44780_CLEAR_DISPLAY 0x01
#define HD44780_RETURN_HOME 0x02
@kblomqvist
kblomqvist / aery32_hd44780_puts.cpp
Created May 27, 2012 20:11
Putting strings to the HD44780 type display with Aery32
#include "board.h"
#include <aery32/gpio.h>
#include <aery32/spi.h>
#include <aery32/delay.h>
using namespace aery;
// ----------------------------------------------------------------------
// HD44780 instruction set
// ----------------------------------------------------------------------
@kblomqvist
kblomqvist / installyesod.sh
Last active October 3, 2015 00:18
Setting up Yesod 1.0 from scratch (Debian 6 64-bit)
cd ~/Downloads
# Download GHC 7.0.4 binary (take care of the platform, my was Debian 6 64-bit)
wget http://www.haskell.org/ghc/dist/7.0.4/ghc-7.0.4-x86_64-unknown-linux.tar.bz2
# Download Haskell-platform
wget http://lambda.haskell.org/platform/download/2011.4.0.0/haskell-platform-2011.4.0.0.tar.gz
# Unzip both
tar xvf ghc-7.0.4-x86_64-unknown-linux.tar.bz2
@kblomqvist
kblomqvist / gist:2323121
Created April 6, 2012 21:35
Linux timezones
date +%Z # Check the current timezone
cat /etc/timezone # Current timezone in Area/Location format
sudo dpkg-reconfigure tzdata # Change timezone