Skip to content

Instantly share code, notes, and snippets.

View hherhold's full-sized avatar

Hollister Herhold hherhold

View GitHub Profile
@hherhold
hherhold / RealWorldHaskell_ListFuns.hs
Created February 27, 2013 11:49
Basic list functions implemented "by hand" for practice while reading "Real World Haskell".
-- Implementing basic list functions for fun and profit
import Data.List
myLength :: [a] -> Int
myLength = foldl (\acc _ -> acc + 1) 0
myLength' :: [a] -> Int
myLength' [] = 0
myLength' (x:xs) = 1 + myLength' xs
@hherhold
hherhold / ParkAssist.ino
Created February 27, 2013 12:08
Code for my Garage Parking Assistant.
// Garage Parking Assistant
// Uses Aiko event library, located at https://github.com/geekscape/Aiko
#include <AikoEvents.h>
using namespace Aiko;
// PING))) Ultrasonic Distance Sensor from Parallax.
// Uses the Ping library by Caleb Zulawski, located at http://arduino.cc/playground/Code/Ping
#include <Ping.h>
const int PingPin = 6;
@hherhold
hherhold / SliceAreaPlot.py
Last active August 6, 2019 03:43
Example module that computes and plots the cross sectional area of each visible segment. Direction of cross-section can be picked.
import os
import unittest
import vtk, qt, ctk, slicer
from slicer.ScriptedLoadableModule import *
from array import array
import logging
import vtk.util.numpy_support
import numpy as np
#
@hherhold
hherhold / FindIslandsInSizeRange.py
Created July 13, 2018 16:58
Find islands in a certain voxel size range.
original_Segment_Name = 'Segment_Name_Here'
low_island_size = 20
high_island_size = 200
#
# Switch to segment editor and pick logical effects, and get the segment to work on.
#
slicer.util.selectModule('SegmentEditor')
segmentEditorWidget = slicer.modules.segmenteditor.widgetRepresentation().self().editor
segmentEditorWidget.setActiveEffectByName("Logical operators")