Skip to content

Instantly share code, notes, and snippets.

View NickCrews's full-sized avatar

Nick Crews NickCrews

View GitHub Profile
function filtered = gaussianFilter(img, sigma, varargin)
% GAUSSIANFILTER Simplified open-source version of IMGAUSSFILT
% The IMGAUSSFILT function is part of the Image Processing Toolbox,
% but if you don't want to install that, then use this
% instead. I haven't actually tested this to ensure it gives the same result.
% Inspired by https://stackoverflow.com/questions/13193248/how-to-make-a-gaussian-filter-in-matlab
%
% Hardcodes in the default arguments of IMGAUSSFILT
% (per https://www.mathworks.com/help/images/ref/imgaussfilt.html)
@NickCrews
NickCrews / telem_test.py
Last active May 31, 2019 17:34
Test script to write a telemetry command and read a response from the Wilco EC
#!/usr/bin/python
# https://gist.github.com/NickCrews/52ab07c8519b56c0ec671d3338760516
import os, glob
def test(bytes):
fname = glob.glob("/dev/wilco_telem*")[0]
fd = None
@NickCrews
NickCrews / test_event_v3.py
Created February 20, 2019 00:05
Call poll() and read() on the char device node that provides events from the Wilco EC
#!/usr/bin/python │ CC firmware/2lib/2secdatak.o
│ CC firmware/2lib/2sha1.o
import select, os, glob │ CC firmware/2lib/2sha256.o
│ CC firmware/2lib/2sha512.o
fname = glob.glob("/dev/wilco_event*")[0] │ CC firmware/2lib/2sha_utility.o
│ CC firmware/2lib/2tpm_boot
@NickCrews
NickCrews / test_event_v2.py
Last active February 7, 2019 17:48
Call poll() and read() on the char device node that provides events from the Wilco EC
#!/usr/bin/python
import select, array, os
fname = "/dev/wilco_event"
with open(fname, "r+") as fd:
p = select.poll()
p.register(fd.fileno(), select.POLLIN)
events = p.poll(100)
@NickCrews
NickCrews / test_event.py
Created February 4, 2019 22:55
Test for Wilco EC Event notification
#!/usr/bin/python
import select, array, fcntl
fname = '/dev/wilco_ec'
with open(fname, "r+") as file:
p = select.poll()
p.register(file.fileno(), select.POLLIN)
events = p.poll(100)
print "result of poll: ", events