HOWTOs
Emergency lines:
- Maršík Petr 3411
- Šimek Jiří 3216
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?
- Alwayes first caption, label goes after
the caption.
-
If you put the label before the caption you will get a reference to the section.
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?
- run after another job successfully finished
$ qsub -W depend=afterok:$JOBID job.sh
- run after another job finished
$ qsub -W depend=afterany:$JOBID job.sh
- chaining more jobs
#!/bin/bash
last=$(qsub -v JOB_ID=1 job.pbs)
echo $last
for i in `seq 2 10`
do
last=$(qsub -W depend=afterok:$last -v JOB_ID=$i job.pbs)
echo $last
done
How to comment/uncomment multiple lines with emacs?
- Emacs' commands: M-x comment-region, M-x uncomment-region
- Prefix every line with a character: C-x r t
How to define which GPU will be used?
- CUDA_VISIBLE_DEVICES
To use it, set CUDA_VISIBLE_DEVICES to a comma-separated list of device IDs to make only those devices visible to the application.
Note that you can use this technique both to mask out devices or to change the visibility order of devices so that the CUDA runtime
enumerates them in a specific order.
$ CUDA_VISIBLE_DEVICES=3 python test.py
- In code: (when using Keras)
num_GPU = 1
config = tf.ConfigProto(allow_soft_placement=True,
device_count = {'GPU' : num_GPU})
session = tf.Session(config=config)
K.set_session(session)
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?
- 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
-
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.