Git: Remove or Delete file from Git repository

To remove a file from the Git repository but not delete it from your filesystem, execute the following:

git rm --cached file_to_keep.txt;
git commit -m "Removing file_to_keep.txt from Repository";

To remove a file from the Git repository and the filesystem, use the following:

git rm file_to_delete.txt;
git commit -m "Removing and Deleting file_to_delete.txt";

Latex/Beamer: Undefined control sequence. …meroption{show notes on second screen=right}

When trying to enable the option that shows presentation notes on a different monitor using:

\setbeameroption{show notes on second screen=right}

we got the following error:

Undefined control sequence. …meroption{show notes on second screen=right}
Missing \begin{document}. …meroption{show notes on second screen=right}

To fix this issue we enabled the package pgfpages


To present this special built PDF presentation across two screens we used dspdfviewer.

dspdfviewer is a pre-rendering and caching (read: fast) full-screen pdf viewer specifically designed for latex-beamer presentations, that were created with the show notes on second screen=right option (\setbeameroption{show notes on second screen=right}).

Special note: when we were testing dspdfviewer on Ubuntu 20.04LTS we thought that the secondary screen had to be on the left of the primary (because of the build command that specifies that notes need to be on the right). That was actually wrong, as you will see in the following picture even though we built the presentation to have the notes on the “right” dspdfviewer was able to work as expected even when the secondary screen was on top of the primary.

Latex / Beamer: Change footline for Boadilla theme

Having a presentation title that was too long, we wanted to change the middle part of the footline on the Boadilla theme to replace the command for the document title (\insertshorttitle) with the command for document subtitle (\insertshortsubtitle).

To do so, we added the following right before the \begin{document} command.

    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
      \usebeamerfont{author in head/foot}\insertshortauthor\expandafter\ifblank\expandafter{\[email protected]}{}{~(\insertshortinstitute)}
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
      \usebeamerfont{title in head/foot}\insertshortsubtitle%\insertshorttitle
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
      \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
      \usebeamertemplate{page number in head/foot}\hspace*{2ex} 

When compiling the PDF, the result was as expected but we were getting a lot of errors for Undefined Control Sequence in various objects like the \begin{document} and \end{frame} commands. After modifying the following line (for the author name and institution) from this:

\usebeamerfont{author in head/foot}\insertshortauthor\expandafter\ifblank\expandafter{\[email protected]}{}{~~(\insertshortinstitute)}

to this:

\usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)

The errors were gone and the results were again the same. The final block that was properly working with no additional errors is the following:

    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
      \usebeamerfont{author in head/foot}\insertshortauthor~~(\insertshortinstitute)
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
      \usebeamerfont{title in head/foot}\insertshortsubtitle
    \begin{beamercolorbox}[wd=.333333\paperwidth,ht=2.25ex,dp=1ex,right]{date in head/foot}%
      \usebeamerfont{date in head/foot}\insertshortdate{}\hspace*{2em}
      \usebeamertemplate{page number in head/foot}\hspace*{2ex} 

Compile ffmpeg with video stabilization (vidstab) support on Ubuntu 20.04 LTS

Below are the commands to build vid.stab and ffmpeg on Ubuntu 20.04LTS. (We did not include libaom).

sudo apt-get install build-essential cmake nasm libx264-dev libx265-dev libnuma-dev libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev libunistring-dev
mkdir ~/ffmpeg_sources ~/ffmpeg_build ~/bin
cd ~/ffmpeg_sources
wget -O
cd vid.stab-master
cmake -DCMAKE_INSTALL_PREFIX:PATH=~/ffmpeg_build .
make install
sudo apt-get update -qq && sudo apt-get -y install \
autoconf \
automake \
build-essential \
cmake \
git-core \
libass-dev \
libfreetype6-dev \
libgnutls28-dev \
libsdl2-dev \
libtool \
libva-dev \
libvdpau-dev \
libvorbis-dev \
libxcb1-dev \
libxcb-shm0-dev \
libxcb-xfixes0-dev \
pkg-config \
texinfo \
wget \
yasm \
wget -O ffmpeg-snapshot.tar.bz2 && \
tar xjvf ffmpeg-snapshot.tar.bz2 && \
cd ffmpeg && \
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
--prefix="$HOME/ffmpeg_build" \
--pkg-config-flags="--static" \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--extra-libs="-lpthread -lm" \
--bindir="$HOME/bin" \
--enable-gpl \
--enable-gnutls \
--disable-libaom \
--enable-libass \
--enable-libfdk-aac \
--enable-libfreetype \
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 \
--enable-nonfree \
--enable-libvidstab && \
PATH="$HOME/bin:$PATH" make && \
make install && \
hash -r
source ~/.profile

Using vid.stab with default parameters and two step process.

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/ffmpeg_build/lib
ffmpeg -i input.mp4 -vf vidstabdetect -f null -;
ffmpeg -i input.mp4 -vf vidstabtransform,unsharp=5:5:0.8:3:3:0.4 output.vid.stab.mp4;

Using deshake filter for comparison.

ffmpeg -i input.mp4 -vf deshake output.deshake.mp4

Rough note on ffmpeg: Merge Two Videos Side by Side

The following command will create a video from two input files and place them side by side using the hstack filter.

ffmpeg -i left.mp4 -i right.mp4 -filter_complex hstack output.mp4;

More information on the hstack filter:

11.104 hstack
Stack input videos horizontally.
All streams must be of same pixel format and of same height.
Note that this filter is faster than using overlay and pad filter to create same output.
The filter accepts the following option:
Set number of input streams. Default is 2.
If set to 1, force the output to terminate when the shortest input terminates. Default value is 0

You can use the vstack filter in case you want to place the one video above the other.