Linux:Tips Tricks

From AliceWiki
Jump to: navigation, search


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

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 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 includepkgs (resp. exclude) 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 priority options v kombinacii s yum-plugin-priorities utility

  • Nezapinat Russian Fedora fixes repository, inak po update sa Fedora premeni na RFRemix distribuciu (vratane mena, loga a pod.)
  • /etc/yum.conf
clean_requirements_on_remove=1
$ 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

/etc/xdg/user-dirs.conf

enabled=False

alebo jednoducho vymazat cely package (yum remove xdg-user-dir\*)

add application

Program (aplikaciu) pridame do systemoveho menu vytvorenim suboru /usr/{,local/}share/applications/program-name.desktop, ikona subor program-name.png pre danu aplikaciu sa default hlada v /usr/{,local/}share/icons/ 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

  • man manpath

manpath urcuje (precita configuration file /etc/man_db.conf), kde vsade sa budu hladat manualove stranky. Ak je napr. zadefinovana cesta PATH=/cern/root/bin/ tak sa automaticky budu hladat manualove stranky aj v /cern/root/man/, avsak len dovtedy pokial nie zadefinovana premenna MANPATH

$ 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'
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

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

locale

# GNOME settings: Language => 'en_US.UTF-8' and Formats => 'en_GB.UTF-8'
$ 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=

$ 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 LC_PAPER (tlac na A4) a LC_TIME (D/M/Y, tyzden zacina pondelkom)
  • pozor zmena napr. LC_CTYPE moze pozmenit pravidla pre triedenie, LC_NUMERIC napr. zamiena desatinu ciarku a bodku v zavislosti od konkretneho jazyka
  • hodnoty locale ovpyvnuju LibreOffice len velmi malo, LC_CTYPE determines the general locale data setting, LC_MESSAGES determines the UI language, LC_PAPER determines the paper configuration (if libpaper is not available)

$HOME/.bashrc

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

/etc/sysconfig/autofs

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

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

./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


$ 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]

expand standard include files

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

check compiler defined macros

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

# gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-11)
$ 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
#define __STDC_VERSION__ 199901L

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<CreateDate' .
d:\FOTO\exiftool.exe "-FileModifyDate<CreateDate" .

PDF and PS

pdf2ps vs pdftops

  • pdf2ps is Ghostscript PDF to PostScript translator (ghostscript-core.rpm)
  • pdftops tool comes with Xpdf or is successor Poppler (poppler-utils.rpm)
  • problem with pdf2ps: fonts are converted to bitmap fonts => 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

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
# http://gskinner.com/RegExr/
# http://www.regextester.com/
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

# http://milan.kupcevic.net/ghostscript-ps-pdf/
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=png16m -dTextAlphaBits=4 -dGraphicsAlphaBits=4 \
      -sOutputFile=output.png input.pdf
gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pnggray -r400 -dTextAlphaBits=4 \
      -sOutputFile=output.png input.pdf

a2ps --medium=a4 -r --columns=1 --font-size=11 -o magnet.ps magnet.txt
# https://github.com/lehner/gpdfx
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
# vyreze "clip" a prida "okraje" (vlavo, hore, vpravo, dole)
pdfcrop --margins '0 30 0 10' --clip cham_wires.pdf  # clip zvacseny o okraje zhora 30, zdola 10

# 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
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

# eps
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
# order of options in convert command is important !!!
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
# 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)
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
# reduce file size
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

# quickly create a large file
fallocate -l 13G big13GB.dat

# list open files for process
ls -l /proc/2982/fd
lsof -p 2982
lsof -p `pgrep root.exe`

# recursively fetch a directory with arbitrary files
wget -r -nH -np -R index.html* http://example.com/dir1/dir2/dir3

watch -n 0.1 ls -al /var/log/
#!/bin/bash

for file in *.np
do
    echo "processing file" $file
    iconv -f ISO_8859-1 -t UTF8 $file > $file.utf8
    mv $file.utf8 $file
done

burn VOB files

/path/to/DVDFilm/ contains AUDIO_TS and VIDEO_TS 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

Firefox configuration

  • firefox.desktop[29462]: Failed to open VDPAU backend libvdpau_i965.so: cannot open shared object file: No such file or directory
yum install libva-intel-driver
  • disable auto creation ~/Desktop dir (under linux)

~/.config/user-dirs.dirs (and installed xdg-utils package)

