This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UFixedPoint(object): | |
def __init__(self, num, m, n): | |
self.mask = 2**(m + n) - 1 | |
self.k = (1 << (n - 1)) | |
self.m = m | |
self.n = n | |
temp = int(num * 2**self.n) | |
self.value = temp & self.mask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo "25" > /sys/class/gpio/export | |
echo "out" > /sys/class/gpio/gpio25/direction | |
echo "24" > /sys/class/gpio/export | |
echo "in" > /sys/class/gpio/gpio24/direction | |
OUTPUT="0" | |
INPUT="$(cat /sys/class/gpio/gpio24/value)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
## TOGGLE LED on a RASPBERRY PI | |
# Christopher Woodall and Thomas Nadovich | |
# June 9, 2012 | |
# | |
# Some reference material: http://elinux.org/RPi_Low-level_peripherals | |
# Done using the special made image of Debian Squeeze for the Raspberry Pi | |
# MUST BE ROOT: | |
# precede with `su -` if you trust me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MODKEY=Mod4 | |
# Colors tuples: "<text> <background> <border>" | |
WMII_NORMCOLORS='#ffffff #000000 #ffffff' | |
WMII_FOCUSCOLORS='#ffffff #555555 #ffffff' | |
WMII_BACKGROUND='#cccccc' | |
WMII_FONT='fixed' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import random | |
def generateSineTable(max_dac_val=63.0, steps_per_cycle=256): | |
sine_lut = []; | |
for r in range(0, steps_per_cycle): | |
sine_lut.append((max_dac_val/2) * (math.sin(r*2*math.pi/steps_per_cycle) + 1)) | |
return sine_lut | |
def generateTriangleWave(max_dac_val=63.0, steps_per_cycle=256): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Behavioral 3-bit Comparator | |
module comparator_3bit_behavioral(A, B, GT, LT, EQ); | |
input signed [2:0] A; | |
input signed [2:0] B; | |
output GT, LT, EQ; | |
wire signed [2:0] A, B; | |
reg GT, LT, EQ; | |
always @ (A, B) begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author :: Christopher Woodall <chris.j.woodall@gmail.com> | |
# Copyright :: 2011 Christopher Woodall | |
# License :: MIT License | |
require 'pty' | |
# run_proc(proc) runs a psuedoterminal version of a command returning output to a block | |
# asynchronously as it is produced. | |
def run_proc(proc) | |
# Spawn the PTY process |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Evaluate whether the Object is nil or empty. Makes sure it gets evaluated regardless of empty or nil. | |
# | |
# Author:: Christopher J. Woodall (mailto:chris.j.woodall@gmail.com) | |
# Copyright:: Copyright (c) 2011 Christopher J. Woodall | |
# License:: All Rights Reserverd | |
# add blank? method to Object | |
class Object | |
# Checks for nil? and empty? at once... If one fails move to the other. | |
def blank? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.center { | |
display:block; | |
} | |
.center.horizontal { margin-left: auto; margin-right: auto; } | |
.center.vertical { top:50%; margin-top:100%; } | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @author Christopher J. Woodall | |
* @date Aug 21, 2011 | |
* @license MIT License | |
* | |
* @class column | |
* @description for column based content in a class-wise fashion, useful for specifying design changes on the ly or in js | |
* | |
* | |
* @use class="float" will inherit, but class = "float right" will float to the right |