Skip to content

Instantly share code, notes, and snippets.

View kouichi-c-nakamura's full-sized avatar

Kouichi C. Nakamura kouichi-c-nakamura

View GitHub Profile
@kouichi-c-nakamura
kouichi-c-nakamura / atom_matlab_color.css
Last active July 25, 2017 07:52
Atom styles.less file CSS setting for MATLAB; mimicking the original syntax coloring of MATLAB Editor
// MATLAB
/*
Atom styles.less file CSS for syntax coloring of MATLAB language.
*/
atom-text-editor.editor {
.syntax--source.syntax--matlab {
.syntax--meta.syntax--variable.syntax--other.syntax--valid.syntax--matlab {
color: #000000; //black
}
@kouichi-c-nakamura
kouichi-c-nakamura / file0.mat
Created April 16, 2017 13:42
MATLAB: 時間のかかる計算処理結果を保存しておき、次回からは保存データを読み込むか再計算するか尋ねるようなワークフローを実現する関数 ref: http://qiita.com/kouichi-c-nakamura/items/ad84587f9c67cc8ce527
filename = fullfile(resdir,'data1.mat');
if ~exist(filename,'file') || inputYN('Do you want to recompute A?')
% ここで任意の計算処理を行う
A = rand(10);
B = A^2;
save(filename,'A','B'); % 計算結果の変数を保存する
else
scr2017_02_15_115520_thisisagreatscript.mlx
@kouichi-c-nakamura
kouichi-c-nakamura / Comment Only.scpt
Last active September 16, 2016 12:45
Microsoft Word for Mac 2011で、コメントだけを表示させるAppleScript ref: http://qiita.com/kouichi-c-nakamura/items/54ef45bd34e8e247fbd3
tell application "Microsoft Word"
-- for Microsoft Word for Mac 2011
-- instead of showing all changes tracked, shows you comments only
-- mimicking Windows version's "Simple Markup" view
--set revisions view of view of active window to "revisions view final"
set show revisions and comments of view of active window to true
set show insertions and deletions of view of active window to false
@kouichi-c-nakamura
kouichi-c-nakamura / MATLAB.tmTheme
Last active August 2, 2016 18:56
Sublime Text 2 Syntax coloring to mimic MATLAB. Not perfect, but it's OK. Install into 'C:\Users\xxxxxx\AppData\Roaming\Sublime Text 2\Packages\Color Scheme - Default'. In case of Mac, place it in '/Users/xxxxxx/Library/Application Support/Sublime Text 3/Packages'.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Domenico Carbotta</string>
<key>name</key>
<string>IDLE</string>
<key>settings</key>
<array>
@kouichi-c-nakamura
kouichi-c-nakamura / file0.txt
Created July 7, 2016 03:37
Macに保存していたデータをWindowsマシンへ移行する時の苦労話 ref: http://qiita.com/kouichi-c-nakamura/items/518cd401e35889646b2e
csrutil disable
@kouichi-c-nakamura
kouichi-c-nakamura / file0.mat
Last active June 30, 2016 21:17
A reason why you should avoid MATLAB-builtin waitbar() and instead use fprintf() ref: http://qiita.com/kouichi-c-nakamura/items/ae9dc371eade0fd0a945
% waitbarVAfprintf
trials = 10;
elapsed1 = zeros(10,1);
for j = 1:10
clear n
tic
n = 1000;
for i = 1:1000
tic
a = rand(1000);
clear a
t(i) = toc;
end
disp(mean(t))
@kouichi-c-nakamura
kouichi-c-nakamura / changefont_word.scpt
Last active February 1, 2016 02:55
AppleScript code to change the font and asian font of selected text in Microsoft Word 2011 Mac
tell application "Microsoft Word"
tell active window
set name of font object of text object of selection of it to "Palatino Linotype"
set east asian name of font object of text object of selection of it to "游明朝体"
end tell
end tell
@kouichi-c-nakamura
kouichi-c-nakamura / changefont_powerpoint.scpt
Last active February 1, 2016 02:49
AppleScript code to change the font and asian font of selected text in Microsoft PowerPoint 2011 Mac, see also: http://stackoverflow.com/questions/34846139/cannot-get-text-range-of-selection-in-a-powerpoint-mac-2011-slide-with-applesc/34854344#34854344
tell application "Microsoft PowerPoint"
tell active window
set font name of font of text range of selection of it to "Arial"
set east asian name of font of text range of selection of it to "游明朝体"
end tell
end tell