XDG_DESKTOP_DIR="$HOME/"
XDG_DOWNLOAD_DIR="$HOME/"
XDG_DESKTOP_DIR="/home/musinsky/"
# dont use "~"
# "/" at the end of line is important
  • sharing personal dictionary (slovak ASCII) between Firefox (~/.mozilla/firefox/[uniqueID.default]/persdict.dat) and hunspell in emacs (~/.hunspell_sk-SK-ascii)
ln -s $HOME/.mozilla/firefox/*.default/persdict.dat $HOME/.hunspell_sk-SK-ascii

about:config

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

Default application

/usr/share/applications/mimeinfo.cache or /usr/share/applications/defaults.list

CERN Certification Authority


Create new certificate
https://gridca.cern.ch/gridca/ => New Grid User certificate => create new certificate and download, install in browser (Firefox)
Export public key
Backup my new certificate from Firefox (Preferences => Advanced => Certificates => View Certificates => Your Certificates) as file musinsky.p12
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

  • [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 => musinsky.p12 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



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.

test:

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

Printing at CERN

Configure for example printer 13-R006-HP 13-R006-HPBW in building 13, printer model HP LaserJet 4300

Select Device -> Network Printer -> LPD/LPR Host or Printer -> Location of the LPD network printer
Host:    13-R006-HP.print.cern.ch
Queue: 13-R006-HP
Choose Driver: HP -> Models: LaserJet 4300 -> Drivers: HP LaserJet 4300 Series Postscript[en] (recommended)
Describe Printer
Printer Name: 13-R006-HP
Description:    HP LaserJet 4300
Location:         Building 13

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

CERN Library Proxy Service

Automatic proxy configuration URL
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

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: 10.0.0.4
Port: 9100
  • Select Device -> Network Printer -> Internet Printing Protocol (ipp) -> Enter device URI
ipp://10.0.0.4:631/ipp
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

/etc/mail/sendmail.mc

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 /etc/mail/sendmail.cf config file with m4 command (must have installed sendmail-cf package)

$ m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
$ systemctl restart sendmail.service

Direct (simple) solution, edit /etc/mail/sendmail.cf file

# "Smart" relay host (may be null)
DSsmtp.saske.sk

Vidyo

yum install libXScrnSaver

VNC

TigerVNC server

$ dnf install tigervnc-server
[user]$ vncpasswd     # created /home/musinsky/.vnc/passwd
[user]$ vncserver     # created /home/musinsky/.vnc/config, /home/musinsky/.vnc/passwd and log files
$ firewall-cmd --permanent --zone=FedoraServer --add-service=vnc-server
$ firewall-cmd --reload
vnc-server as service

currently on Fedora 25 not working due to wayland issue

$ cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.service
# no need to include the display number in the file (systemd automatically creates the appropriately named instance in memory on demand)
# replacing <USER> by actual user name musinsky (from regex ExecStart to end of line)
$ sed -i '/Unit/,$s/<USER>/musinsky/g' /etc/systemd/system/vncserver@.service

[user]$ vncpasswd

$ systemctl daemon-reload
$ systemctl enable vncserver@:1.service
$ systemctl start vncserver@:1.service

# add vnc-server to firewall

BORDEL


Bootable Windows 7 USB Drive in Linux

screen

screen -S example
# run any program   (no nohup program & necessary)
# press C-a d   (detach)
# program running in the background

# screen -r example

nfs

server

/etc/fstab

/dev/mapper/vg_he120_74-lv_home   /home   ext4   defaults   1 2

/home/data                        /data   none   defaults,bind   0 0

/etc/exports

/data *(ro)
client

/etc/fstab

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

PuTTY and VNC

PuTTY tunnels: L5901 127.0.0.1:5901 (Local IPv4)
vncviewer: localhost:1

port forwarding

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

Midnight Commander

wget https://gist.githubusercontent.com/rb2/1f6b23ea5ea848c75a8c/raw/ffc9cf031d320a4d7b4ad30c2fab09aa61cdd84b/markdown.syntax -O /usr/share/mc/syntax/markdown.syntax
  • /usr/share/mc/syntax/Syntax
file ..\*\\.(md|markdown)$ Markdown
include markdown.syntax

file .\* unknown
include unknown.syntax
  • Markdown viewer

V principe "mdv" alebo "pandoc" a potom v mc cez lynx resp. w3m

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

/etc/exports

/mnt/sdb5		192.168.0.XXX(ro,async,no_subtree_check,all_squash)
# systemctl enable nfs-server.service
# 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.
  • /etc/sysconfig/iptables
-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 dig -t ns jinr.ru

/etc/resolv.conf

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
instalacia nejakych Fedora balikov yum install automoc phonon-devel strigi-devel attica-devel dbusmenu-qt-devel

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
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