2020-05-26 08:40:15 +02:00
<?xml version="1.0" encoding="utf-8"?>
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en" xml:lang = "en" >
< head >
2021-01-08 01:34:53 +01:00
<!-- 2021 - 01 - 08 ven. 01:32 -->
2020-05-26 08:40:15 +02:00
< meta http-equiv = "Content-Type" content = "text/html;charset=utf-8" / >
< title > My Own Library of Babel< / title >
< meta name = "generator" content = "Org mode" / >
2021-01-01 20:12:34 +01:00
< meta name = "author" content = "Dehaeze Thomas" / >
< link rel = "stylesheet" type = "text/css" href = "./dist/style.css" / >
< script type = "text/javascript" src = "./dist/script.js" > < / script >
2020-05-26 08:40:15 +02:00
< / head >
< body >
2021-01-01 20:12:34 +01:00
< div id = "org-div-home-and-up" >
< a accesskey = "h" href = "./index.html" > UP < / a >
|
< a accesskey = "H" href = "./index.html" > HOME < / a >
< / div > < div id = "content" >
2020-05-26 08:40:15 +02:00
< h1 class = "title" > My Own Library of Babel< / h1 >
< div id = "table-of-contents" >
< h2 > Table of Contents< / h2 >
< div id = "text-table-of-contents" >
< ul >
2021-01-01 20:12:34 +01:00
< li > < a href = "#org6748865" > < code > get-password< / code > - Get Password from < code > pass< / code > < / a > < / li >
< li > < a href = "#orga14277a" > < code > pdf2svg< / code > - Export to pdf/png/svg at the same time< / a > < / li >
< li > < a href = "#orgca0df99" > < code > addhdr< / code > - Add hline to tables< / a > < / li >
< li > < a href = "#org7f58498" > Matlab Related< / a >
2020-05-26 08:40:15 +02:00
< ul >
2021-01-01 20:12:34 +01:00
< li > < a href = "#org0dc80bc" > < code > matlab-dir< / code > Go to current directory< / a > < / li >
< li > < a href = "#orge3957c3" > < code > matlab-init< / code > Initialize matlab< / a > < / li >
< li > < a href = "#orgcdf63af" > < code > plt-matlab< / code > Plot figures< / a > < / li >
2020-05-26 08:40:15 +02:00
< / ul >
< / li >
< / ul >
< / div >
< / div >
2021-01-01 20:12:34 +01:00
< div id = "outline-container-org6748865" class = "outline-2" >
< h2 id = "org6748865" > < code > get-password< / code > - Get Password from < code > pass< / code > < / h2 >
< div class = "outline-text-2" id = "text-org6748865" >
2020-05-26 08:40:15 +02:00
< div class = "org-src-container" >
2021-01-01 20:12:34 +01:00
< pre class = "src src-bash" id = "org907ee3f" > pass $< span class = "org-variable-name" > passname< / span > | sed -n 1p
2020-05-26 08:40:15 +02:00
< / pre >
< / div >
< / div >
< / div >
2021-01-01 20:12:34 +01:00
< div id = "outline-container-orga14277a" class = "outline-2" >
< h2 id = "orga14277a" > < code > pdf2svg< / code > - Export to pdf/png/svg at the same time< / h2 >
< div class = "outline-text-2" id = "text-orga14277a" >
2020-05-26 08:40:15 +02:00
< div class = "org-src-container" >
2021-01-01 20:12:34 +01:00
< pre class = "src src-sh" id = "org9f7b2d6" > < span class = "org-variable-name" > _mydir< / span > =< span class = "org-string" > "< / span > < span class = "org-string" > < span class = "org-sh-quoted-exec" > $(< / span > < / span > < span class = "org-sh-quoted-exec" > pwd< / span > < span class = "org-string" > < span class = "org-sh-quoted-exec" > )< / span > < / span > < span class = "org-string" > "< / span > ;
< span class = "org-variable-name" > file< / span > =$< span class = "org-rainbow-delimiters-depth-1" > (< / span > < span class = "org-sh-quoted-exec" > echo< / span > < span class = "org-string" > "< / span > < span class = "org-string" > < span class = "org-constant" > $< / span > < / span > < span class = "org-string" > < span class = "org-variable-name" > file< / span > < / span > < span class = "org-string" > "< / span > | cut -f 2- -d < span class = "org-string" > ':'< / span > < span class = "org-rainbow-delimiters-depth-1" > )< / span > ;
< span class = "org-variable-name" > _figdir< / span > =$< span class = "org-rainbow-delimiters-depth-1" > (< / span > < span class = "org-sh-quoted-exec" > dirname< / span > < span class = "org-string" > "< / span > < span class = "org-string" > < span class = "org-constant" > $< / span > < / span > < span class = "org-string" > < span class = "org-variable-name" > file< / span > < / span > < span class = "org-string" > "< / span > < span class = "org-rainbow-delimiters-depth-1" > )< / span > ;
< span class = "org-type" > cd< / span > $< span class = "org-variable-name" > _figdir< / span > ;
< span class = "org-variable-name" > filename< / span > =$< span class = "org-rainbow-delimiters-depth-1" > (< / span > < span class = "org-sh-quoted-exec" > echo< / span > < span class = "org-string" > "< / span > < span class = "org-string" > < span class = "org-constant" > $< / span > < / span > < span class = "org-string" > < span class = "org-variable-name" > {file##*/}< / span > < / span > < span class = "org-string" > "< / span > | cut -f < span class = "org-highlight-numbers-number" > 1< / span > -d < span class = "org-string" > '.'< / span > < span class = "org-rainbow-delimiters-depth-1" > )< / span > ;
pdftocairo -png -transp -singlefile < span class = "org-string" > "< / span > < span class = "org-string" > < span class = "org-constant" > $< / span > < / span > < span class = "org-string" > < span class = "org-variable-name" > filename< / span > < / span > < span class = "org-string" > .pdf"< / span > ;
pdftocairo -svg < span class = "org-string" > "< / span > < span class = "org-string" > < span class = "org-constant" > $< / span > < / span > < span class = "org-string" > < span class = "org-variable-name" > filename< / span > < / span > < span class = "org-string" > .pdf"< / span > ;
< span class = "org-type" > cd< / span > < span class = "org-string" > "$_mydir"< / span > ;
< span class = "org-type" > echo< / span > < span class = "org-string" > "[[file:$_figdir/< / span > < span class = "org-string" > < span class = "org-constant" > $< / span > < / span > < span class = "org-string" > < span class = "org-variable-name" > filename< / span > < / span > < span class = "org-string" > .< / span > < span class = "org-string" > < span class = "org-constant" > $< / span > < / span > < span class = "org-string" > < span class = "org-variable-name" > ext< / span > < / span > < span class = "org-string" > ]]"< / span >
2020-05-26 08:40:15 +02:00
< / pre >
< / div >
< / div >
< / div >
2021-01-01 20:12:34 +01:00
< div id = "outline-container-orgca0df99" class = "outline-2" >
< h2 id = "orgca0df99" > < code > addhdr< / code > - Add hline to tables< / h2 >
< div class = "outline-text-2" id = "text-orgca0df99" >
2020-05-26 08:40:15 +02:00
< div class = "org-src-container" >
2021-01-01 20:12:34 +01:00
< pre class = "src src-emacs-lisp" id = "orgc589733" > < span class = "org-rainbow-delimiters-depth-1" > (< / span > < span class = "org-constant" > cons< / span > < span class = "org-rainbow-delimiters-depth-2" > (< / span > < span class = "org-constant" > car< / span > tbl< span class = "org-rainbow-delimiters-depth-2" > )< / span > < span class = "org-rainbow-delimiters-depth-2" > (< / span > < span class = "org-constant" > cons< / span > < span class = "org-highlight-quoted-quote" > '< / span > < span class = "org-highlight-quoted-symbol" > hline< / span > < span class = "org-rainbow-delimiters-depth-3" > (< / span > < span class = "org-constant" > cdr< / span > tbl< span class = "org-rainbow-delimiters-depth-3" > )< / span > < span class = "org-rainbow-delimiters-depth-2" > )< / span > < span class = "org-rainbow-delimiters-depth-1" > )< / span >
2020-05-26 08:40:15 +02:00
< / pre >
< / div >
< / div >
< / div >
2021-01-01 20:12:34 +01:00
< div id = "outline-container-org7f58498" class = "outline-2" >
< h2 id = "org7f58498" > Matlab Related< / h2 >
< div class = "outline-text-2" id = "text-org7f58498" >
2020-05-26 08:40:15 +02:00
< / div >
2021-01-01 20:12:34 +01:00
< div id = "outline-container-org0dc80bc" class = "outline-3" >
< h3 id = "org0dc80bc" > < code > matlab-dir< / code > Go to current directory< / h3 >
2020-05-26 08:40:15 +02:00
< / div >
2021-01-01 20:12:34 +01:00
< div id = "outline-container-orge3957c3" class = "outline-3" >
< h3 id = "orge3957c3" > < code > matlab-init< / code > Initialize matlab< / h3 >
2020-05-26 08:40:15 +02:00
< / div >
2021-01-01 20:12:34 +01:00
< div id = "outline-container-orgcdf63af" class = "outline-3" >
< h3 id = "orgcdf63af" > < code > plt-matlab< / code > Plot figures< / h3 >
< div class = "outline-text-3" id = "text-orgcdf63af" >
2020-05-26 08:40:15 +02:00
< p >
Some variable can be set by block that expands this org source code block:
< / p >
< ul class = "org-ul" >
< li > < code > path< / code > : specify the path of the figure including the file extension. Can be relative or absolute. If not provided, it will create the figure in the < code > /tmp< / code > folder< / li >
< li > < code > fig_size< / code > : can specify the size of the figure. If not specify, default will be applied.< / li >
< / ul >
< div class = "org-src-container" >
2021-01-01 20:12:34 +01:00
< pre class = "src src-matlab" id = "org7fa148b" > < span class = "org-keyword" > if< / span > < span class = "org-type" > ~< / span > exist(< span class = "org-string" > 'filepath'< / span > ) < span class = "org-type" > ||< / span > length(filepath) < span class = "org-type" > < < / span > 2
symbols = [< span class = "org-string" > 'a'< / span > < span class = "org-type" > :< / span > < span class = "org-string" > 'z'< / span > < span class = "org-string" > 'A'< / span > < span class = "org-type" > :< / span > < span class = "org-string" > 'Z'< / span > < span class = "org-string" > '0'< / span > < span class = "org-type" > :< / span > < span class = "org-string" > '9'< / span > ];
2020-05-26 08:40:15 +02:00
random_string = symbols(randi(numel(symbols),[1 5]));
2021-01-01 20:12:34 +01:00
filepath = [< span class = "org-string" > '/tmp/matlab-fig-'< / span > , random_string];
< span class = "org-keyword" > end< / span >
2020-05-26 08:40:15 +02:00
2021-01-01 20:12:34 +01:00
size_strings = strsplit(figsize, < span class = "org-string" > '-'< / span > );
2020-05-26 08:40:15 +02:00
2021-01-01 20:12:34 +01:00
< span class = "org-constant" > ans< / span > = exportFig(filepath, < span class = "org-string" > 'width'< / span > , size_strings{1}, < span class = "org-string" > 'height'< / span > , size_strings{2});
2020-05-26 08:40:15 +02:00
< / pre >
< / div >
< / div >
< / div >
< / div >
< / div >
< div id = "postamble" class = "status" >
2021-01-01 20:12:34 +01:00
< p class = "author" > Author: Dehaeze Thomas< / p >
2021-01-08 01:34:53 +01:00
< p class = "date" > Created: 2021-01-08 ven. 01:32< / p >
2020-05-26 08:40:15 +02:00
< / div >
< / body >
< / html >