Skip to content

Instantly share code, notes, and snippets.

View diego898's full-sized avatar

Diego Mesa diego898

View GitHub Profile
@diego898
diego898 / taylor_approx.m
Last active December 16, 2015 00:49
Construct, return and plot the taylor-series approximation
function [approx, error] = taylor_approx(func, point, order, range_offset)
%taylor_approx Construct, return and plot the taylor series approx.
%
% taylor_approx(func, point, order, range_offset) will construct the
% taylor series approx of the string in func to the specified order
% evaluated at some range offset centered around point.
%
% approx is the symbolic approximation
%
% error is the error values in the range
function color_average(image,diameter,type,thresh)
%% image is the name of the file 'image.format'
%% diameter is the cell size
%% type: either 'circle' or 'square'
%% thresh: from 0 to 1. Size of the gap between cells
[colormat,~,~] = imread(image);
[x,y,z] = size(colormat);
rows = floor(x/diameter);
@diego898
diego898 / perl.bash
Created April 30, 2013 17:47
An intermediary shell script I have to use to get cywgin and strawberry perl to play nicely together on windows. This script was taken from here: http://www.cs.unc.edu/~jeffay/dirt/FAQ/cygwin-perl.html
#!/bin/sh
# This is necessary to make perl work with cygwin. Cygwin passes
# "cygwin style" paths to the program in the #! statement and ActiveState
# perl does not know what /cygwin/d/... means.
# So, we put #!/usr/local/bin/perl in the perl script and this is called
# This routine translates the path name to something of type d:/
args=""
@diego898
diego898 / regedit.reg
Created September 11, 2013 18:41
Remap CapsLock-->Escape and ScrollLock-->CapsLock
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,46,00,01,00,3a,00,00,00,00,00
@diego898
diego898 / rd.md
Last active October 13, 2020 21:18
Enable Concurrent Remote Desktop Users in Windows 8.1 x64

thanks to @neurodyne and this link for updated instructions

This works with the following versions of termsrv.dll

x64 - termsrv.dll - 6.3.9600.17095

Find Replace
39813C0600000F849E310500 B80001000089813806000090
090085C07F078BD8 090085C090908BD8
@diego898
diego898 / simpleLS.matlab
Last active January 4, 2016 18:09
simple least squares example using cvx
%% A imple Least Squares problem
% https://en.wikipedia.org/wiki/Least_squares
% We first consider the most basic convex optimization problem, least-squares
% (also known as linear regression). In a least-squares problem, we seek
% x \in R^n that minimizes norm(Ax?b)
% Setup parameters
n = 100;
A = randn(2*n,n);
clear all;
clc;
%% Parameters
cvx_expert true;
a = 3;
J = 5;
c1 = 1;
c2 = 2;
y = 2;
@diego898
diego898 / parseBrainAmpFile.matlab
Created February 27, 2014 00:11
parseBrainAmpFile will read and parse the specified file which was exported from the brainamp
function output = parseBrainAmpFile(filename)
%parseBrainAmpFile Read in and parse a BrainAmp File
%
% parseBrainAmpFile(filename) will read in the specified file
% which was exported from the brainamp
%
% output is struct containing two members:
% names - a matrix where each row is the name of the data row
% values - a [#names * #samples] matrix containing the data
@diego898
diego898 / hw6.ipynb
Created June 30, 2015 17:48
Homework 6 Solutions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@diego898
diego898 / hw7.ipynb
Created June 30, 2015 17:49
Homework 7 Solutions
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.