Skip to content

Instantly share code, notes, and snippets.

View ibogun's full-sized avatar

Ivan ibogun

View GitHub Profile
@ibogun
ibogun / Multiclass SVM
Last active August 29, 2015 13:58
Winner-takes-it-all multiclass svm using structured output SVM.
%% Tutorial on Multi-class classification using structured output SVM
% This tutorial shows how multi-class classification can be cast and solved
% using structured output SVM (introduced in [1]). Structured output SVM generalizes both
% binary SVM and SVM regression as it allows to predict _structured
% objects_ which can be seen as an elements of an ordered set. Formally
% structured output learning is cast in the following way: given input
% vectors $\bf{x} \in \mathcal{X}$ learn a mapping to the response
% variables $\bf{y} \in \mathcal{Y}$. In the case of binary classification
% we have
% \begin{equation}\mathcal{Y_1}=\{-1,1\}\end{equation} while for regression
@ibogun
ibogun / tutorial.m
Created April 9, 2014 14:55
Tutorial on "Robust Object Tracking via Sparsity-based Collaborative Model"
%*************************************************************
% Copyright (C) Wei Zhong.
% All rights reserved.
% Date: 05/2012
% Tutorial on "Robust Object Tracking via Sparsity-based Collaborative Model"
% _Ivan Bogun April 9, 2014_
% Adapted from the demo.m by Wei Zhong
%% References and links to source codes etc.
% Main reference:
@ibogun
ibogun / Matlab_Tricks.m
Last active August 29, 2015 14:00
Matlab tricks;
% let g be anonymous function
% apply function on every row of a matrix
applyOnEveryRaw =@(A,fun) cell2mat(cellfun(fun, num2cell(A, 2), 'UniformOutput', false));
% apply function on every column of a matrix
applyOnEveryColumn=@(A,fun) cell2mat(cellfun(fun, num2cell(A, 1), 'UniformOutput', false));
@ibogun
ibogun / mexopts.sh
Created May 21, 2014 18:11
mexopts.sh capable of compiling files which use armadillo library
#
# mexopts.sh Shell script for configuring MEX-file creation script,
# mex. These options were tested with the specified compiler.
#
# usage: Do not call this file directly; it is sourced by the
# mex shell script. Modify only if you don't like the
# defaults after running mex. No spaces are allowed
# around the '=' in the variable assignment.
#
# Note: For the version of system compiler supported with this release,
@ibogun
ibogun / Folder_mount
Created July 8, 2014 13:50
Mount folder in Ubuntu guest VM
Step 7: Shared & Auto-Mounted Folder
Wouldn’t it be cool if you could access your Project folder of Mac OS X (or any other folder) inside of Ubuntu? We will do this now and I take as example a folder called “Projects”. Please replace this just with the one that you like.
Open the preferences of the Ubuntu VM (you need to shut it down before)
Go to “Shared Folder” and click on “+”
In the first line of the popup select the folder on your Mac which you want to see in Ubuntu
In the second line of the popup enter the name “Project” (or whatever your prefer)
Activate the second checkbox “automatic mounting” (or a similar wording)
Click “OK” and start your Ubuntu VM
@ibogun
ibogun / Xcode_cmake
Last active August 29, 2015 14:11
generate Xcode project using make
// prior to cmake -G Xcode ..
//do the following
export PATH="$(dirname $(xcrun --find make)):$PATH"
export CC="$(xcrun --find cc)"
export CXX="$(xcrun --find c++)"
grub rescue > ls (hd1,msdos5) # let's assume this is the linux partition
grub rescue > set root=(hd1,msdos5)
grub rescue > set prefix=(hd1,msdos5)/boot/grub # or wherever grub is installed
grub rescue > insmod normal # if this produced an error, reset root and prefix to something else ..
grub rescue > normal
@ibogun
ibogun / gist:242cec3e9f2c0723d2c5
Created March 26, 2015 20:19
cmake python remote
cmake -DBUILD_NEW_PYTHON_SUPPORT=ON -DPYTHON_INCLUDE_DIR=~/local/include/python2.7/ -DPYTHON_EXECUTABLE=~/local/bin/python -DPYTHON_NUMPY_INCLUDE_DIR=`python -c 'import numpy; print numpy.get_include()'` -DPYTHON_PACKAGES_PATH=~/local/lib/python2.7/site-packages/ -DCMAKE_C_FLAGS='-fPIC' -DCMAKE_CXX_FLAGS='-fPIC' -DCMAKE_INSTALL_PREFIX=~/local/ ..
parallel --header : echo my_command --f1={f1} --f2={f2} ::: f1 A B ::: f2 C D
@ibogun
ibogun / gist:df2eacd9bc4687967e27
Created April 18, 2015 16:52
for loop with paralell
seq 1 10 | parallel octave --silent --eval "test\({},{}\)"