Linux:Tips Tricks

user config
wget https://raw.github.com/musinsky/config/master/Git/gitconfig -O ~/.gitconfig wget https://raw.github.com/musinsky/config/master/Emacs/emacs -O ~/.emacs wget https://raw.github.com/musinsky/config/master/astyle/astylerc -O ~/.astylerc

yum

 * http://dnf.readthedocs.org/en/latest/cli_vs_yum.html
 * https://mojefedora.cz/jak-na-aktualizace-ve-fedore/

dnf upgrade --refresh dnf download --source astyle dnf --enablerepo=rawhide download --source astyle dnf download --source --enablerepo=rawhide astyle dnf --enablerepo=updates-testing update firefox dnf builddep astyle.spec  # unzip spec from downloaded source file dnf search all "GTK+ lib" # search in packages description dnf provides \*bin\*clang-format dnf provides \*eclipse.ini dnf list installed \*.i\?86 dnf remove \*.i\?86 dnf list installed | grep @commandline

dnf install sqlite  # need for tab completion of package names in DNF

dnf repolist dnf repository-packages rpmfusion-nonfree remove dnf repository-packages rpmfusion-nonfree list

https://kojipkgs.fedoraproject.org/packages/emacs/ https://kojipkgs.fedoraproject.org/packages/cernlib/ https://kojipkgs.fedoraproject.org/packages/cmake/

