Monday, May 21, 2018

LaTeX: Strip comments and combine all input files into one using latexpand tool

Useful when submitting source to journals or to arXiv.

latexpand --empty-comments mytexfile.tex > mytexfile-stripped.tex

https://tex.stackexchange.com/a/271460

Thursday, April 26, 2018

How to change tmux screen size to match current session

From: https://stackoverflow.com/a/20908246

Press Ctrl-B+Shift-D, then select session.

Alternative: Ctrl-B from inside the session, then type :detach -a

Wednesday, November 15, 2017

Wednesday, August 2, 2017

Move powerpoint audio icon off-screen after recording

Use one simple macro to move on all slides (rather than doing this slide by slide)

(From https://answers.microsoft.com/en-us/msoffice/forum/msoffice_powerpoint-mso_mac/alignment-of-audio-file-icon/f4bbfa08-fd24-4814-bb54-c7902d4abe31)

Go to View -> Macros and add the following macro:

Sub fix_Audio()
Dim osld As Slide
Dim oshp As Shape
For Each osld In ActivePresentation.Slides
For Each oshp In osld.Shapes
If oshp.Type = msoMedia Then
If oshp.MediaType = ppMediaTypeSound Then
oshp.Top = ActivePresentation.PageSetup.SlideHeight - oshp.Height
oshp.Left = ActivePresentation.PageSetup.SlideWidth - oshp.Width
End If
End If
Next
Next
End Sub

Click run. Done!

Tuesday, March 21, 2017

Install Caffe + dependencies on my lab machine (Ubuntu 16.04-based Mint)

https://gist.github.com/dineshj1/084974cc252ed4cd5aa20a423d30d7a3

install_caffe_deps.sh

Then build with CMake

May need to add special_lib/ folder that contains libraries that are duplicated in anaconda.

LD_LIBRARY_PATH: /home/dineshj/special_lib/:/home/dineshj/local_installs/lib/:/usr/local/cuda/lib64/:/home/dineshj/special_lib/:/home/dineshj/local_installs/lib/:/usr/local/cuda/lib64/:

May also need to additionally move libstdc++* in ~/anaconda/lib/ to ~/anaconda/lib/tmp/.

Tuesday, January 31, 2017

Time change when switching between Windows and Linux on a dual-boot machine

This is because of differences in how these two OSes treat the time written on the hardware clock. It can be fixed as below. (I've tried the Windows registry file edit.)

https://help.ubuntu.com/community/UbuntuTime#Multiple_Boot_Systems_Time_Conflicts

Friday, January 27, 2017

Friday, December 23, 2016

Install Caffe with CMake on vision machines/eldar

cd caffe;
mkdir cmake_build;
cmake .. -DBLAS=Open;

Final CMakeCache.txt should look like (both non-cuda version from vision machines and cuda version from eldar included):
https://gist.github.com/dineshj1/431828a10d230a5f767b73ecdfacf744

Install latest opencv from github repository on vision machines/ eldar

Clone opencv from Itseez's repository
cd opencv; mkdir release; cd release;
cmake .. -DWITH_IPP=OFF -DCMAKE_BUILD_TYPE=RELEASE -DCMAKE_INSTALL_PREFIX=/vision/vision_users/dineshj/local_installs/ -DBUILD_TIFF=ON -DBUILD_PNG=ON -DBUILD_opencv_viz=OFF

Final CMakeCache.txt file should look like:
https://gist.github.com/dineshj1/3058f8a439a82ff7cd1ae07113a5b148

Tuesday, August 30, 2016

Pycaffe training

https://gist.github.com/dineshj1/839e08576d441944fd6f36ca6896453b

Sunday, August 28, 2016

Hyperparameter optimization on a cluster - job submission script

Job submission scripts can be written in such a way as to make hyperparameter optimization easy.

I personally find it useful to loop over some set of configurations of hyperparameters within a Matlab/Python script, and also simultaneously dump those parameters into a spreadsheet. I then copy the cells from that spreadsheet into a Google Sheets spreadsheet, one run on each row. Later, I will record results in that Google Sheets spreadsheet too.

https://gist.github.com/dineshj1/7e38e6a68d6f7d81cc771ed77ce3d656

kitti227_submitjobs.m and kitti227_submitjobs.py are Matlab and Python job submission scripts that do similar things. Python does things a little more elegantly, using the Caffe python interface to automatically generate network prototxts (see layer_stack.py)

job_submission_script_example.m is just another job submission Matlab script, similar to kitti227_submitjobs.m.



Torch-hdf5

Don't use luarocks install hdf5. It might install a different library. What you want is:
https://github.com/deepmind/torch-hdf5/blob/master/doc/usage.md

To install it, clone the repository and type:
luarocks make hdf5-0-0.rockspec
Test installation with:
th -e "require 'hdf5'"

If it works, you're set. If it throws up errors like  "Error: unable to locate HDF5 header file at hdf5.h",
then you need to go to $TORCHPATH/share/lua/5.1/hdf5/config.lua and edit HDF5_INCLUDE_PATH. For e.g.
    HDF5_INCLUDE_PATH = "/vision/vision_users/dineshj/local_installs/include/",

Friday, August 19, 2016

Caffe+dependencies installation with cudnn on vision/eldar machines (both with and without cuda)

https://gist.github.com/dineshj1/6f0371ba5615d7e9d50d870fd53c8d01

For this installation, install_caffe_new.sh was run on vision machines entirely. Not sure if installing dependencies would work just as well on eldar. OpenCV in particular caused problems when trying to install from eldar-1.


PS: The cudnn version installs, and make runtest passes all the important tests, but throws a segmentation fault when printing date:
[----------] Global test environment tear-down
[==========] 2081 tests from 277 test cases ran. (812540 ms total)
[  PASSED  ] 2081 tests.
*** Aborted at 1471619205 (unix time) try "date -d @1471619205" if you are using GNU date ***
PC: @     0x2b8879ed77db (unknown)
*** SIGSEGV (@0x2b886bac1188) received by PID 29519 (TID 0x2b887324c480) from PID 1806438792; stack trace: ***
    @     0x2b8879e8fcb0 (unknown)
    @     0x2b8879ed77db (unknown)
    @     0x2b8879ed8ce8 (unknown)
    @     0x2b8879edc1dc __libc_calloc
    @     0x2b8885d91279 (unknown)
make: *** [runtest] Segmentation fault

Monday, August 15, 2016

Download full directories with wget

See: http://stackoverflow.com/a/273776/2009491

In particular, what you probably need is this:
wget -r --no-parent --reject "index.html*" http://example.com/configs/.vim/

Install osmesa on vision machines (in progress)

wget https://mesa.freedesktop.org/archive/current/mesa-11.0.7.tar.gz
dtrx mesa-11.0.7.tar.gz

cd mesa-11.0.7/
./configure --prefix=/vision/vision_users/dineshj/local_installs/ --disable-dri3
--> error saying libudev-dev or sysfs required


Was trying to do this to view OFF files. Found ways to do it within Matlab instead.

Friday, August 5, 2016

Reduce file size of eps image file in Linux (eg., during arXiv submission)

It's not clear how to do this within Inkscape (even if you are creating your eps in Inkscape)

So, open the file in Gimp. Choose resolution 100 (default).

Then export to eps in Gimp. This should create a much smaller file already.

Tradeoff compactness and quality by adjusting resolution at the time of loading the eps into Gimp.


Wednesday, July 20, 2016

How to merge folders from command line in Linux

The standard mv has no way to do this. Instead, use rsync.

rsync -av <source_folder> <target_folder> --remove-source-files

See: http://unix.stackexchange.com/questions/127712/merging-folders-with-mv