cmd line

gsettings set org.gnome.nautilus.preferences always-use-location-entry true

What I need to know about SVN

Checkout a working copy of the repository (or at least the subdirectory that you want to add the files to):

svn co http://kahlan.eps.surrey.ac.uk/svn/??????/HeadPoseAnalysis/ /????/Desktop/HeadPoseAnalysis

Then go to the directory

cd /????/Desktop/HeadPoseAnalysis

To delete something

svn delete KatherineAzimuth.mat KatherineData.mat Katherine_headPoses.mat MarkAzimuth.mat MarkData.mat Mark_headPoses.mat

To add some sub folder

First generate a subfolder under the current directory, named as TestFolder

Then

svn add TestFolder

cd TestFolder

generate two files and add them

svn add 1.txt 2.txt

Or we can first generate a subfolder under the current directory, named as TestFolder, and add two files in the subdirectory.

Then

svn add TestFolder

Always remember

svn commit

That pop-up screen allows you to enter a commit message. Describe what's changed, and then save and exit your editor (The nano editor is used in the ubuntu system, in which case you'd hit Ctrl-X). Once you enter a commit message and save it, your changes will be committed to the repository.

To get the latest version, go to the svn directory

svn update

To get a specific version, first svn log to check the version available, then

svn co -r 1234

Print a large picture into different A4 papers

I have a large portrait image python-3-in-one-pic.png of size 1405 x 3226 pixels, which I want to print out on different A4 papers of size 29.7 x 21.0 cm.

Fix the width of 1405 pixels, the height should be 1405*29.7/21=1987 pixels.

Then from the terminal:

convert python-3-in-one-pic.png +repage -crop 1405x1987+0+0 single-1.jpg

convert python-3-in-one-pic.png +repage -crop 1405x1987+0+1987 single-2.jpg

convert single-1.jpg 1.pdf

convert single-2.jpg 2.pdf

Which can be printed directly.

Note that the size of single-2.jpg is not proportion to A4 size, one way to address this problem is to cut the second image from before the end of the first image, where 1239 = 3226-1987:

convert python-3-in-one-pic.png +repage -crop 1405x1987+0+1239 single-2.jpg

This results in the overlap of these two printed images.

Matlab generated video is too large

compress the video

ffmpeg -i inputFile.avi -sameq outputFile.avi

mencoder inputFile.avi -ovc lavc -o output.mp4

merge audio into video

ffmpeg -i audio.wav -i video.avi -acodec copy -vcodec copy output.avi

mencoder -audiofile inputaudio.wav inputvideo.mp4 -o mergedAV.mp4 -ovc copy -oac copy

merge two video files

mencoder -oac copy -ovc copy video1.avi video2.avi -o final.avi

stack two videos of different width of the same duration, and add an audio track of the same length

ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex '[1][0]scale2ref=iw:ow/mdar[2nd][ref];[ref][2nd]vstack[vid]' -map [vid] -c:v libx264 -crf 23 -preset veryfast output.mp4

ffmpeg -i output.mp4 -i audio1.aac -c:v copy -c:a copy output_audio.mp4

Reduce the size of a pdf file converted from word that is too large:

ps2pdf -dPDFSETTINGS=/ebook input.pdf output.pdf