Skip to content

Instantly share code, notes, and snippets.

View owskio's full-sized avatar

Theodore Robert Cackowski owskio

View GitHub Profile
@owskio
owskio / AvrAssembly_VerifyStackPointerLocationAndDIrection.as
Last active March 9, 2018 05:14
Verifying the starting value of stack pointer as ram end and decrement as direction of growth
;
; Output file in intel hex format with -fI
;
; wine avrasm2.exe -fI -l test.lst test.asm and; avrdude -c usbtiny -p atmega1284 -U flash:w:test.hex
;
.nolist
.include "./m1284def.inc"
.list
@owskio
owskio / .xmodmap
Created May 30, 2016 23:50
swap caps lock and escape for evil mode in emacs
!
!https://www.emacswiki.org/emacs/MovingTheCtrlKey
!
!Swap escape and caps lock keys
! seems to work
!
! sourced in ~/.xsession with
! xmodmap ~/.xmodmap
!
remove Lock = Caps_Lock
@owskio
owskio / ArduinoBootloaderAndBlinkForAtmega328p.c
Created March 3, 2016 03:37
Now using an olimex pocket programmer, and an uninhabited arduino board as the programmer
/*
sudo avrdude -b 19200 -c avrisp2 -p m328p -P /dev/ttyACM1 \
-v -U lfuse:w:0xff:m -U hfuse:w:0xde:m -U efuse:w:0x05:m \
-U flash:w:optiboot_atmega328.hex
*/
//modified from Scott Fitzgerald's Blink, which comes with the `sudo apt-get install arduino`
void setup() {
pinMode(13, OUTPUT);
@owskio
owskio / ledBlinkSimple.c
Last active February 24, 2016 03:00
Atmel 328p AVR LED blink simple
/*
sudo avr-gcc -Wall ledBlinkSimple.c -mmcu=atmega328p -o ledBlinkSimple.o
sudo avr-objcopy -O ihex -R .eeprom ledBlinkSimple.o ledBlinkSimple.hex
sudo avrdude -p atmega328p -c avrisp2 -U flash:w:ledBlinkSimple.hex -P /dev/ttyACM0
*/
#define F_CPU 1000000UL //Tell delay.h we're running the default 1 MHz
#include <avr/io.h>
#include <util/delay.h>
@owskio
owskio / ledblink.c
Created February 23, 2016 04:56
Working with atmega16a-pu and the blue atmel 6 pin isp (the $35-$50 one) on ubuntu
@owskio
owskio / RestForFree.fsx
Last active November 9, 2015 14:39
FParsec + HttpListener + Pattern Matching = Simple 'REST'
// EXAMPLES:
//
// http://localhost:8888/people/chefs/Jimbo?eggs=2&cheese=4
// http://localhost:8888/people/chefs/Jimbo?cheese=4&eggs=2
// http://localhost:8888/people/chefs/Jimbo?cheese=4&eggs=2&bacon=5
//
// USAGE:
// C:\RestForFree>fsi restForFree.fsx
//
//Modified from: http://fsharpforfunandprofit.com/posts/concurrency-actor-model
open System
let print str = printfn "%A" str
let slowWriter msg =
msg |> String.iter (fun ch->
Threading.Thread.Sleep(1)
Console.Write ch
)
//Heavily modified from: https://www.branded3.com/blog/creating-a-simple-http-server-with-f
open System; open System.Text; open System.IO; open System.Net
//Eliminate .NET line noise
type HttpListenerResponse with
member me.Close = me.OutputStream.Close
member me.WriteAsync str = Encoding.ASCII.GetBytes(s=str) |> me.OutputStream.AsyncWrite
type Uri with
#r @"C:\GitHub\FParsec\FParsec.1.0.2\lib\net40-client\FParsecCS.dll"
#r @"C:\GitHub\FParsec\FParsec.1.0.2\lib\net40-client\FParsec.dll"
open System
open FParsec
let print s = printfn "%A" s
type kvp = { key: String; value: int}