Skip to content

Instantly share code, notes, and snippets.

@four0four
four0four / c8051_SDCC.h
Created August 24, 2014 21:51
Modified c8051_SDCC.h
View c8051_SDCC.h
//-----------------------------------------------------------------------------
// This file is for use in Embedded Control when using the SDCC compiler
//
// Directions:
//
// This file should be saved to the following directory on your laptop:
// C:\Program Files\SDCC\include\mcs51
// Save as c8051_SDCC.h
//
// In your program, you need to include this header file as #include <c8051_SDCC.h>
@four0four
four0four / keybase.md
Created October 27, 2014 01:43
Keybase Verification
View keybase.md

Keybase proof

I hereby claim:

  • I am four0four on github.
  • I am four0four (https://keybase.io/four0four) on keybase.
  • I have a public key whose fingerprint is 6920 2A52 483C 3974 7EEB 64D7 8343 5753 3862 EFD9

To claim this, I am signing this object:

@four0four
four0four / networkClasses.py
Created July 20, 2012 20:32
takes either a subnet (w.x.y.z/16) or an ip/netmask combination (w.x.y.z, 255.255.0.0) and provides all the rest. mostly useful for scripts, not people.
View networkClasses.py
#http://wiki.python.org/moin/BitManipulation
def countBits(int_type):
count = 0
while(int_type):
int_type &= int_type - 1
count += 1
return(count)
class Subnet:
@four0four
four0four / test.networkClasses.py
Created July 24, 2012 16:23
Simple test "framework" for the networkClasses module/hackery
View test.networkClasses.py
#!/usr/bin/python2
import networkClasses
test = networkClasses.Subnet("192.168.0.1","255.255.0.0")
#test = networkClasses.Subnet("192.168.0.1/16")
print ".toIPaddress(): " + str(test.toIPaddress())
print ".toBroadcast(): " + str(test.toBroadcast())
print ".toNetmask(): " + str(test.toNetmask())
print ".toSubnet(): " + str(test.toSubnet())
@four0four
four0four / Makefile
Last active November 16, 2015 06:26
Example C8051/ec2-drv project
View Makefile
PROGRAM=hw1
SOURCES=$(PROGRAM).c
# you should probably redefine this with an absolute path, if possible
INCLUDE=../headers
CC=sdcc
PORT="USB"
TARGET="SL51"
GDB=newcdb
all: $(PROGRAM).ihx flash run
@four0four
four0four / PKGBUILD
Last active November 16, 2015 06:29
ec2drv PKGBUILD
View PKGBUILD
# Maintainer: Galen Schretlen <galen@shellspace.net>
pkgname=ec2drv-git
pkgdesc="ec2drv provides Linux support for the Silicon Laboritories EC2 serial debug adaptor."
_sourcename="ec2"
pkgrel=1
pkgver=86ffac6
arch=('i686' 'x86_64')
url="https://github.com/four0four/ec2"
license=('GPL')
depends=('python2' 'boost-libs' 'readline' 'libusb')
@four0four
four0four / mega324
Last active December 9, 2015 23:08
couple AVR UART examples
View mega324
/*
* mega324_UART.c
*
* Created: 12/28/2011 10:39:01 PM
* Author: Galen
*/
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/power.h>
@four0four
four0four / auto-patch.py
Last active January 15, 2016 13:12
EagleCAD 7.5.0 patcher script
View auto-patch.py
#!/usr/bin/python2
import sys
import md5
if len(sys.argv) < 2:
print "Usage: " + sys.argv[0] + " [eagle 7.5.0 binary]\nWindows patches will be applied if .exe"
sys.exit()
# offsets
@four0four
four0four / bfcpu.v
Created May 16, 2016 21:30
terribad BFCPU
View bfcpu.v
/* 8 bit brainfuck cpu
** Author's note: This is a really bad processor. It does all sorts of stupid/bad things in the aim of brainfucking hardware.
** codeMem -> 3 bit wire, input opcodes from code memory
** codeAddr -> 8 bit address, current pc (usually)
** dataMem -> 8 bit read/write to the working array
** dataAddr -> 8 bit address to working array
** !USE READ FIRST!
*/
@four0four
four0four / urjtag-python3fix.patch
Created December 15, 2019 00:28
Patch to fix up urjtag python3 support
View urjtag-python3fix.patch
diff -Naur urjtag-2018.09.orig/bindings/python/chain.c urjtag-2018.09/bindings/python/chain.c
--- urjtag-2018.09.orig/bindings/python/chain.c 2018-09-25 14:32:40.583308869 -0700
+++ urjtag-2018.09/bindings/python/chain.c 2018-09-25 14:33:31.924518776 -0700
@@ -243,7 +243,7 @@
urj_pyc_partid (urj_pychain_t *self, PyObject *args)
{
urj_chain_t *urc = self->urchain;
- int partno;
+ unsigned int partno;
if (!PyArg_ParseTuple (args, "i", &partno))