Skip to content

Instantly share code, notes, and snippets.

View jsnyder's full-sized avatar

James Snyder jsnyder

  • Minneapolis, MN
View GitHub Profile
@jsnyder
jsnyder / dataacq_trig.m
Created June 22, 2011 00:32
data_acq_triggered
% ME224 Basic Data Acquisition Script
% Clear out old handles for devices
try
stop(ai)
delete(ai)
catch
end
% Settings
@jsnyder
jsnyder / yang_dataacq.m
Created June 20, 2011 22:11
Acquire data using attached 6218 DAQ in MATLAB and plot FFT
% Clear out old handles for devices
try
stop(ai)
delete(ai)
catch
end
% Settings
Fs = 100000; % Number of samples to collect per second
time_length = 2; % length of time to capture samples (seconds)
% ME224 Basic Data Acquisition Script
% Clear out old handles for devices
try
stop(ai)
delete(ai)
catch
end
% Settings
import sys
import cv
from opencv import highgui
def detect(image):
image_size = cv.GetSize(image)
# create grayscale version
grayscale = cv.CreateImage(image_size, 8, 1)
cv.CvtColor(image, grayscale, cv.CV_BGR2GRAY)
import sys
import cv
from opencv import highgui
def detect(image):
image_size = cv.GetSize(image)
# create grayscale version
grayscale = cv.CreateImage(image_size, 8, 1)
cv.CvtColor(image, grayscale, cv.CV_BGR2GRAY)
---------------------------------------------------------------
-- Classic snake game
--
-- 2009 Led Lab @PUC-Rio www.eluaproject.net
-- Dado Sutter
-- Ives Negreiros
-- Téo Benjamin
---------------------------------------------------------------
local xMax = math.floor( 128 / 6 ) - 1
#include <mach/mach_time.h>
#include <time.h>
#include <stdio.h>
#define DUFF_DEVICE_8(aCount, aAction) \
do { \
int count_ = (aCount); \
int times_ = (count_ + 7) >> 3; \
switch (count_ & 7){ \
case 0: do { aAction; \
-- Acquire ADC samples using a timer with polling for available samples
if pd.board() == "ET-STM32" then
timer = 2
adcchannels = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}
adcsmoothing = {4, 4, 4, 4, 16, 16, 16, 16, 32, 32, 32, 32, 64, 128, 64, 128}
else
timer = 0
adcchannels = {0,1,2,3}
adcsmoothing = {4, 64, 32, 16}
@jsnyder
jsnyder / laplace.py
Created March 2, 2010 00:50
Conversion of 2D Laplace solver from http://www.scipy.org/PerformancePython to red-black Gauss-Seidel. Compares computation time with NumPy to OpenCL.
import pyopencl as cl
import numpy as np
import sys, time
class Grid:
"""A simple grid class that stores the details and solution of the
computational grid."""
def __init__(self, nx=10, ny=10, xmin=0.0, xmax=1.0,
ymin=0.0, ymax=1.0):
self.xmin, self.xmax, self.ymin, self.ymax = xmin, xmax, ymin, ymax
--- trunk.r70558/PKGBUILD 1970-01-01 03:13:08.000000000 -0600
+++ trunk.update/PKGBUILD 2010-03-01 18:36:09.377483037 -0600
@@ -27,19 +27,23 @@
mkdir -p $pkgdir/usr/{lib,bin,share/applications,share/pixmaps,share/man/man1}
mkdir -p $pkgdir/usr/lib/xorg/modules/{extensions,drivers}
- mkdir -p $pkgdir/usr/lib/vdpau
+ mkdir -p $pkgdir/usr/lib/vdpau
mkdir -p $pkgdir/usr/share/licenses/nvidia
mkdir -p $pkgdir/usr/include/cuda