Skip to content

Instantly share code, notes, and snippets.

View adrianseeley's full-sized avatar

Adrian Seeley adrianseeley

  • Adrian Seeley
  • Canada
View GitHub Profile
@Circuitsoft
Circuitsoft / Output
Created August 4, 2011 22:02
Capture single image V4L2
Driver Caps:
Driver: "omap3"
Card: "omap3/mt9v032//"
Bus: ""
Version: 0.0
Capabilities: 04000001
Camera Cropping:
Bounds: 752x480+0+0
Default: 752x480+0+0
Aspect: 1/1
@jpoehls
jpoehls / node-cluster-messaging.js
Created March 29, 2012 01:48
Simple message passing between cluster master and workers in Node.js
var cluster = require('cluster');
if (cluster.isWorker) {
console.log('Worker ' + process.pid + ' has started.');
// Send message to master process.
process.send({msgFromWorker: 'This is from worker ' + process.pid + '.'})
// Receive messages from the master process.
@adrianseeley
adrianseeley / Crowd Complete - nodeJS
Created November 18, 2012 15:19
Crowd Complete :: a NodeJS Snippit for Ranked Crowd Sourced Auto Complete (Auto Complete Artificial Neural Network)
/* Crowd Complete :: a NodeJS Snippit for Ranked Crowd Sourced Auto Complete (Auto Complete Artificial Neural Network)
Usage:
Requires a running mongo database (db_url)
No solutions exist until you build them over time by 'feeding' the database with /fb.
/ac?e=getAutocompleteSolutionsFromAcDatabase
/fb?e=thisTextIsACompleteUserEntryThatIsBeingFedBackToTheAcDatabase
What is this?
TL;DR - Google's magic autocomplete bar.
@adrianseeley
adrianseeley / pso.js
Last active June 5, 2021 12:03
JavaScript Normalized Particle Swarm Optimization Implementation - Search for an N-dimensional vector of components between -1 and +1 that optimizes a given function to a fitness of 0.
// based on http://msdn.microsoft.com/en-us/magazine/hh335067.aspx
// usage example at bottom
function pso (number_of_dimensions, function_to_optimize, number_of_particles, number_of_iterations, fitness_threshold, inertia_weight, cognitive_weight, social_weight) {
var particles = [];
var swarm_best_position = [];
var swarm_best_fitness = null;
for (var p = 0; p < number_of_particles; p++) {
particles.push({
particle_position: [],