This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_my_paths | |
% This function should be given a specific name for each user. | |
% It is the one file that needs to be named appropriately in order to guarantee name collision avoidance. | |
% This needs to be a function instead of a script because we will need a subfunction to recursively add subdirectories. | |
% For this example, we will add the directory that contains the script, as well as all of its subdirectories, to the Matlab path. | |
% mfilename('fullfile') returns the full path to the currently running script, as in '/home/user/matlab/Alice/add_my_paths.m' | |
thisPath = mfilename('fullfile'); | |
% Get path to the directory containing the currently running script. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This information is partially based on advice from here: http://www.ahowto.net/matlab/connect-and-access-mysql-database | |
It's assumed that Matlab, the Database Toolbox, and MySQL are already installed. | |
1. The JDBC driver needs to be installed to allow Matlab to connect to MySQL using Java. I installed it using the package manager: | |
$ sudo apt-get install libmysql-java | |
2. On my system, that installed the JDBC driver at /usr/share/java/mysql-connector-java.jar . Matlab needs to be informed about this. In Matlab: | |
>> javaaddpath('/usr/share/java/mysql-connector-java.jar') | |
I think this needs to be called in every Matlab session, so it might be good to go ahead and add it to startup.m . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Suppose you have a vector x containing a bunch of numeric data, including NaNs. | |
N = 100000; % The amount of data we have | |
x = randi(1000,N,1); % Our dummy data, a bunch of integers 0-1000. | |
x(randperm(N,round(N/10))) = NaN; % Make 10 percent of them NaNs. | |
% And you want to write a text table with this along with some other columns: | |
w = cellstr(char(randi(26,N,4)+'a'-1)); % Make a bunch of random 4-letter strings | |
y = 100*rand(N,1); % And a bunch of random numbers 0-100. | |
% Normally you might just do something like: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(All commands to be executed on the local machine.) | |
1. Create the remote repo: | |
$ cd /path/to/gitolite/admin/repo | |
$ gedit conf/gitolite.conf | |
To this file, add an entry like: | |
repo <new-repo> | |
RW+ = <gitolite-username> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Parse a document using "offside rule" indentation (as in Python) into lines | |
// grouped by indentation level, using PEG.js. | |
// Attempts to segregate the "stateful" rules from the other production/parsing | |
// rules by "disallowing" indentation-level-sensitive rules from consuming any | |
// text. | |
{ var margin_stack = [""]; } | |
Document | |
= content: Element+ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mutating { | |
constructor(x) { | |
this._thing = x; | |
} | |
get thing() { return this._thing; } | |
set thing(x) { | |
this._thing = x; | |
this.change(); | |
} |