Skip to content

Instantly share code, notes, and snippets.

@roelle
roelle / dc_delay.m
Last active July 9, 2017 20:37
Matlab function to calculate the DC delay (ramp delay) for a unity-gain transfer function (e.g. filter)
function td = dc_delay(sys)
%DC_DELAY(SYS) calculate the DC (ramp) delay for a transfer function
% DC_DELAY(SYS) calculates the delay for a ramp signal subject to a
% unit-gain transfer function. The delay is constant for the transfer
% function, so the sole argument is the transfer function, sys.
%
% Usage:
% Ts = 1e-2
% [B, A] = butter(2, 0.5*Ts/2);
% sysd = tf(B, A, Ts);
@roelle
roelle / systemmonitor.sh
Last active April 9, 2023 21:51
This is a simple bash script that will monitor a few things on a server and notify you over pushover is there are any problems. Specifically, the script checks for reboots, ZFS pool health, dropbox status, disk (over)utilization, and that a specified process is running.
#!/bin/bash
# Copy into /etc/cron.hourly
pushover_app_token="your--app--token"
pushover_user_guid="your--user--or--group--id"
dropbox_username="user--with--dropbox--installed"
process_to_check="your--process--name"
# Notification function
notify () {
# Send pushover notification
@roelle
roelle / lockbox.vb
Created May 24, 2013 15:17
Short script which uses a token to lock a Word Document which is shared (e.g. in a Dropbox folder) to one user so that other users do make changes simultaneously.
' Spec:
' On open...
' Get the file name for the current Word document.
' Check for an existing token file.
' If there is a token, warn the user and ask for permission to continue (by default, exit).
' Move the token to token.overwritten so that the user who got screwed may have some chance to recover.
' If there is no existing token, establish one for this user.
' Get the user name and current date and time.
' Create a token file with pertinent information.
' Store the token information in the open file to compare when closure is attempted.