Skip to content

Instantly share code, notes, and snippets.

View kylemcdonald's full-sized avatar

Kyle McDonald kylemcdonald

View GitHub Profile
@kylemcdonald
kylemcdonald / CameraSphere.cpp
Last active December 24, 2015 23:19
Render the video stream in a sphere.
#include "ofMain.h"
class ofApp : public ofBaseApp {
public:
ofVideoGrabber video;
ofEasyCam cam;
ofSpherePrimitive sphere;
void setup() {
@kylemcdonald
kylemcdonald / ofxUIControlPanel.h
Created November 12, 2013 23:20
ofxControlPanel with ofxUI (untested).
#pragma once
#include "ofxUI.h"
class ofxUIControlPanel {
public:
ofxUICanvas* gui;
void setup() {
gui = new ofxUICanvas();
@kylemcdonald
kylemcdonald / main.cpp
Created January 7, 2014 19:42
Simulation of synthesizer built from 256 perfect logic gates with 32 fixed inputs.
#include "ofMain.h"
// what happens when we can look back in time? i.e., add delays to io?
// this can be modeled with one pass-through-gate or two not-gates.
// or with a single and-gate with both inputs connect to the same output.
// what happens when the the circuit can control its own topology?
// this can be modeled with a very large circuit that switches between sub-circuits
// what happens when we use gates with more than two inputs?
// this can be modeled with a sub-circuit
// what happens when gates have floating point values with schmitt triggers?
@kylemcdonald
kylemcdonald / three.js.shader.html
Last active March 27, 2023 00:45
Minimal three.js shader example.
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body {
margin: 0px;
overflow: hidden;
}
@kylemcdonald
kylemcdonald / pr-log.py
Last active August 18, 2018 23:06
Probe request MAC/SSID pair logging with tcpdump and Python3 for OS X, using airport for channel hopping.
import re
import pickle
from threading import Timer
import subprocess
from subprocess import call
import os.path
import sys
# config
database = 'allPairs.p'
@kylemcdonald
kylemcdonald / main.cpp
Created April 24, 2014 22:06
Example of using libpcap with openFrameworks in monitor mode in OS X (probably similar on Linux). By default we are only watching for probe request frames.
// make sure to link against /usr/lib/libpcap.dylib
#include "ofMain.h"
#include <pcap/pcap.h>
class ofApp : public ofBaseApp {
public:
pcap_t *pcap;
struct pcap_pkthdr header;
const unsigned char* packet = NULL;
list<string> packetHex;
### Keybase proof
I hereby claim:
* I am kylemcdonald on github.
* I am kylemcdonald (https://keybase.io/kylemcdonald) on keybase.
* I have a public key whose fingerprint is 50DA 00A9 1EB3 C84D 7A56 9FAD 3ACA C174 01F5 8612
To claim this, I am signing this object:
@kylemcdonald
kylemcdonald / main.cpp
Last active August 29, 2015 14:02
Playing with path optimization ideas.
#include "ofMain.h"
#include "ofxCv.h"
class ofApp : public ofBaseApp {
public:
void setup() {
bestDiff = 0;
swaps = 64 * 64;
n = 32;
for(int y = 0; y < n; y++) {
@kylemcdonald
kylemcdonald / Matlab.pde
Last active August 29, 2015 14:02
Lomb-Scargle periodogram for Processing, ported from Matlab code, so it's very idiosyncratic and non-idiomatic. Original code published in "Ice Ages and Astronomical Causes: Data, Spectral Analysis and Mechanisms" available at http://books.google.com/books?id=P8ideTkMQisC&pg=PA289&dq=spectral+lomb+scargle&hl=en
float[] hann(float[] x) {
int n = x.length;
float[] result = new float[n];
for(int i = 0; i < n; i++) {
float weight = .5 * (1 - cos((TWO_PI * i) / (n - 1)));
result[i] = x[i] * weight;
}
return result;
}
@kylemcdonald
kylemcdonald / BrowseCapture.scpt
Created June 25, 2014 23:40
Records video from your webcam whenever you are visiting a specific site.
global targetDomain
global folderName
-- options
set targetDomain to "dropcam.com"
set folderName to (path to desktop as text) & "Dropcam"
-- main code
global recordingFile
global newMovieRecording