Skip to content

Instantly share code, notes, and snippets.

View BobBurns's full-sized avatar

Bob Burns BobBurns

  • Santa Cruz, CA
View GitHub Profile
@BobBurns
BobBurns / helloInterrupt.asm
Created November 22, 2014 19:50
AVR Interrupts. Assembly version of Elliot Williams helloInterrupts.c
;Interrupt 0 Example
; Flashes LED0 at a fixed rate, interrupting whenever button is pressed
;
.device atmega 168
.def temp = r16
.def temp2 = r17
.org 0
;
;Interrupt Vector Table
jmp reset
@BobBurns
BobBurns / lfsr.c
Created January 8, 2016 00:40
Linear feed shift register in C with 8 bits
#include <stdio.h>
#include <stdlib.h>
#define STREAM (256 * 8)
/* short program to understand linear feed shift register
* and its use in stream ciphers.
*/
int
@BobBurns
BobBurns / debouncer.asm
Created November 20, 2014 00:27
AVR Assembly simple debouncer
;example program using debouncing
;from AVR Programming by Elliot Williams p.115
;
;compile with gavrasm debouncer.asm
;flash with avrdude -c avrisp -p m168 -P /dev/tty.usbmodem1411 -b 19200 -U flash:w:debouncer.hex
;
.def temp = r16
.device atmega168
;--- inits ---
.def b_pressed = r17
@BobBurns
BobBurns / blinky.s
Created July 31, 2015 16:45
blink led on stm32 L1 Discovery with ARM assembly
@ lets try to blink an LED on the discovery stm32 L1 board
@ uses LED on PB7
@ how to compile and flash:
@ arm-none-eabi-as -mcpu=cortex-m3 blinky.s -o blinky.o
@ arm-none-eabi-ld -v -T stm32.ld -nostartfiles -o blinky.elf blinky.o
@ arm-none-eabi-objcopy -O binary blinky.elf blinky.bin
@ then from st-link (https://github.com/texane/stlink)
@ ./st-flash write ../first_arm/blinky.bin 0x08000000
.thumb
@BobBurns
BobBurns / check-zpool.go
Created May 28, 2021 15:11
prometheus zpool check freebsd
package main
import (
"fmt"
"log"
"os/exec"
"bufio"
"strings"
"net/http"
"time"
@BobBurns
BobBurns / prom-serve.go
Created February 23, 2021 19:25
prometheus-disk-usage-exporter
package main
import (
"fmt"
"log"
"os/exec"
"bufio"
"strings"
"strconv"
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/time.h>
#include <net/bpf.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@BobBurns
BobBurns / bpf-fun-1.c
Created January 3, 2021 19:30
BPF filter machine 1
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/time.h>
#include <net/bpf.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#!/usr/bin/perl -w
# Author: Mark Foster
# (c) 2009 Credentia http://www.credentia.cc/
# $Id: check_zone.pl 104 2009-04-13 10:04:51Z mdf $
# Based on zonechk.pl, this script is a nagios plugin
#
# BUGS
# Not known
#
# TO DO
@BobBurns
BobBurns / cwtest.go
Last active January 1, 2018 23:51
Example of pushing disk and cpu metrics to AWS Cloudwatch
/* quick and dirty code to play around pushing
* aws metrics to cloudwatch
*/
package main
import (
"bufio"
"time"
"fmt"