Skip to content

Instantly share code, notes, and snippets.

View WillMatthews's full-sized avatar
🎓
I am *legally* a doctor. Hooray

William Matthews WillMatthews

🎓
I am *legally* a doctor. Hooray
View GitHub Profile
@WillMatthews
WillMatthews / fourier-space-webcam.py
Last active March 17, 2024 23:17
Have a good stare into Fourier space, by doing a 2D FFT on your webcam feed. Quick and very dirty script.
import cv2
import numpy as np
def fft_frame(frame):
# b, g, r
im = [np.array([[col[i] for col in row] for row in frame]) for i in range(3)]
# shift to u,v space
F = [np.fft.fft2(img) for img in im]
# amplitude
function [] = sendemail(emailMessage)
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','E_mail','your-email@gmail.com');
setpref('Internet','SMTP_Username','smtp-username-here');
setpref('Internet','SMTP_Password','p@$$w0rd-here');
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', 'javax.net.ssl.SSLSocketFactory');
props.setProperty('mail.smtp.socketFactory.port','465');
@WillMatthews
WillMatthews / ulid.m
Created April 6, 2024 02:23
ULID ported to MATLAB
% MATLAB port of https://github.com/alizain/ulid
% inspiration from https://github.com/mdipierro/ulid
% License MIT
function data = ulid(varargin)
if nargin == 0
data = generate();
elseif nargin == 1
%data = string(1,varargin(1));
@WillMatthews
WillMatthews / party-cam.sh
Created July 30, 2024 13:31
Create a virtual webcam of a gif. In this case - it points at a party parrot.
#!/bin/bash
# Creates a fake webcam pointing at a party parrot gif.
# Requires you to have a a party parrot somewhere - just make sure you set the path correctly
PARROT=~/party-parrot.gif
# Reload v4l2loopback
sudo modprobe -r v4l2loopback