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 / autorun.lua
Created September 6, 2012 18:48
example for writing file in looping luarpc
stm32.enc.init(3)
stm32.enc.setidxtrig(cpu.INT_GPIO_POSEDGE, pio.PB_5, 3, 32768)
local state = {}
local stime
cycletime = 20000
tdiff = 0
function control()
@jsnyder
jsnyder / hack.sh
Created April 1, 2012 00:03 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jsnyder
jsnyder / instructions.md
Created March 7, 2012 20:00
Dropbox/Google Docs/LaTeX Instructions

Dropbox + Google Docs + LaTeX

Getting Dropbox

For headless Linux servers you can install a copy of Dropbox in your home folder using the following command:

64-bit:

@jsnyder
jsnyder / mdl2d_from3d.m
Created February 9, 2012 22:51
Rectangular tunnel code for EIDORS
function [mdl2,idx2] = mdl2d_from3d(mdl3,idx3);
% set name
mdl2 = eidors_obj('fwd_model',sprintf('%s 2D',mdl3.name));
% set nodes
[bdy,idx] = find_boundary(mdl3.elems);
vtx = mdl3.nodes;
z_vtx = reshape(vtx(bdy,3), size(bdy) );
lay0 = find( all(z_vtx==0,2) );
bdy0 = bdy( lay0, :);
@jsnyder
jsnyder / call_gmsh.m
Created February 8, 2012 02:01
GMSH Meshing updates for EIDORS
function status= call_gmsh(geo_file,dim)
% call_gmsh: call Gmsh to create a vol_file from a geo_file
% status= call_netgen(geo_file, vol_file, msz_file, finelevel)
% staus = 0 -> success , negative -> failure
%
% geo_file = geometry file (input)
% vol_file = FEM mesh file (output)
% msz_file = Meshsize file in netgen format
%
% Finelevel controls the fineness of the mesh
@jsnyder
jsnyder / memcpy.c
Created January 18, 2012 22:06
newlib/libc/machine/arm/memcpy.c from CodeSourcery 2011.09 release based on newlib 1.18
/* Copyright (c) 2009 CodeSourcery, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
@jsnyder
jsnyder / calc_tankfield.m
Created November 17, 2011 23:23
Tank/Field Simulations
function calc_tankfield
global EROOT;
if ~exist('EROOT')
EROOT = alabstartup('snyd07a');
end
% Enable/Disable Features
tank = 1;
@jsnyder
jsnyder / datacapture.m
Created November 7, 2011 18:09
data acquisition setup
% ME224 Basic Data Output Script
try
stop(ai); delete(ai);
catch
end
% Settings
Fsi = 1000; % input sample rate
time_length = 1; % length of time to capture samples (seconds)
@jsnyder
jsnyder / gist:1108326
Created July 26, 2011 23:13
LLVM/Clang now builds for Cortex-M3?
~> cat test.c
int main()
{
int i = 0;
int j = 0;
for( i = 0; i < 100; i++ )
j += i;
return 1;
@jsnyder
jsnyder / dataacq_triggered_simple.m
Created June 30, 2011 01:17
Triggered sampling script
% Clear out old handles for devices
try
stop(ai)
delete(ai)
catch
end
% Settings
Fs = 1221; % Number of samples to collect per second
time_length = 60; % length of time to capture samples (seconds)