$ yum list \*spell\* $ yum search all zenity $ yum provides /etc/httpd\* $ yum provides \*/libpng12.so.0 $ yum provides /*isoinfo $ yum --enablerepo=rawhide update firefox $ yum history list $ yum history packages-list firefox $ yumdownloader phpMyAdmin mc.x86_64 $ yumdownloader --source --enablerepo=rawhide emacs $ yum-builddep emacs Ak je potrebne aby sa v niektorej repository pracovalo len s (reps. bez) konkretneho balika, mozeme pouzit (resp. ) options; nepouzivat znak ' \ ' ako v pripade prikazu yum [russianfedora-fixes] enabled=1 includepkgs=fontconfig* freetype* V priapde viacerych repositories pre balik(y) sa odporuca pouzit options v kombinacii s  utility clean_requirements_on_remove=1
 * http://yum.baseurl.org/wiki/Guides
 * http://docs.fedoraproject.org/en-US/Fedora/16/html/System_Administrators_Guide/ch-yum.html
 * http://wiki.centos.org/AdditionalResources/Repositories/CentOSPlus
 * http://wiki.centos.org/PackageManagement/Yum/Priorities
 * Nezapinat Russian Fedora fixes repository, inak po update sa Fedora premeni na RFRemix distribuciu (vratane mena, loga a pod.)

$ yum install --nogpgcheck http://mirror.yandex.ru/fedora/russianfedora/russianfedora/free/fedora/russianfedora-free-release-stable.noarch.rpm        # mediainfo $ yum install --nogpgcheck http://mirror.yandex.ru/fedora/russianfedora/russianfedora/nonfree/fedora/russianfedora-nonfree-release-stable.noarch.rpm  # flash-plugin, skype

disable xdg-user-dirs
enabled=False alebo jednoducho vymazat cely package

add application
Program (aplikaciu) pridame do systemoveho menu vytvorenim suboru, ikona subor pre danu aplikaciu sa default hlada v  a moze zavisiet od pouzitej temy, prostredia. [Desktop Entry] Name=PrograName Comment=Example program Exec=program-name          # Exec=/path/to/exec/program-name Type=Application Icon=program-name          # Icon=/path/to/icons/program-name.png StartupNotify=true Categories=GNOME;Application;Development;

manpath
urcuje (precita configuration file ), kde vsade sa budu hladat manualove stranky. Ak je napr. zadefinovana cesta tak sa automaticky budu hladat manualove stranky aj v, avsak len dovtedy pokial nie zadefinovana premenna $ manpath manpath: warning: $MANPATH set, ignoring /etc/man_db.conf /cern/root/man/man1:/cern/root/man:/usr/share/man $ unset MANPATH $ manpath /cern/root/man:/usr/share/man

man -Lru man man -Lcs socket man -Lru 2 open alias man='man --locale=cs'
 * https://www.kernel.org/doc/man-pages/
 * http://man7.org/linux/man-pages/index.html

man 2 intro     > 2014-02-20 man -Lru 2 intro > 2010-11-11 man -Lcs 2 intro > 18.ledna 1997 (very OLD)

$ man --html=firefox bash $ yelp man:bash $ yelp info:bash

.bash_profile vs .bashrc

 * is executed for login shells (personal initialization file), while is executed for interactive non-login shells (individual per-interactive-shell startup file)
 * is executed when login via console or remotely via ssh. load  (in Fedora)
 * is executed when open a new terminal window or when start a new bash instance by typing in a terminal

multiple commands in one line in shell
To summarize (non-exhaustively) bash's command operators/separators

locale
$ locale LANG=en_US.UTF-8 LC_CTYPE="en_US.UTF-8" LC_NUMERIC=en_GB.UTF-8 LC_TIME=en_GB.UTF-8 LC_COLLATE="en_US.UTF-8" LC_MONETARY=en_GB.UTF-8 LC_MESSAGES="en_US.UTF-8" LC_PAPER=en_GB.UTF-8 LC_NAME="en_US.UTF-8" LC_ADDRESS="en_US.UTF-8" LC_TELEPHONE="en_US.UTF-8" LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION="en_US.UTF-8" LC_ALL=
 * 1) GNOME settings: Language => 'en_US.UTF-8' and Formats => 'en_GB.UTF-8'

$ locale -ck LC_PAPER LC_PAPER height=297 width=210 paper-codeset="UTF-8"

$ export LC_PAPER=en_US.UTF-8 $ locale -ck LC_PAPER LC_PAPER height=279 width=216 paper-codeset="UTF-8"
 * v praxi ma asi zmysel menit len (tlac na A4) a  (D/M/Y, tyzden zacina pondelkom)
 * pozor zmena napr. moze pozmenit pravidla pre triedenie,  napr. zamiena desatinu ciarku a bodku v zavislosti od konkretneho jazyka
 * hodnoty ovpyvnuju LibreOffice len velmi malo,  determines the general locale data setting,  determines the UI language,  determines the paper configuration (if libpaper is not available)

export LC_PAPER='en_GB.UTF-8' export LC_TIME='en_GB.UTF-8'

autofs
yum install autofs

systemctl enable autofs.service systemctl start autofs.service

cd /net cd strela-stor.jinr.ru cd strela205

dd
dd if=/path/to/iso/file.iso of=/dev/sdX dd if=/dev/sdX of=/path/to/iso/file.iso

livecd-iso-to-disk
dnf install livecd-iso-to-mediums

livecd-iso-to-disk --format --reset-mbr /home/musinsky/boot.iso /dev/sdc    # This will DESTROY ALL DATA on: /dev/sdc
 * http://linuxsoft.cern.ch/cern/centos/7/os/x86_64/images/
 * linuxsoft.cern.ch/cern/centos/7/os/x86_64/images/boot.iso

Disk /dev/sdc: 7.5 GiB, 8054112256 bytes, 15730688 sectors Units: sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disklabel type: dos Disk identifier: 0x5755f6cd
 * 1) fdisk -l

Device    Boot Start      End  Sectors  Size Id Type /dev/sdc1 *     8192 15726591 15718400  7.5G 83 Linux

/dev/sdc1: LABEL="LIVE" UUID="e61cbf0c-2b7e-48ef-9b94-c3c2e5fb2f4a" TYPE="ext4" PARTUUID="5755f6cd-01"
 * 1) blkid

nmap
nmap -sP 10.0.0.0/24 nmap -sn 10.0.0.0-199 nmap -sL 10.0.0.* | grep \(10

pgrep and pmap
[musinsky@alice ~]$ pgrep -l root 5006 root 5007 root.exe

[musinsky@alice ~]$ pmap 5007 5007:  /cern/root_v5.34.06/bin/root.exe -splash -l 0000000000400000     8K r-x--  /cern/root_v5.34.06/bin/root.exe 0000000000601000     4K r  /cern/root_v5.34.06/bin/root.exe 0000000000602000     4K rw---  /cern/root_v5.34.06/bin/root.exe 0000000002144000  8536K rw---    [ anon ] ... 00007ff4fadbb000  7104K r-x--  /cern/root_v5.34.06/lib/libCore.so 00007ff4fb4ab000   2044K -  /cern/root_v5.34.06/lib/libCore.so 00007ff4fb6aa000    168K r  /cern/root_v5.34.06/lib/libCore.so 00007ff4fb6d4000     56K rw---  /cern/root_v5.34.06/lib/libCore.so 00007ff4fb6e2000    520K rw---    [ anon ] 00007fffbbcce000   244K rw---    [ stack ] 00007fffbbdfe000     8K r-x--    [ anon ] ffffffffff600000     4K r-x--    [ anon ] total           92108K

flush memory cache
sync; echo 3 > /proc/sys/vm/drop_caches sync && echo 3 > /proc/sys/vm/drop_caches && sync
 * http://tecadmin.net/flush-memory-cache-on-linux-server/

./depcomp: No such file or directory
automake --add-missing

date in terminal
while sleep 1; do tput sc; tput cup 0 $(($(tput cols)-29)); date; tput rc; done &

GCC discovery options
yum install libasan liblsan libtsan libubsan -fsanitize=address -fno-omit-frame-pointer -fsanitize=undefined
 * http://developerblog.redhat.com/2014/10/16/gcc-undefined-behavior-sanitizer-ubsan/
 * http://blog.qt.digia.com/blog/2013/04/17/using-gccs-4-8-0-address-sanitizer-with-qt/
 * http://spin.atomicobject.com/2013/10/20/clang-compiler/

$ g++ -Q --help=warnings > warnings_default $ g++ -Wextra -Q --help=warnings > warnings_extra $ g++ -Q --help=common | grep sanitize $ g++ -Q --help=warnings | grep format -Wformat -Wformat-contains-nul      		[disabled] -Wformat-extra-args        		[disabled] -Wformat-nonliteral        		[disabled] -Wformat-security          		[disabled] -Wformat-y2k               		[disabled] -Wformat-zero-length       		[disabled] -Wformat=                  		0 -Wsuggest-attribute=format 		[disabled] $ g++ -Wformat=2 -Q --help=warnings | grep format -Wformat -Wformat-contains-nul      		[enabled] -Wformat-extra-args        		[enabled] -Wformat-nonliteral        		[enabled] -Wformat-security          		[enabled] -Wformat-y2k               		[enabled] -Wformat-zero-length       		[enabled] -Wformat=                  		0x2 -Wsuggest-attribute=format 		[disabled]
 * https://gcc.gnu.org/onlinedocs/gcc/Overall-Options.html

expand standard include files
echo '#include ' | cpp -I/usr/include > stdlib-expand.h echo '#include ' | cpp -I/usr/include | grep size_t

check compiler defined macros
$ gcc -E -dM - < /dev/null
 * http://sourceforge.net/p/predef/wiki/Home/

$ gcc -E -dM - < /dev/null | grep -i stdc_ver $ gcc -E -dM - < /dev/null | grep -i stdc_ver $ gcc -E -dM -std=gnu89 - < /dev/null | grep -i stdc_ver $ gcc -E -dM -std=gnu99 - < /dev/null | grep -i stdc_ver
 * 1) GCC 5 => The default mode for C is now -std=gnu11 instead of -std=gnu89
 * 2) gcc (GCC) 5.1.1 20150422 (Red Hat 5.1.1-1)
 * 1) define __STDC_VERSION__ 201112L
 * 1) gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
 * 1) define __STDC_VERSION__ 199901L

gfortran static
$ dnf install gcc-gfortran      # libgfortran libquadmath libquadmath-devel $ dnf install libgfortran-static # libquadmath-static $ dnf install glibc-static      # libxcrypt-static $ gfortran -static tidy.for -o tidy_static.exe

ExifTool
$ dnf install perl-Image-ExifTool $ exiftool image.jpg | grep -i date File Modification Date/Time    : 2016:02:29 17:30:15+01:00 File Access Date/Time          : 2016:02:29 17:30:15+01:00 File Inode Change Date/Time    : 2016:05:09 14:09:39+02:00 Modify Date                    : 2016:02:29 17:30:15 Date/Time Original             : 2016:02:29 17:30:15 Create Date                    : 2016:02:29 17:30:15 $ exiftool image.jpg | grep -i name File Name                      : 1.JPG Camera Model Name              : NIKON D5100 ICC Profile Name               : sRGB IEC61966-2.1 $ exiftool -createdate. $ exiftool -filename. $ exiftool -filename -createdate -T.

exiftool '-FileModifyDate<CreateDate'. exiftool '-FileModifyDate<DateTimeOriginal' -r *.jpg

See the -w option in the exiftool application documentation for details about special features available with these name format codes. Extra % necessary to escape the filename codes. %%c, %%d, %%f, %%e copy number (counter), directory, file name, extension of the original FILE. All format codes may be modified by l or u to specify lower or upper case respectively (ie. %%le for a lower case file extension). A special feature allows the copy number to be incremented for each processed file by using %%C (upper case) instead of %%c.

exiftool '-FileName<CreateDate' -d BEFORE_%Y%m%d_AFTER.%%e image.jpg exiftool '-FileName<CreateDate' -d BEFORE_%Y%m%d_AFTER_%%.5c.%%e. # 5digit copy number start from 0 (%%.5c), if use (%%5c) first (0) copy number is not used exiftool '-FileName<CreateDate' -d BEFORE_%Y%m%d_AFTER_%%.3nc.%%e. # 3digit copy number start from 1 exiftool '-FileName<CreateDate' -d BEFORE_%%111.3C.%%e. # 3digit copy number (each processed file) start from 111 exiftool '-FileName<CreateDate' -d BEFORE_%Y%m%d_XX_%%lf_YY_%H%M%S_AFTER.%%le.

$ for f in *.JPG; do convert -resize 50% -quality 75 "$f" "RQ_$f"; done $ for f in *.JPG; do convert -quality 75 "$f" "Q_$f"; done $ exiftool '-FileModifyDate prefer pdftops
 * apart from the pdftops tool, the poppler-utils package also provides some other interesting toosl: pdfinfo (PDF document information extractor), pdfimages (PDF image extractor), pdftohtml (PDF to HTML converter), pdftotext (PDF to text converter), and pdffonts (PDF font analyzer)

miscellaneous commands
apropos fopen iconv -f UTF-8 -t ASCII//TRANSLIT text_diakritika locale -a | grep -E 'RU|ru' export LC_ALL="ru_RU.utf8" export LC_ALL="sk_SK.utf8" tar cvfz archive_name.tar.gz dirname/ tar xvfz archive_name.tar.gz tar cvfj archive_name.tar.bz2 dirname/ tar xvfj archive_name.tar.bz2 ldd /usr/bin/skype | grep lib | awk '{print $3}' | xargs rpm -qf | sort | uniq sed -i 's/old-text/new-text/g' /path/to/file sed -i 's/\x27-\x27/\x27+\x27/g' /path/to/file    # replace  '-'  by  '+' , hexa code for  '  is x27 sed -i s/"'-'"/"'+'"/g /path/to/file              # replace  '-'  by  '+'  tail -F logfile.txt sed ':a;N;$!ba;s/\n/\\n/g' /path/to/file          # replace end of line by \n sed -i '22,33s/old-text/new-text/g' /path/to/file       # replace from line 22 to line 33 sed -i '22,$s/old-text/new-text/g' /path/to/file        # replace from line 22 to end of file sed -i '/regex/,+11s/old-text/new-text/g' /path/to/file # replace from line with word 'regex' and next 11 lines git clone --depth 1 git://git.savannah.gnu.org/emacs.git iconv -f KOI8-R -t UTF8 < ru_RU.dic > ru_RU.dic.utf8 iconv -f encoding -t UTF8 < input.txt > output.txt iconv -l | grep 1250 find /etc -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort -r pdfinfo -rawdates source_file.pdf CreationDate:  D:20120229154202+01'00' ModDate:       D:20120229154447+01'00' file pdf_marks [ /ModDate (D:20120229154447) /CreationDate (D:20120229154202) /DOCINFO pdfmark gs -dBATCH -dNOPAUSE -dSAFER -sDEVICE=pdfwrite -sOutputFile=final_files.pdf input_file.pdf pdf_marks gs -dBATCH -dNOPAUSE -dSAFER -sDEVICE=pdfwrite \ -dFirstPage=12 -dLastPage=17 -sOutputFile=outfile_p12-p17.pdf inputfile.pdf gs -dBATCH -dNOPAUSE -dSAFER -sDEVICE=pdfwrite \ -sOutputFile=outfile_joined.pdf inputfile1.pdf inputfile2.pdf gs -dBATCH -dNOPAUSE -dSAFER -sDEVICE=pdfwrite -sOutputFile=output.pdf input.pdf gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pngalpha -r100 -dUseCropBox \ -sOutputFile=output.png input.pdf gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 \ -sOutputFile=output.png input.pdf gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pnggray -r400 -dTextAlphaBits=4 \ -sOutputFile=output.png input.pdf -colorspace Gray gs -dBATCH -dNOPAUSE -dSAFER -sDEVICE=pdfimage8 \                   # pdfimage8, pdfimage24, pdfimage32 -dFirstPage=3 -dLastPage=3 -sOutputFile=p3.pdf inputfile.pdf  # render input to a bitmap, ideal for 2D histrogram (vector image with huge number of points) # gs -dFirstPage=18 -dLastPage=18 -sDEVICE=pdfwrite -dFILTERIMAGE -dFILTERVECTOR -o p18_onlytext.pdf input_file.pdf gs -dFirstPage=18 -dLastPage=18 -sDEVICE=pdfimage24 -dFILTERTEXT -o p18_onlyimages.pdf input_file.pdf  # gs direct convert to raster image (DEVICE=pdfimage24) or convert manually pdftk p18_onlytext.pdf background p18_onlyimages.pdf output p18_new.pdf  # (or multibackground for more pages) pdftk p18_onlyimages.pdf stamp p18_onlytext.pdf output p18_new.pdf       # same as previous (or multistamp for more pages) pdftk A=input_file.pdf B=p18_new.pdf cat A1-17 B A19-23 output input_file_new.pdf dnf install snapd snap install pdftk a2ps --medium=a4 -r --columns=1 --font-size=11 -o magnet.ps magnet.txt pdfcrop --clip schema.pdf pdfcrop --margins '5 10 5 5' --clip schema.pdf schema_crop.pdf pdfcrop --margins '-120 -20 -120 -422' --clip out.pdf out_vycuc.pdf pdfcrop --margins '0 30 0 10' --clip cham_wires.pdf # clip zvacseny o okraje zhora 30, zdola 10 pdfjam 1.pdf 2.pdf 3.pdf 4.pdf --nup 2x2 --landscape --outfile all_in_one.pdf  # --frame true --fitpaper true convert drift_velocity.png -bordercolor white -border 0x30 -crop 0x0+0-20 final.png # obrazok zvacseny o okraje zhora 30, zdola 10 convert -transparent white strela_logo.png strela_logo_new.png convert -transparent white -resize 32 -depth 2 output.eps alice_icon32.png epstool --test-eps Four_Colors_Logo.eps  # File has   %%BoundingBox: 0 0 393 513     Correct is %%BoundingBox: 47 47 393 513 eps2eps Four_Colors_Logo.eps Four_Colors_Logo_OK.eps epstool --copy --bbox Four_Colors_Logo_OK.eps Four_Colors_Logo_final.eps convert -transparent white -resize x135 -depth 4 Four_Colors_Logo_OK.eps alice_logo_color.png convert -auto-level -bordercolor white -border 70x70 -resize x135 -depth 4 -transparent white One_Color_Logo_OK.eps alice_logo_black.png # default depth is 16 convert -auto-level -bordercolor white -border 70x70 -resize x135 -transparent white -define png:format=png8 One_Color_Logo_OK.eps alice_logo_black.png convert -bordercolor white -border 70x70 -resize x135 -transparent white -define png:format=png8 Four_Colors_Logo_OK.eps alice_logo_color.png convert -auto-level -auto-gamma -bordercolor white -border 16x16 -resize 32x32 -transparent white -define png:format=png8 One_Color_Logo_final.eps alice_icon_black.png convert -colorspace Gray -threshold 99% -resize x96 -depth 8 logo_CERN_final.eps logo_CERN.png convert -auto-level -background white -alpha remove -define png:format=png8 -define png:bit-depth=1 input.png output.png # don't resize convert -auto-level -background white -alpha remove -resize 794 -define png:format=png8 input.png output.png # 794x1123 px = A4 96 dpi, 2480x3508 px = A4 300dpi dnf install pngquant pngnq convert -resize 50% -depth 1 strela_2007-03.png strela_2007-03_OK.png convert input.png -background white -alpha remove -alpha off output.png     # img2pdf (transparency which cannot be retained in PDF) convert -colorspace Gray -depth 1 -background white -alpha remove -alpha off scan.png scanOK.png  # -resize 50% for file in *; do f=$(basename -s .png "$file")_OK.png; convert -colorspace Gray -depth 1 -background white -alpha remove -alpha off "$file" "$f"; done img2pdf --pagesize A4 --auto-orient --fit fill --creationdate "2004-11-11 11:11:11" -o all_out.pdf *_OK.png  # time is UTC https://unix.stackexchange.com/questions/20026/convert-images-to-pdf-how-to-make-pdf-pages-same-size dnf install python3-img2pdf python3-pillow img2pdf --pagesize A4 -o all_out.pdf *.png # !!! NAJ !!! metoda png->pdf, bez stratova (ale OK aj pre jpg) img2pdf --pagesize A4 --auto-orient --fit fill -o out.pdf *.jpg fallocate -l 13G big13GB.dat ls -l /proc/2982/fd lsof -p 2982 lsof -p `pgrep root.exe` wget -r -nH -np -R index.html* http://example.com/dir1/dir2/dir3 watch -n 0.1 ls -al /var/log/ find. -maxdepth 1 -type f -name "* *" find. -maxdepth 1 -type f -name "* *" | while read file; do mv -v "$file" ${file// /_}; done for file in *; do mv -v "$file" "${file// /_}" ; done prename -vn 's/ABC/123/' *.txt  # ABC zameni na 123 prename -vn 's/^/OK_/' *        # "prefix" pred nazov subora OK_ prename -vn 's/\.cs\./.cze./' * #  ".cs." -> ".cze."
 * 1) http://gskinner.com/RegExr/
 * 2) http://www.regextester.com/
 * 1) http://milan.kupcevic.net/ghostscript-ps-pdf/
 * 1) https://stackoverflow.com/questions/9607687/replacing-vector-images-in-a-pdf-with-raster-images
 * 2) https://www.linux.org.ru/forum/general/12660253
 * 1) replace vector image in pdf (or ps) file with raster, bitmap image
 * 2) objects of that type will not be rendered/output: FILTERIMAGE (raster, bitmap images), FILTERVECTOR (vector images), FILTERTEXT (text)
 * 1) finally
 * 1) pdftk under Fedora
 * 1) reboot PC
 * 1) https://github.com/lehner/gpdfx
 * 1) vyreze "clip" a prida "okraje" (vlavo, hore, vpravo, dole)
 * 1) pridat okraje bielej farby zhora a zdola o velkosti 30 a zlava a sprava o velkosti 0, nasledne oreze o 0x0 ale zdola este o 20
 * 1) eps
 * 1) order of options in convert command is important !!!
 * 1) value png8 reduces the number of colors to 256, only one of which may be fully transparent, if necessary (valid values are png8, png24, png32, png48, png64, and png00)
 * 1) reduce file size
 * 1) quickly create a large file
 * 1) list open files for process
 * 1) recursively fetch a directory with arbitrary files
 * 1) find and replace space with underscore in file name
 * 1) dnf install prename (Perl script to rename multiple files)

miscellaneous commands 2
rclone sync /home/musinsky/CLOUD_yandex/ remote_yandex: -v --dry-run

touch -d "2016-09-27 12:12:12" file.pdf touch -r refer.ps file.pdf FFF=projekt_Piskunov.pdf; touch -d "`exiftool -T -d "%Y-%m-%d %H:%M:%S" -createdate $FFF`" $FFF touch -d "`exiftool -T -d "%Y-%m-%d %H:%M:%S" -modifydate Nik_alepto.pptx`" Nik_alepto.pdf         # dnf install perl-Archive-Any (Warning : Install Archive::Zip to decode compressed ZIP information)

http://u88.n24.queensu.ca/exiftool/forum/index.php?topic=3523 $ exiftool -a -s -G1 -time:all aaa.pdf [System]       FileModifyDate                  : 2012:09:20 05:58:54+04:00 [System]       FileAccessDate                  : 2019:03:19 17:28:59+03:00 [System]       FileInodeChangeDate             : 2019:03:19 17:28:31+03:00 [PDF]          CreateDate                      : 2019:03:19 14:14:02+00:00 [PDF]          ModifyDate                      : 2019:03:19 14:14:02Z $ exiftool "-CreateDate<FileModifyDate" "-FileModifyDate<FileModifyDate" aaa.pdf 1 image files updated $ exiftool -a -s -G1 -time:all aaa.pdf [System]       FileModifyDate                  : 2012:09:20 05:58:54+04:00 [System]       FileAccessDate                  : 2012:09:20 05:58:54+04:00 [System]       FileInodeChangeDate             : 2019:03:19 17:29:27+03:00 [XMP-xmp]      CreateDate                      : 2012:09:20 05:58:54+04:00 [PDF]          CreateDate                      : 2012:09:20 05:58:54+04:00 [PDF]          ModifyDate                      : 2019:03:19 14:14:02Z $ pdfinfo aaa.pdf | grep -i date CreationDate:  Thu Sep 20 05:58:54 2012 MSK ModDate:       Tue Mar 19 17:14:02 2019 MSK

$ exiftool "-modifydate<filemodifydate" $ exiftool "-filemodifydate<createdate" -r dir_name -ext pdf  # recursive all *.pdf in dir_name $ exiftool -tagsFromFile source_file -ModifyDate -FileModifyDate target_file $ exiftool -tagsFromFile source_file -time:all -FileModifyDate target_file

exiftool -if "$DateTimeOriginal ne $CreateDate" -Title="Timestamp discrepancy" -r FileOrDir
 * 1) dalej na studium

$ exiftool "-FileModifyDate<CreateDate" -r. -ext pdf $ exiftool "-FileModifyDate<ModifyDate" -r. -ext doc  # !!! MS-DOC:ModifyDate !!! $ exiftool -tagsFromFile source_file.pdf -CreateDate "-FileModifyDate<CreateDate" target_file.pdf $ exiftool -tagsFromFile spin12_piskunov.ppt "-CreateDate<ModifyDate" "-FileModifyDate<ModifyDate" spin12_piskunov.pdf  # # !!! FlashPix:ModifyDate !!! $ exiftool "-CreateDate<FileModifyDate" "-FileModifyDate<FileModifyDate" -r. -ext pdf
 * 1) FINAL
 * 2) vsetky *.pdf subory v current dir zameni System:FileModifyDate na PDF:CreateDate   !!! checkovat ci PDF:CreateDate alebo PDF:ModifyDate !!!
 * 1) subor target_file.pdf ma zameneny System:FileModifyDate (ktory je zaroven zameneny na PDF:CreateDate zo source_file.pdf) a PDF:CreateDate hodnotami zo source_file.pdf
 * 2) !!! target_file.pdf sa meni (velkost), kedze sa menia MetaData !!!
 * 1) vsetky *.pdf subory v current dir zameni PDF:CreateDate na System:FileModifyDate a "zanecha" povodny System:FileModifyDate !!! checkovat ci PDF:CreateDate alebo PDF:ModifyDate !!!
 * 2) ak som predtym prerobil pdf subor (a teda v MetaData su nespravne datumy), ale subor ma aspon spravny System:FileModifyDate

burn VOB files
contains and  folders $ mkisofs -dvd-video -o image.img /path/to/DVDFilm/ $ growisofs -dvd-compat -speed=4 -Z /dev/dvd=image.img

GTK+ Color Selection Dialog
$ zenity --color-selection --show-palette
 * http://library.gnome.org/users/zenity/stable/color-selection.html.en

Firefox configuration
yum install libva-intel-driver (and installed package) XDG_DESKTOP_DIR="$HOME/" XDG_DOWNLOAD_DIR="$HOME/" XDG_DESKTOP_DIR="/home/musinsky/" ln -s $HOME/.mozilla/firefox/*.default/persdict.dat $HOME/.hunspell_sk-SK-ascii
 * disable auto creation dir (under linux)
 * 1) dont use "~"
 * 2) "/" at the end of line is important
 * sharing personal dictionary (slovak ASCII) between Firefox and hunspell in emacs
 * Profile-sync-daemon
 * http://rgrunber.wordpress.com/2014/09/29/reducing-disk-io-with-profile-sync-daemon/

about:config pdfjs.disabled                    true mousewheel.with_control.action    0 mousewheel.acceleration.factor    10 mousewheel.acceleration.start     1 plugins.click_to_play             true
 * disable native PDF viewer
 * disable scroll wheel zoom
 * acceleration scroll wheel
 * click-to-play plugins

Default application
or

CERN Certification Authority

 * CERN Certification Authority
 * CERN Grid Certificates


 * Create new certificate
 * https://ca.cern.ch/ca/ => New Grid User Certificate => create new certificate (with password) and download, install in browser (Firefox)


 * Export public key
 * Backup my new certificate from Firefox (Preferences => Advanced => Certificates => View Certificates => Your Certificates) as file


 * Convert to PEM Keypair
 * To use a Certificate with Globus, you need to convert it to PEM format Key pair, in 2 separate files, one for the key itself, and one for the certificate.
 * Extract certificate (which contains the public key) openssl pkcs12 -in musinsky.p12 -clcerts -nokeys -out usercert.pem
 * Get the encrypted private key openssl pkcs12 -in musinsky.p12 -nocerts -out userkey.pem

chmod 444 musinsky.p12 usercert.pem chmod 400 userkey.pem  # must be read-only by the owner mkdir ~/.globus mv musinsky.p12 usercert.pem userkey.pem ~/.globus


 * https://gridca.cern.ch/gridca/Help/?kbid=040111
 * https://gridca.cern.ch/gridca/Help/?kbid=023010
 * https://gridca.cern.ch/gridca/Help/?kbid=024010


 * [VOMS Admin] Request to sign VO alice acceptable usage policy (AUP).
 * VOMS Admin for VO alice [project-lcg-vo-alice-admin@cern.ch]
 * You are requested to sign the VO alice Acceptable Usage Policy (AUP) in order to continue to be part of the alice VO.
 * To sign the AUP, point your browser to the following URL: https://lcg-voms2.cern.ch:8443/voms/alice/sign-aup
 * Please ensure that you connect to the above URL with a valid certificate linked to your VO membership installed in the browser => in browser


 * Grid re-registering with a new certificate (alice VOMRS)
 * The certificate should have already been-loaded on your browser
 * https://lcg-voms.cern.ch:8443/vo/alice/vomrs (choose new certificate) => Member Info -> Re-sign Grid and VO AUPs


 * http://alien2.cern.ch/index.php?option=com_content&view=article&id=17&Itemid=90
 * http://alien2.cern.ch/index.php?option=com_content&view=article&id=25&Itemid=72

Po prihlaseni (s novym certifikatom) uz nie je potrebne robit nic dalej. Na "Certificate Info" vidno, ze uz expirujem s novym certifikatom, zasa o rok neskor.
 * https://lcg-voms2.cern.ch:8443/voms/alice/
 * https://voms2.cern.ch:8443/voms/alice/

test: ssh lxplus.cern.ch alienv enter VO_ALICE@AliPhysics::vAN-20160629-1 alien-token-init
 * 1) copy "new" .globus dir

Printing at CERN

 * https://printservice.web.cern.ch
 * https://printservice.web.cern.ch/printservice/UserTools/PrinterList.aspx

Configure for example printer 13-R006-HP 13-R006-HPBW in building 13, printer model HP LaserJet 4300
 * http://linux.web.cern.ch/linux/docs/printing-noncern.shtml
 * Select Device -> Network Printer -> LPD/LPR Host or Printer -> Location of the LPD network printer
 * Host:
 * Queue:
 * Choose Driver: HP -> Models: LaserJet 4300 -> Drivers: HP LaserJet 4300 Series Postscript[en] (recommended) 
 * Describe Printer
 * Printer Name:
 * Description:
 * Location:

Notes: for model HP LaserJet 4300 set Paper Source: Tray 2 (Tray 1 is for manual feed ?)

CERN Library Proxy Service

 * https://espace.cern.ch/webservices-help/CERNLibraryProxy/BrowserConfiguration/Pages/Firefox.aspx

https://library-proxy.web.cern.ch/proxy.pac After configuring your browser you can use the page http://cern.ch/library-proxy/test to see if the connection via the proxy work
 * Automatic proxy configuration URL

Printing at SASKE
Configure for example printer in room 328, printer model HP LaserJet 4200
 * Select Device -> Network Printer -> AppSocket/HP JetDirect -> Location of the network printer
 * Device URI: socket://10.0.0.4:9100
 * Host:
 * Port:


 * Select Device -> Network Printer -> Internet Printing Protocol (ipp) -> Enter device URI
 * Choose Driver: HP -> Models: LaserJet 4200 -> Drivers: HP LaserJet 4200 Series Postscript[en] (recommended) 
 * Choose Driver: HP -> Models: LaserJet 4200 -> Drivers: HP LaserJet 4200 Series Postscript[en] (recommended) 

Mail at SASKE
Webmail on saske: https://home.saske.sk

ssh musinsky@imapx.saske.sk Welcome on Central Mail, Slovak Academy of Sciences in Kosice (mail.saske.sk) Vasa posta je presmerovana na :blabla@bla.com

Sendmail on alice.saske.sk
dnl # Uncomment and edit the following line if your outgoing mail needs to dnl # be sent out through an external mail server: dnl # define(`SMART_HOST', `smtp.saske.sk')dnl dnl # and regenerate new config file with  command (must have installed sendmail-cf package) $ m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf $ systemctl restart sendmail.service

Direct (simple) solution, edit file DSsmtp.saske.sk
 * 1) "Smart" relay host (may be null)

Vidyo
yum install libXScrnSaver
 * https://vidyoportal.cern.ch
 * http://cern.ch/vidyo

VNC
TigerVNC server $ dnf install tigervnc-server
 * https://docs.fedoraproject.org/en-US/Fedora/25/html/System_Administrators_Guide/ch-TigerVNC.html

[user]$ vncpasswd    # created [user]$ vncserver    # created,  and log files

$ firewall-cmd --permanent --zone=FedoraServer --add-service=vnc-server $ firewall-cmd --reload currently on Fedora 25 not working due to wayland issue $ cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.service $ sed -i '/Unit/,$s//musinsky/g' /etc/systemd/system/vncserver@.service [user]$ vncpasswd $ systemctl daemon-reload $ systemctl enable vncserver@:1.service $ systemctl start vncserver@:1.service
 * vnc-server as service
 * 1) no need to include the display number in the file (systemd automatically creates the appropriately named instance in memory on demand)
 * 2) replacing  by actual user name musinsky (from regex ExecStart to end of line)
 * 1) add vnc-server to firewall

Case Convert

 * vsetko na male pismenka (all to lower case)
 * 1) for i in $( ls | grep [A-Z] ); do mv -i $i `echo $i | tr 'A-Z' 'a-z'`; done

cstocs
#
 * 1) dos2unix *
 * 1) cstocs -i kam utf8 *.tex
 * 2) cstocs -i tex utf8 *.tex   # from file perl5/Cz/Cstocs/enc/tex.enc removed this line: ~<>nobreakspace (~, \div, \times)
 * 3) cstocs -i tex utf8 *.pic
 * 1) recode KEYBCS2..UTF-8 *.tex
 * 1) cstocs kam utf8 < uvod.tex
 * 2) cstocs tex utf8 < uvodOK.tex

Bootable Windows 7 USB Drive in Linux

 * docasne vypnut gnome shell extension Removable Drive Menu
 * https://thornelabs.net/2013/06/10/create-a-bootable-windows-7-usb-drive-in-linux.html
 * https://serverfault.com/questions/6714/how-to-make-windows-7-usb-flash-install-media-from-linux

screen
screen -S example
 * 1) run any program   (no nohup program & necessary)
 * 2) press C-a d   (detach)
 * 3) program running in the background
 * 1) screen -r example

nfs

 * server

/dev/mapper/vg_he120_74-lv_home  /home   ext4   defaults   1 2 /home/data                       /data   none   defaults,bind   0 0

/data *(ro)


 * client

strela205.jinr.ru:/data  /strela205-data   nfs   hard,intr,noac,actimeo=1,async,nosuid,nodev,sec=null,ro   0 0

192.168.0.100:/volume1/HD_video/  /mnt/HD_video   nfs   defaults,ro   0 0

vnc
VNCSERVERS="1:username" VNCSERVERARGS[1]="-geometry 1280x1024 -nolisten tcp"

Google Chrome

 * chrome://version/
 * http://www.gtricks.com/google-chrome-tricks/change-user-agent-string/
 * https://chrome.google.com/webstore/detail/djflhoibgkdhkhhcedjiklpkjnoahfmg

PuTTY and VNC
PuTTY tunnels: L5901  127.0.0.1:5901  (Local IPv4)

vncviewer: localhost:1

port forwarding

 * http://www.pslib.cz/ke/Routov%C3%A1n%C3%AD_a_ma%C5%A1kar%C3%A1da
 * http://www.pslib.cz/ke/Portforwarding
 * input (WAN -> LAN)

iptables -t nat -A PREROUTING -i eth0 -p tcp -d x.x.x.x --dport 8080 -j DNAT --to 10.0.0.99:80 iptables -t nat -A PREROUTING -i eth0 -p tcp -d x.x.x.x --dport pop3 -j DNAT --to 10.0.0.123
 * output (LAN -> WAN)

iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -j MASQUERADE iptables -t nat -A POSTROUTING -o eth0 -s 10.0.0.0/24 -j SNAT --to-source x.x.x.x

SSH tunel
$ ssh -C -L 5901:localhost:5901 musinsky@strela205.jinr.ru $ vncviewer localhost:1

We have to create the ssh tunnels for the ports 5807 and 5907 to the host lxplus403.cern.ch (note that we have to bypass the generica alias lxplus) $ ssh username@lxplus403.cern.ch -L5807:localhost:5807 -L5907:localhost:5907 The ssh tunnels will be active as long as the ssh connection is open, but you do not need to use this terminal until you want to kill the display
 * https://twiki.cern.ch/twiki/bin/view/LHCb/RemoteLxplusConsoleHowTo

Midnight Commander

 * Markdown syntax
 * https://github.com/MidnightCommander/mc/blob/master/misc/syntax/markdown.syntax
 * https://gist.github.com/rb2/1f6b23ea5ea848c75a8c

wget https://gist.githubusercontent.com/rb2/1f6b23ea5ea848c75a8c/raw/ffc9cf031d320a4d7b4ad30c2fab09aa61cdd84b/markdown.syntax -O /usr/share/mc/syntax/markdown.syntax

file ..\*\\.(md|markdown)$ Markdown include markdown.syntax file .\* unknown include unknown.syntax

V principe "mdv" alebo "pandoc" a potom v mc cez lynx resp. w3m
 * Markdown viewer
 * https://unix.stackexchange.com/questions/4140/markdown-viewer
 * https://github.com/axiros/terminal_markdown_viewer (ak istalacia so zdrajakov, tak dnf install PyYAML)
 * http://blog.metajiji.tk/2015/03/markdown-midnight-commander.html

Ak nemusim do tyerminalu, tak https://github.com/joeyespo/grip

include/video Open=(vlc %f >/dev/null 2>&1 &) View=%view{ascii} mediainfo %f 2>/dev/null

regex/\.([aA][cC]3)$ View=%view{ascii} mediainfo %f 2>/dev/null

route LANpolis
ROUTE -P ADD 10.0.0.0 MASK 255.0.0.0 10.91.140.1

ROUTE ADD 10.0.0.0 MASK 255.0.0.0 10.91.140.1 -P ROUTE ADD 10.0.0.0 MASK 255.0.0.0 192.168.0.1 -P

Xtreamer NFS
/mnt/sdb5&#09;&#09;192.168.0.XXX(ro,async,no_subtree_check,all_squash)


 * 1) systemctl enable nfs-server.service
 * 2) systemctl start nfs-server.service

rpcbind.service ~ portmap


 * problem s firewall/port(s):
 * Mount Daemon Port: 1058
 * NFS Server Port: 2049

Audacious compiling
install audacious (default to /usr/local) export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH

cd audacious-plugins-3.x/ ./configure

strela205

 * ak spustam vncserver cez "xorg.conf" tak sa obraz akoby klonoval, t.j. hybem myskou u seba a vidi to aj druhy na vncclient-e. Ak spustam cez service, tak su kvazi nezavisle obrazovky, a tu je problem s vmedaq, ludia mozu menit "configy" pre ten isty program, a on potom moze padat.

-A RH-Firewall-1-INPUT -s 159.93.117.0/24 -j ACCEPT -A RH-Firewall-1-INPUT -s 159.93.112.0/24 -j ACCEPT vsetkym s 159.93.117.* (okrem 0) povoleny pristup

vsetkym s 159.93.112.* (okrem 0) povoleny pristup


 * oficialne DNS servery

search jinr.ru                                                                                                                                                                                                                       nameserver 159.93.17.7 nameserver 159.93.14.7

dig -x 147.213.192.75 ... ;; ANSWER SECTION: 75.192.213.147.in-addr.arpa. 86400 IN	PTR	alice.saske.sk.

building KDevelop
export KDEDIR=/home/mucha/KDE4 potrebny kdelibs-4.8.1.tar.bz2 a kate-4.8.1.tar.bz2
 * http://techbase.kde.org/Getting_Started/Build/KDE4
 * http://download.kde.org/download.php?url=stable/4.8.1/src/

instalacia nejakych Fedora balikov mkdir build cd build cmake ../kdelibs-4.8.1/ -DCMAKE_INSTALL_PREFIX=$KDEDIR make make install

mkdir build cd build cmake ../kate-4.8.1/ -DCMAKE_INSTALL_PREFIX=$KDEDIR make make install potrebny kdevplatform-1.3.0.tar.bz2 a samotny kdevelop-4.3.0.tar.bz2 mkdir build cd build cmake ../kdevplatform-1.3.0/ -DCMAKE_INSTALL_PREFIX=$KDEDIR make make install
 * http://techbase.kde.org/KDevelop4/HowToCompile
 * http://download.kde.org/download.php?url=stable/kdevelop/4.3.0/src/

mkdir build cd build cmake ../kdevelop-4.3.0/ -DCMAKE_INSTALL_PREFIX=$KDEDIR make make install

export KDEDIRS=/home/mucha/KDE:/$KDEDIRS /home/mucha/KDE4/bin/kbuildsycoca4

/home/mucha/KDE4/bin/kdevelop