HOWTOs

Emergency lines:

How to make a tunel to local server on diffent computer?

  ssh -N -f -M -S mysocket -L localhost:8000:localhost:8000 login@adress
  ssh -S mysocket -O exit login@adress

How to make your life easier?

  tmux
  Ctr-B D
  tmux attach

How to create an animated gif?

convert -delay 20 -loop 0 *.png  animation.gif

How to disable the sleep button on Ubuntu?

Find the number of the button (150 was for me):
  xmodmap -pk | grep -i sleep
Edit the file
 /usr/share/X11/xkb/keycodes/evdev 
and comment the line:
  //  = 150; // #define KEY_SLEEP    142
Other ways (dconf editor and command line gsetting set) didn't work for me :(.

How to install a local repository via pip ?

  $pip install -e .

How to iterate through pandas data frame?

the most efficient way to iterate through pandas dataframe

How to mount UI disks ?

  $sshfs petra@SOVAHOME.cs.cas.cz/[U_HOME,T_SHARE]/ MOUNTPOINT

And unmount?

  $ fusermount -u MOUNTPOINT

How to find tag creation date in git ?

  $ git log --tags --simplify-by-decoration --pretty="format:%ai %d"

How to label figures and tables in LaTeX?

How to run cProfile from command line?

  $ python -m cProfile -s cumtime myscript.py

How to change your default shell ?

Run:
  $ chsh 

How to submit a job into a que to be run after another task?

How to comment/uncomment multiple lines with emacs?

How to define which GPU will be used?

How to join PDF files of different page sizes?

How to compare two PDF files?

The goal was to compare two PhD thesis, the old version and the version year later, i.e. more than hunderd pages, different number of pages, the majority of text in common.

How to compare two LaTeX sources?

How to convert plain text to postscript?

 $ a2ps -RB -1 --borders=no -o output.ps input.txt
Don't forget to specify -o output.ps , otherwise the output is send DIRECTLY TO THE PRINTER!.

How to make links in PDF clickable and nice by LaTeX?

  \usepackage{hyperref}

  \hypersetup{
    colorlinks=true,
    linkcolor=blue,
    filecolor=blue,      
    urlcolor=blue}
  
  \urlstyle{same}

  ...

  \href{http://www.cs.cas.cz/petra}{My webpage}

How to include animated gif in pdf from LaTeX?

  1. Convert animation.gif into sequence of jpgs:
          # convert animation.gif animation.jpg
          # ls
          animation.gif    animation-10.jpg  animation-6.jpg  animation-9.jpg
          animation-0.jpg  animation-4.jpg   animation-7.jpg
          animation-1.jpg  animation-5.jpg   animation-8.jpg
        
  2. Use animate LaTeX package:
        ...
        \usepackage{animate}
        ...
        \animategraphics[loop,controls,width=9cm]{1}{animation-}{0}{9}
      

How to make Python programming convenient in Emacs?

Great overview is at Real Python's Emacs – The Best Python Editor? .

How to convert one encoding to another?

List available encodings:
  $ iconv -l 
Convert from WINDOWS-1250 to utf-8:
  $ iconv -f WINDOWS-1250 -t utf-8 input_file.txt > output_file.txt 
To detect encoding:
  $ file --mime-encoding myfile.txt

Conda

  $ conda create -n my_env_name python=3.7  # create environment
  $ conda activate my_env_name              # activate environment
  $ conda install scikit-learn              # conda install sklearn does not work!
  $ conda list -e > requirements.txt        # create list of installed packages
  $ conda env list                          # list available environments	
conda cheet sheet

Git: how to checkout a file from another branch

  $ git branch
  * my_actual_branch
    different_branch 
    master
  $ git checkout different_branch -- wanted_file.txt
  $ git commit -m "Update wanted_file.txt from different_branch"

How to travel through time?

No idea yet.