User:Jadrian Miles: Difference between revisions
m →Nifty code snippets: pdf-append website disappeared; updating to archive.org mirror |
→Nifty code snippets: PDF cropping |
||
| (15 intermediate revisions by the same user not shown) | |||
| Line 10: | Line 10: | ||
==== Personal Documents ==== | ==== Personal Documents ==== | ||
* '''Planning Documents''' | * '''Planning Documents''' | ||
** [[/OKRs]] ([[/OKRs/Fall 2011|2011F]]) | ** [[/OKRs]] ([[/OKRs/Fall 2012|2012F]]) ([[/OKRs/Summer 2012|2012Sum]]) ([[/OKRs/Spring 2012|2012S]]) ([[/OKRs/Fall 2011|2011F]]) | ||
** [[:Image:Jadrian Miles PhD Proposal | ** [[:Image:Jadrian Miles PhD Proposal rev3 2010-09-10.pdf|Thesis proposal (v3, 2010-09-10)]] ([[:Image:Jadrian Miles PhD Proposal rev2 2009-10-15.pdf|v2, 2009-10-15]]) ([[:Image:Jadrian Miles PhD Proposal original 2009-06-22.pdf|v1, 2009-06-22]]) | ||
** [[/Paper list]] | |||
** [[/End-of-PhD cleanup taks]] | ** [[/End-of-PhD cleanup taks]] | ||
* '''Project Notes''' | * '''Project Notes''' | ||
| Line 35: | Line 34: | ||
* [[/Eclipse]] | * [[/Eclipse]] | ||
* [[/sandbox]] | * [[/sandbox]] | ||
==== Nifty code snippets ==== | ==== Nifty code snippets ==== | ||
| Line 49: | Line 47: | ||
* Update a directory with stuff that exists in a CVS repository but not in the directory: | * Update a directory with stuff that exists in a CVS repository but not in the directory: | ||
*;<pre>cvs update -d</pre> | *;<pre>cvs update -d</pre> | ||
* Concatenate PDFs (more at [http://web.archive.org/web/20090223000710/http://ansuz.sooke.bc.ca/software/pdf-append.php? the original source]) | * Concatenate PDFs (more at [http://web.archive.org/web/20090223000710/http://ansuz.sooke.bc.ca/software/pdf-append.php? the original source]; even more [http://nixtricks.wordpress.com/2009/09/01/cli-combine-or-remove-pages-from-a-pdf-document-using-ghostscript/ elsewhere], as well as [http://www.linuxjournal.com/content/tech-tip-extract-pages-pdf how to extract ranges of pages]) | ||
*;<pre>gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf | *;<pre>gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf ...</pre> | ||
* Recache TeX search paths: | * Crop PDF (more at [http://stackoverflow.com/questions/10417151/pdf-remove-white-margins/10418720#10418720 StackOverflow]: | ||
<div style="margin-left: 1.5em"> | |||
First, figure out the size of the bounding box: | |||
<pre> gs -q -dBATCH -dNOPAUSE -sDEVICE=bbox orig.pdf 2>&1 | grep -v HiRes | |||
%%BoundingBox: 134 158 471 715 | |||
...</pre> | |||
The resulting bounding box is in the form <code>B_x B_y T_x T_y</code>, where B and T are the coordinates of the bottom and top corners, respectively, measured in points. | |||
The bounding box lies on a page of a certain size. One point is 1/72", so letter size is 612x792pt. | |||
In this case, we'd like to leave a 10pt margin on all sides. That means offsetting the page down and left by 124x148pts, and then cropping to a page size of (471-134)+20=357pts wide and (715-158)+20=577pts tall. The command is: | |||
<pre> gs -o cropped.pdf -sDEVICE=pdfwrite -g3570x5770 -c "<</PageOffset [-124 -148]>> setpagedevice" -f orig.pdf</pre> | |||
Note that the argument to <code>-g</code> is in ''tenths'' of a point. | |||
</div> | |||
* Recache TeX search paths: <pre>sudo mktexlsr</pre> | |||
* Perceptually uniform random coloring in Matlab | * Perceptually uniform random coloring in Matlab | ||
<pre style="margin-left:1.5em"> | <pre style="margin-left:1.5em"> | ||
| Line 59: | Line 68: | ||
</pre> | </pre> | ||
* Recursively download a website using wget (see [http://www.editcorp.com/Personal/Lars_Appel/wget/wget_2.html#SEC11 the man page] for more) <pre>wget -r -np -nH http://www.site.com/subdir</pre> | * Recursively download a website using wget (see [http://www.editcorp.com/Personal/Lars_Appel/wget/wget_2.html#SEC11 the man page] for more) <pre>wget -r -np -nH http://www.site.com/subdir</pre> | ||
* Recursively download a remote directory via SSH, preserving modification times (note the trailing slash on the remote directory!): <pre>rsync -ra -e ssh <server>:<dir>/ <local_path></pre> | |||
==== Bookmarks ==== | ==== Bookmarks ==== | ||
* [http://when2meet.com when2meet.com] --- lightweight meeting scheduling thingie | * [http://when2meet.com when2meet.com] --- lightweight meeting scheduling thingie | ||
==== Tutorials ==== | |||
* [http://www.aiaccess.net/English/Glossaries/GlosMod/e_gm_covariance.htm Covariance] and [http://www.aiaccess.net/English/Glossaries/GlosMod/e_gm_covariance_matrix.htm covariance matrix] | |||
* [http://www.tommangan.us/Tensors.pdf Tensors], by Thomas Mangan. | |||
* [http://www.cs.ucr.edu/~vbz/resources/quatut.pdf Quaternions], by Ken Shoemake. | |||
* [http://diglib.stanford.edu:8091/~klein/lagrange-multipliers.pdf Lagrange Multipliers], by Dan Klein. | |||
==== Miscellaneous notes ==== | ==== Miscellaneous notes ==== | ||
Latest revision as of 19:22, 27 January 2014
I started my PhD in CS at Brown in Fall 2006. I work on data processing, measurement, and model reconstruction from diffusion MRI of the brain.
You can find me elsewhere online:
There are a number of directories related to me on the CS filesystem, all of which are linked from file:///map/gfx0/users/jadrian
Personal Documents
- Planning Documents
- Project Notes
- Archive
Draft pages / notes
- /Theory Conference Deadlines
- /Plan your PhD
- /Diffusion MRI techniques
- /BB's dollarg
- /Eclipse
- /sandbox
Nifty code snippets
- Generate a random filename from the command line:
set tmpfile=/tmp/`head -q -c 8 /proc/sys/kernel/random/uuid`
- Convert stdin to lowercase on stdout:
tr '[A-Z]' '[a-z]'
- Rename files into consecutive zero-padded integers in bash:
let i=0; for f in *.JPG; do mv $f `printf "%04d" $i`.jpg; let i++; done
- Test for host availability in tcsh (for loop demo; see here for bash example):
foreach h ( `cat hostlist` ) ssh $h uname -n end
- Update a directory with stuff that exists in a CVS repository but not in the directory:
cvs update -d
- Concatenate PDFs (more at the original source; even more elsewhere, as well as how to extract ranges of pages)
gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf ...
- Crop PDF (more at StackOverflow:
First, figure out the size of the bounding box:
gs -q -dBATCH -dNOPAUSE -sDEVICE=bbox orig.pdf 2>&1 | grep -v HiRes %%BoundingBox: 134 158 471 715 ...
The resulting bounding box is in the form B_x B_y T_x T_y, where B and T are the coordinates of the bottom and top corners, respectively, measured in points.
The bounding box lies on a page of a certain size. One point is 1/72", so letter size is 612x792pt.
In this case, we'd like to leave a 10pt margin on all sides. That means offsetting the page down and left by 124x148pts, and then cropping to a page size of (471-134)+20=357pts wide and (715-158)+20=577pts tall. The command is:
gs -o cropped.pdf -sDEVICE=pdfwrite -g3570x5770 -c "<</PageOffset [-124 -148]>> setpagedevice" -f orig.pdf
Note that the argument to -g is in tenths of a point.
- Recache TeX search paths:
sudo mktexlsr
- Perceptually uniform random coloring in Matlab
C = makecform('lab2srgb');
plot3(X,Y,Z,'Color', applycform([50+rand*50, -100+rand*200, -100+rand*200], C));
- Recursively download a website using wget (see the man page for more)
wget -r -np -nH http://www.site.com/subdir
- Recursively download a remote directory via SSH, preserving modification times (note the trailing slash on the remote directory!):
rsync -ra -e ssh <server>:<dir>/ <local_path>
Bookmarks
- when2meet.com --- lightweight meeting scheduling thingie
Tutorials
- Covariance and covariance matrix
- Tensors, by Thomas Mangan.
- Quaternions, by Ken Shoemake.
- Lagrange Multipliers, by Dan Klein.
Miscellaneous notes
- High b sensitizes to short length scale (Assaf & Cohen 1998, 2000).
- The cingulum bundle looks like a long, skinny tube (that wraps around the top and back of the CC) in a gross segmentation, and fibers run along the long axis of this tube for most of this length. Their projections into the GM, though, are actually along the side of the tube, on mid-sagittal gyri. This is a really weird shape when it comes to inferring fiber paths from the bundle shape, so it should be a smoke test for any proposed system.
- Sculpture might be a good choice for the second outside minor course. 3D reasoning, malleable shapes...