Skip to content

Instantly share code, notes, and snippets.

View jpace121's full-sized avatar

jpace121

View GitHub Profile
apple-gcc42
arping
aspell
aspell-dict-en
autoconf
automake
avr-gcc
avr-libc
avrdude
boost
@jpace121
jpace121 / thread_fun.cpp
Created May 24, 2016 02:34
Fun with c++11 threads.
#include <string>
#include <thread>
#include <iostream>
using namespace std;
void test(int input, int cnt)
{
for(int i = 0; i < cnt; i++)
{
% Find the mean values of the plateaus of a curve a.
% Does this by finding the peaks of a and then looking for when the
% values drop by a certain slope look ahead points away.
clear all;
a = [1 1 1 1 2 2 2 3 4 5 6 7 8 8 7 6 7 7 6 4 2 2 2 1 1 1];
a = [a a a a];
thresh = 1; % tuning parameter. How much can I drop in plateau?
look_ahead = 2; % tuning parameter. How far should I look to see if
#!/usr/bin/env python
import random as rand
def main():
# randomly orders the items in list. Good for experiments, where order
# may be compounding results.
rand.seed()
soils = ['sand','sand', 'clay', 'clay', 'midden', 'midden', 'sandy clay',
'sandy clay', 'top soil', 'top soil']
Option Explicit
' constants so we can refer to columns as names
Public Const range_vals_t = "A"
Public Const range_vals_d = "B"
Public Const donut_vals_t = "C"
Public Const donut_vals_d = "D"
Public Const cone_vals_t = "E"
Public Const cone_vals_d = "F"
/https://danielkeep.github.io/practical-intro-to-macros.html
macro_rules! add {
($typ:ty) => {{
struct tmp
{
x:$typ
}
tmp { x:2 }
}}
@jpace121
jpace121 / norrowShocase.rs
Last active August 29, 2015 14:24
Some random stuff I tried when I realized I hadn't written any rust in a while...
use std::fmt;
struct Meter(u32);
impl fmt::Display for Meter{
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,"{}",self.0)
}
}
@jpace121
jpace121 / spidev.py
Created June 22, 2015 21:33
Fake SpiDev class for use on laptop.
class SpiDev(object):
def open(self,a,b):
pass
def close(self):
pass
def xfer2(self,input):
return [0b00000000,0b00001010,0b10101010]
@jpace121
jpace121 / inheritance.py
Created June 22, 2015 21:08
Python Inheritance Example
class Test(object):
def __init__(self,a,b):
self.a = a
self.b = b
def add(self):
return self.a + self.b
class TestInherited(Test):
def __init__(self):
/*
* Copyright (C) 2013 CircuitCo
*
* Virtual cape for SPI0 on connector pins P9.22 P9.21 P9.18 P9.17
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
/dts-v1/;