Utilitats i trucs

Index

MS Windows 2000/NT i Linux

  1. A la instal·lació de Linux: posar el Lilo a la partició principal de Linux (NO al Master Boot Record). Si teniu problemes perquè la vostra partició comença en un cilindre més gran que 1024, proveu a afegir l'opció lba32 (una línia sola, cap al principi) al fitxer /etc/llilo.conf.
  2. Des de Linux: si la partició principal és, per exemple /dev/hda7 :
    dd if=/dev/hda7 of=/root/bootsec.lin bs=512 count=1
  3. Des de Linux: moure el fitxer creat a la partició MSWindows:
    cp /root/bootsec.lin /mnt/<partició de MSWindows>
    Si no podem muntar el disc de MSWindows (perquè sigui NTFS i no VFAT, per exemple), podem gravar el fitxer en un disquet (cp /root/bootsec.lin /mnt/floppy) i copiar-lo a c:\bootsec.lin des de MSWindows.
  4. Des de Windows 2000: afegir al fitxer c:\boot.ini la línia
    c:\bootsec.lin = "Linux"
  5. Si tot ha anat bé, quan arrenquem l'ordinador, el loader de W2000 ens demanarà si volem arrencar des de Linux o des de W2000.

Resin

  • La variable d'entorn JAVA_HOME ha de contenir l'adreça de la distribució del JDK:
    • csh: en el fitxer .cshrc
      setenv JAVA_HOME /usr/local/jdk1.2.2/
    • bash: en el fitxer .bashrc
      JAVA_HOME=/usr/local/jdk1.2.2/
      export JAVA_HOME

Resin i Apache

Per a fer servir el Resin amb l'Apache (assegureu-vos que teniu l'apache-devel) heu de posar aquestes opcions quan compileu el Resin (tot en una línia):
  • ./configure --with-apache-libexec=/usr/lib/apache --with-apache-include=/usr/include/apache --with-apache-conf=/etc/httpd/conf/httpd.conf

Resin i MS Internet Information Server

En el fitxer resin.conf una configuració d'aquest tipus no funciona:
  • <http-server>
    <http-port>8888<http-port/>
    <app-dir>doc<app-dir/>
    <http-server/>
Ha de ser tot en una sola línia:
  • <http-server port='8888' app-dir='doc'/>

Apache

  • Installation
  • Versions
  • Config files, service start/stop

    config
    modules config
    vhost config
    start/stop
    file
    default docs
    (DocumentRoot ...)
    default cgi-bin
    (ScriptAlias /cgi-bin/ ...)
    file
    file
    Mageia
    /etc/httpd/conf/http.conf
    /var/www/html/index.html
    /var/www/cgi-bin/

    /etc/httpd/conf/vhosts.d/*.conf
    # service httpd start
    CentOS
    /etc/httpd/conf/http.conf /var/www/html/index.html
    /etc/httpd/conf.d/*.conf

    • sudo systemctl start httpd.service
    • service httpd start
    • apachectl start
    Debian /Ubuntu
    /etc/apache2/apache2.conf
    /var/www/index.html (Apache 2.2)
    /var/www/html/index.html (Apache 2.4)
    /usr/lib/cgi-bin/
    /etc/apache2/mods-available/*.conf /etc/apache2/sites-available/* $ sudo service apache2 start
    Cygwin
    /etc/apache2/http.conf
    /srv/www/htdocs/



    $ /usr/sbin/apachectl2 -k start
    XAMPP
    c:\xampp\apache\conf\http.conf
    c:\xampp\htdocs\




  • Estructura de directoris de configuració / Configuration directory structure

    Apache 2.2
    Apache 2.4

    Mageia 1, 2
    Debian / Ubuntu
    Mageia 3, 4
    CentOS
    Debian / Ubuntu
    general
    /etc/httpd/ conf/
    • httpd.conf
    • magic
    • mime.types
    /etc/apache2/
    • apache2.conf
    • magic
    • ports.conf
    • envvars
    /etc/httpd/
    conf/
    • httpd.conf
      • # Include sites configuration
        Include conf/sites.d/*.conf
    • magic
    /etc/httpd/
    • conf/
      • httpd.conf
      • magic
    /etc/apache2/
    • apache2.conf
    • magic
    • ports.conf
    • envvars
    virtual hosts
    • vhosts.d/
      • 00_default_vhosts.conf
      • 00_default_ssl_vhost.conf
    • sites-available/
      • default
      • default-ssl
    • sites-enabled/
      • 000-default -> ../sites-available/default
    • vhosts.d -> sites.d
    • webapps.d -> sites.d
    • sites.d/
      • 00_default_vhosts.conf
      • 00_default_ssl_vhost.conf
      • ...
      • bugzilla.conf
      • mediawiki.conf

    a2ensite / a2dissite
    • sites-available/
      • default
      • default-ssl
    • sites-enabled/
      • 000-default -> ../sites-available/default
    webapps
    • webapps.d/
      • bugzilla.conf
      • mediawiki.conf
      • phpmyadmin.conf
      • timetracker.conf
      • your_app.conf
      • ...

    • conf.d/
      • mediawiki.conf
      • mediawiki.conf -> /etc/mediawiki/apache.conf
      • phpmyadmin.conf -> ../../phpmyadmin/apache.conf
      • your_app.conf
      • ...
      • charset
      • localized-error-pages
      • other-vhosts-access-log
      • security

    • conf-available/
      • mediawiki.conf
      • mediawiki.conf -> /etc/mediawiki/apache.conf
      • phpmyadmin.conf -> ../../phpmyadmin/apache.conf
      • your_app.conf
      • ...
      • charset
      • localized-error-pages
      • other-vhosts-access-log
      • security
    • conf-enabled/
      • ... -> ../conf-available/...

    • conf.d/
    • conf.d/
      • autoindex.conf
      • info.conf
      • languages.conf
      • mpm.conf
      • multilang-errordoc.conf
      • security.conf
      • ssl.conf
    • conf.d/
      • autoindex.conf
      • ssl.conf
      • userdir.conf
      • welcome.conf
    modules
    • modules.d/
      • 40_mod_ssl.conf
      • 70_mod_php.conf
      • 75_mod_perl.conf
    • mods-available/
      • actions.conf
      • actions.load
      • ...
    • mods-enabled/
      • ...
    • modules.d/
      • 00_base.conf
      • 00_mod_lua.conf
      • 00_mod_ssl.conf
      • 00_mod_systemd.conf
      • 00_mpm.conf
      • 00_mod_cgi.conf
    • conf.modules.d/
      • 00-base.conf
      • 00-dav.conf
      • 00-lua.conf
      • 00-mpm.conf
      • 00-proxy.conf
      • 00-ssl.conf
      • 00-systemd.conf
      • 01-cgi.conf
    a2enmod / a2dismod
    • mods-available/
      • actions.conf
      • actions.load
      • ...
    • mods-enabled/
      • ...

    • extramodules -> ../../usr/lib/apache-extramodules/
    • lib -> ../../usr/lib/
    • logs -> ../../var/log/httpd/
    • modules -> ../../usr/lib/apache/
      • mod_*.so


    • logs -> ../../var/log/httpd/
    • modules -> ../../usr/lib64/httpd/modules/
      • mod_*.so
    • run -> ../../run/httpd/
    • logs -> ../../var/log/httpd
    • modules -> ../../usr/lib64/httpd/modules/
      • mod_*.so
    • run -> /run/httpd


  • Utils
    • a2query
      • get the Apache version
        • a2query -v
    • a2ensite
    • a2dissite
    • a2enmod
    • a2...
  • Configuració / Configuration
    • Virtual hosts (vhosts.d, sites-available)
    • /etc/httpd/conf/httpd.conf or /etc/apache2/apache2.conf
      • ServerName your_ip_address
      • Logs
      • Variables d'entorn / Environment variables
        • SetEnv VARIABLE toto_value
        • test CGI to print them all
      • MPM
        • mpm_prefork_module
          • number of childs: StartServers, MinSpareServers, MaxSpareServers, MaxClients
            • number of requests per child: MaxRequestsPerChild
  • Rewriting
  • Scripts d'instal·lació / Installation scripts
    • Script d'instal·lació per a Django / Django installation script
    • estructura / structure:
      • webapp_name
        • apache_config
          • install_apache.sh
          • webapp_name.conf
        • index.html
        • js/
        • css/
        • ...
      • install_apache.sh
        • #!/bin/bash
          EXPECTED_ARGS=1
          if [ $# -ne $EXPECTED_ARGS ]
          then
              cat <<EOF
          Usage: `basename $0` webapp_name

          Example: `basename $0` hbbtv

          Actions:
          - copy webapp_name.conf to apache configuration directory (e.g. /etc/httpd/conf/webapps.d/)
          - recursively copy .. (parent directory, except apache_config) to apache directory (e.g. /var/www/webapp_name/)
          - change the owner and group of the files and directories to the right ones

          The following typical OS are automatically detected:
          - Red Hat, CentOS, Mageia, ...
          - Debian, Ubuntu, ...
          - MAC OSX (MAMP)
          EOF
              exit 1
          fi

          webapp_name=$1

          webapp_dir=/var/www/${webapp_name}

          # Red Hat, CentOS, Mageia, ...
          if [ -f /etc/httpd/conf/httpd.conf ]
          then
              httpd_config=/etc/httpd/conf/httpd.conf
              webapp_conf_dir=/etc/httpd/conf/webapps.d/
             
              grup_httpd=`grep "^Group" $httpd_config | awk '{print $2}'`
              usuari_httpd=`grep "^User" $httpd_config | awk '{print $2}'`
          fi

          # MAC OSX
          if [ -f /Applications/MAMP/conf/apache/httpd.conf ]
          then
              httpd_config=/Applications/MAMP/conf/apache/httpd.conf
              webapp_conf_dir=/Applications/MAMP/conf/apache/extra
              webapp_dir=~/sites/${webapp_name}
          fi

          # Debian, Ubuntu, ...
          if [ -f /etc/apache2/apache2.conf ]
          then
              httpd_config=/etc/apache2/apache2.conf
              webapp_conf_dir=/etc/apache2/conf.d/
             
              usuari_httpd=`awk -F= '/APACHE_RUN_USER/ {print $2}' /etc/apache2/envvars`
              grup_httpd=`awk -F= '/APACHE_RUN_GROUP/ {print $2}' /etc/apache2/envvars`
          fi

          # còpia recursiva de la webapp
          echo "copying application $webapp_name to $webapp_dir"
          mkdir -p $webapp_dir
          rsync -a --exclude='.git' --exclude='apache_config' .. $webapp_dir
          chown ${usuari_httpd}.${grup_httpd} -R $webapp_dir

          # webapp config
          echo "copying config file ${webapp_name}.conf to ${webapp_conf_dir}"
          cp ${webapp_name}.conf ${webapp_conf_dir}
  • Start server
    • Serveis / Service
    • apachectl / httpd
      • compiled in modules
        • apachectl -l
        • httpd -l
      • check syntax:
        • apachectl -t
        • httpd -t
      • loaded modules
        • apachectl -M
        • httpd -M
    • Logs
      • Apache Module mod_log_config
      • detailed log in error_log (or name specified by ErrorLog) file:
        • LogLevel debug
      • httpd.conf / apache2.conf
        • errors
          • ErrorLog "logs/error_log"
          • LogLevel debug
        • access
          • TransferLog  "logs/access_log"
          • # CustomLog with format nickname
            LogFormat "%h %l %u %t \"%r\" %>s %b" common
            CustomLog "logs/access_log" common
          • # CustomLog with explicit format string
            LogFormat "logs/access_log" "%h %l %u %t \"%r\" %>s %b"
          • # real remote ip when using AWS ELB load balancer (%a, %h give ELB ip address)
            LogFormat"%v %A %{X-FORWARDED-FOR}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" elb-ncsa
            CustomLog "logs/access_log" elb-ncsa

      • /etc/apache2/conf.d/other-vhosts-access-log
        • CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined
      • cat /etc/httpd/logs/error_log
      • grep httpd /var/log/messages
      • systemctl status httpd.service
      • httpd -e debug -E /tmp/toto.log
    • Problemes / Problems
      • /var/log/apache2/error.log
        • "Client denied by server configuration" / 403 Forbidden
          • Apareix al navegador com a: «Forbidden You don't have permission to access / on this server.»
          • Si feu servir Apache 2.4, comproveu que feu servir la directiva "Require all granted" i no "Order deny,allow", "Allow from all"
          • Comproveu que el directori dins de la directiva <Directory ...> és el correcte
          • Comproveu els permisos Unix amb / Check Unix permissions with:
            • namei -m /ful/path/to/index.html
        • ValueError: Unable to configure handler 'logfile': [Errno 13] Permission denied: .../logfile
          • Passa amb el log de Django. settings.py:
            • LOGGING = {
              ...
                  'handlers': {
                      'logfile': {
                          'filename': PROJECT_PATH + "/logfile",
          • Solució / Solution:
            • ...
      • CentOS / RHLE
        • "http dead but subsys locked" / /usr/sbin/httpd: Symbol lookup error: /usr/lib64/libaprutil-1.so.0: Undefined symbol: apr_os_uuid_get
  • Change listen ports
    • Debian
      • ports.conf
    • Mageia
      • /etc/httpd/conf/httpd.conf
        • Listen 8000 # can be specified in sites.d/toto.conf instead
      • /etc/httpd/conf/sites.d/00_default_vhosts.conf
        • Listen 8000
          <VirtualHost _default_:8000>
      • open firewall
    • RedHat / CentOS
      • SELinux: semanage (to avoid error "could not bind to address 127.0.0.1:12345 no listening sockets available, shutting down")
        • semanage port -l | grep -w http_port_t
        • semanage port -a -t http_port_t -p tcp 12345
      • Firewall / tallafoc
      • http.conf
        • Listen 12345
  • Directory index (per exemple: per a fer que serveixi index.html i no index.php, per omissió)
    • DirectoryIndex index.html
  • Accés des d'una subxarxa especificada / Access from a specified subnet
    • Allow from 192.168.1
      ErrorDocument 403 "Access denied per /etc/httpd/conf/webapps.d/my_webapp.conf"
  • CGI
    • mod_cgi
    • configuració / configuration
      • ScriptLog logs/cgi_log
      • ScripAlias /toto /var/www/cgi-bin/toto.cgi
    • /var/www/cgi-bin/
      • test_variables.cgi
        • #!/usr/bin/perl
          print "Content-type: text/html\n\n";
          foreach $key (keys %ENV) {
          print "$key --> $ENV{$key}<br>";
          }
    • http://localhost/cgi-bin/test.cgi
  • Directori addicional / Additional directory (/home/user1/other_dir to be accessed as http://server/new_dir/)
    • Option 1: in system directory
      • (cal? només usuari? només grup?) Check user and group permissions, according to directives in httpd.conf
        • # Mageia, CentOS, ...
          httpd_config=/etc/httpd/conf/httpd.conf
          usuari_httpd=`grep "^Group" $httpd_config | awk '{print $2}'`
          grup_httpd=`grep "^User" $httpd_config | awk '{print $2}'`
          chmod ${usuari_httpd}.${grup_httpd} -R ...
        • # Ubuntu
          usuari_httpd=`awk -F= '/APACHE_RUN_USER/ {print $2}' /etc/apache2/envvars`
          grup_httpd=`awk -F= '/APACHE_RUN_GROUP/ {print $2}' /etc/apache2/envvars`
          chmod ${usuari_httpd}.${grup_httpd} -R ...
    • Option 2: in user directory
      • Solution 1: symbolic link (no funciona / it does not work) (caldria FollowSymLinks?)
        • cd /var/www/html
        • ln -s /home/user1/parent_dir/other_dir new_dir
      • Solution 2: http.conf
        • Alias /new_dir /home/user1/parent_dir/other_dir
          <Directory "/home/user1/parent_dir/other_dir">
              Options -Indexes +FollowSymLinks +MultiViews
              AllowOverride None
              # Apache 2.2:
              #Order allow,deny
              #Allow from all
              # Apache 2.4:
              Require all granted
          </Directory>

      • Note: check the user permissions and owners of /home/user1/parent_dir/other_dir
        IMPORTANT: els passos següents no són necessaris si feu servir Apache 2.4 / next steps are not required when using Apache 2.4; check only that user running Apache has Unix permissions to read index.html
        IMPORTANT: parent directory must have execution permissions for group apache (or whatever group defined in Group directive in httpd.conf, or in APACHE_RUN_USER variable)
        • # usermod -a -G apache user1
        • # chgrp apache -R /home/user1/parent_dir/
        • # chmod g+x /home/user1/parent_dir/
        • # chmod g+rX -R /home/user1/parent_dir/other_dir
    • Option 3: in some other directory (e.g. a mounted external disk), owned by a user:
      • ...
  • Web Apps (webapps.d, sites.d, conf.d)
  • Cache
    • Controlar cache con Apache
    • <FilesMatch "\.(mpd|m4s)$">
        Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
      </FilesMatch>

  • CORS
    • httpd.conf or available-sites/default, ...:
      • #CORS
        Header set Access-Control-Allow-Origin "*"
        Header set Access-Control-Allow-Credentials "true"
        Header set Access-Control-Allow-Methods "POST,PUT,DELETE,GET, OPTIONS"
        Header set Access-Control-Allow-Headers "Content-Type"
        Header set Access-Control-Expose-Headers "Location"
  • HTTPS (see also: Seguretat en WWW / WWW security)
    • Apache modules installation:
      • urpmi apache-mod_ssl
    • Autenticació de servidor amb certificat autosignat / Server authentication with self-signed certificate
      • Mageia:
        • [cd /etc/httpd/conf/vhosts.d; cp 01_default_ssl_vhost.conf 02_hostname_ssl_vhost.conf]
        • canvi de port 443 -> 8443:
          • httpd.conf (diu quins ports obre per a escoltar)
            • Listen 8443
          • 01_default_ssl_vhost.conf (diu a quin dels ports on està escoltant fa referència)
            • <VirtualHost _default_:8443>
      • Ubuntu:
        • cd /etc/apache2/sites-enabled; sudo ln -s ../sites-available/default-ssl 001-default-ssl
        • cd /etc/apache2/mods-enabled; sudo ln -s ../mods-available/ssl.conf .; sudo ln -s ../mods-available/ssl.load .
        • canvi de port 443 -> 8443:
          • ports.conf (diu quins ports obre per a escoltar)
            • Listen 8443
          • default-ssl (diu a quin dels ports on està escoltant fa referència)
            • <VirtualHost _default_:8443>
        • sudo service apache2 restart
    • Autenticació de servidor / Server authentication:
      • Info
      • Passos / Steps:
        1. Creeu una CA amb OpenSSL / Create a CA with OpenSSL
        2. Creeu un certificat de servidor amb OpenSSL i / Create a server certificate with OpenSSL and:
          • mv /etc/pki/tls/newcert.pem /etc/pki/tls/certs/hostname_server.crt
          • mv /etc/pki/tls/newkey.pem /etc/pki/tls/private/tva_server.key
        3. Configuració del servidor Apache / Apache server configuration:
          • /etc/hosts
            • your_ip_address hostname
          • /etc/httpd/conf/httpd.conf
            • LoadModule ssl_module modules/mod_ssl.so
          • cp /etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf /etc/httpd/conf/vhosts.d/02_hostname_ssl_vhost.conf
          • /etc/httpd/conf/vhosts.d/02_hostname_ssl_vhost.conf
          • to avoid entering the passphrase every boot, create an unsecure version of your key file:
            • cd /etc/pki/tls/private; cp hostname.key hostname.key.orig; openssl rsa -in hostname.key.orig -out hostname.key; chmod 700 hostname.key
        4. Configuració del client / Client configuration
          • import CA
          • connect to server:
            • https://...
          • Si la resposta és sec_error_inadequate_key_usage:
            • comproveu que al certificat del servidor, a keyUsage hi ha keyEncipherment
          • Si sec_error_reused_issuer_and_serial:
            • Netegeu la memòria cau del navegador / Clean the cache on the browser
          • Si sec_error_unknown_issuer:
            • Descarregueu el certificat de la CA i doneu-li permís per a identificar servidors www: "Confia en aquesta CA per identificar llocs web"
          • ssl_error_rx_record_too_long
            • check /var/log/httpd/ssl_error_log
        5. Accés des de client / Access from client:
      • ...
        • mv newcert.pem hostnameCert.prm; cp /etc/pki/tls/hostnameCert.prm /etc/pki/tls/certs/hostname_server.crt
        • mv newkey.pem hostnameKey.pem; cp /etc/pki/tls/hostnameKey.pem /etc/pki/tls/private/hostname_server.key
    • Autenticació de client amb certificat / Client authentication with certificate
      • Info:
      • Passos / Steps:
        1. Creeu un certificat de client amb OpenSSL / Create a client certificate with OpenSSL (client.crt)
        2. Encapsuleu el certificat de client en un fitxer PKCS12 / Encapsulate client certificate into a PKCS12 file (client.p12)
        3. Configuració del servidor Apache / Apache server configuration:
          • import CA certificate
            • creat per nosaltres / created by us
              • cp ...
            • altres / others (e.g. for DNIe)
              • cd /etc/pki/tls/certs/
              • wget http://www.dnielectronico.es/ZIP/ACRAIZ-SHA1.zip
              • unzip ACRAIZ-SHA1.zip
              • conversion from DER to PEM:
                • openssl x509 -in ACRAIZ-SHA1.crt -inform DER -out ACRAIZ-SHA1.crt -outform PEM
          • Host based:
            • /etc/httpd/conf/vhosts.d/01_default_ssl_vhost.conf
              • SSLEngine on
                #CA certificate (PEM encoded) whose client certificates the server is prepared to accept
                SSLCACertificateFile
                /etc/pki/tls/certs/ACRAIZ-SHA1.crt
                SSLVerifyClient require
                SSLVerifyDepth  10
            • el navegador presentarà una llista dels certificats de client disponibles, però només aquells que hagin estat emesos per la CA especificada a SSLCACertificateFile (TLS: RFC 4336 7.4.4 "Certificate request")
          • Directory-based: Authentication with a certificate:
        4. Configuració de client / Client configuration:
          • Si el client es connecta amb un navegador / If the clients connects from a web browser:
          • Si el client es connecta per línia de comanda / If the client connects from command line:
            • la CA li ha de passar el certificat de client (client_pem.crt), la clau de client (client_pem.key) i el certifcat de la CA (root_ca_pem.crt)
            • el client es connecta de forma segura:
              • wget --certificate=client_pem.crt --private-key=client_pem.key --ca-certificate=root_ca_pem.crt https://...
          • Perquè el navegador oblidi el certificat de client amb què s'ha connectat:
            • Eines -> Neteja l'historial recent -> Sessions actives
          • Si quan el client es connecta apareix un error del tipus ssl_error_handshake_failure_alert, pot ser que:
            • el client no tingui instal·lat cap certificat de client (per exemple, el DNIe)
            • (el servidor no tingui el SSLCACertificate adequat)
          • Si ssl_error_unknown_ca_alert
            • el servidor no té el SSLCACertificate adequat
    • Autenticació de client sense certificat / Client authentication without certificate (basic authentication)
      • Info:
      • Passos / Steps:
        1. Configuració del servidor Apache / Apache server configuration:
          • Install mod_auth_basic, mod_auth_digest (mod_auth_cert?)
            • urpmi ...
          • mkdir /var/www/passwd
          • htpasswd -c /var/www/passwd/passwords user_name
          • /etc/httpd/conf/httpd.conf
            • <Directory "/var/www/html/protegit">
                AuthType Basic
                AuthName "Zona protegida"
                # (Following line optional)
                AuthBasicProvider file
                AuthUserFile /var/www/passwd/passwords
                Require valid-user
              </Directory>
          • http://server/protegit/
    • Certificate Revocation List (CRL)
  • WebDAV
    • urpmi apache-mod_dav
    • httpd.conf:
      • Listen 8080 (optional)
      • LoadModule dav_module modules/mod_dav.so
      • LoadModule dav_fs_module modules/mod_dav_fs.so
      • LoadModule dav_lock_module modules/mod_dav_lock.so
      • DAVLockDB /var/lock/apache2/DAVLock
        Alias /toto /var/www/toto
        <Location /toto>
          Dav on
        </Location>
        <Directory "/var/www/toto">
            Options -Indexes MultiViews
            AllowOverride None
            Order allow,deny
            Allow from all
        </Directory>
    • client
  • Llengües / Languages
  • Balanceig de càrrega / Load balancing

OpenSSL

Nginx

  • Installation from packages
    • CentOS
      • nginx -V
        • nginx version: nginx/1.10.1
          built by gcc 4.8.5 20150623 (Red Hat 4.8.5-4) (GCC)
          built with OpenSSL 1.0.1e-fips 11 Feb 2013
          TLS SNI support enabled
          configure arguments: --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-file-aio --with-ipv6 --with-http_ssl_module --with-http_v2_module --with-http_realip_module --with-http_addition_module --with-http_xslt_module=dynamic --with-http_image_filter_module=dynamic --with-http_geoip_module=dynamic --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_degradation_module --with-http_slice_module --with-http_stub_status_module --with-http_perl_module=dynamic --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-google_perftools_module --with-debug --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -m64 -mtune=generic' --with-ld-opt='-Wl,-z,relro -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-E'

  • Installation from source
    • Add user nginx
      • CentOS
        • sudo adduser --system --no-create-home --user-group -s /sbin/nologin nginx
      • Ubuntu
        • sudo adduser --system --no-create-home --disabled-login --disabled-password --group nginx
    • Dependencies
      • for option --with-http_xslt_module
        • CentOS
          • sudo yum install libxslt-devel
    • Modules
    • Compilació / Compilation (Building nginx from Sources) ():
      1. wget http://nginx.org/download/nginx-1.10.2.tar.gz
      2. tar xvzf nginx-1.10.2.tar.gz
      3. cd nginx-1.10.2
      4. additional modules
        • git clone git://github.com/arut/nginx-rtmp-module.git
        • nginx-upload-module
          • wget -O nginx-upload-module-2.2.tar.gz https://github.com/vkholodkov/nginx-upload-module/archive/2.2.tar.gz
          • tar xvzf nginx-upload-module-2.2.tar.gz
      5. ./configure [--with-debug] --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/run/nginx.pid --user=nginx [--with-http_ssl_module] [--with-http_xslt_module][--add-module=./nginx-rtmp-module] [--add-module=./nginx-upload-module-2.2]
      6. make
      7. su; make install
    • Nginx init scripts
      • CentOS
        • Systemd
          • save it to:
            • /usr/lib/systemd/system/nginx.service
      • Ubuntu
    • Starting, Stopping, and Restarting Nginx
      • /usr/local/nginx/sbin/nginx
      • Open port 1935 (?)
      • Start
        • /usr/local/nginx/sbin/nginx
      • Stop
        • /usr/local/nginx/sbin/nginx -s stop
      • Reload config
        • /usr/local/nginx/sbin/nginx -s reload
    • Test
      • cd nginx-1.9.2/nginx-rtmp-module/test/
      • edit nginx.conf
        • /path/to/
      • cp nginx.conf /usr/local/nginx/conf/
      • /usr/local/nginx/sbin/nginx
      • publish:
        • ./ffstream.sh
        • with ffmpeg
          • ffmpeg -loglevel verbose -re -i sintel-1024-stereo.mp4 -c copy -f flv rtmp://localhost/myapp/mystream
      • play:
        • ./play.sh
        • ffplay -loglevel verbose "rtmp://localhost/myapp/mystream"
      • statistics:
    • Config
      • Django wsgi
      • /usr/local/nginx/conf/
        • nginx.conf
          • ...
          •         location /stat.xsl {
                        # you can move stat.xsl to a different location
                        #root /usr/build/nginx-rtmp-module;
                        root /home/cesc/src/nginx-1.7.0/nginx-rtmp-module;
                    }
    • Debug and logs
      • Optional: activate --with-debug option in configure
      • /var/log/nginx/error.log
    • Publish to server
      • ffmpeg -re -i sintel-1024-stereo.mp4 -c copy -f flv rtmp://localhost/myapp/mystream
    • Play from server:
      • ffplay rtmp://localhost/myapp/mystream
    • Status

Memcached

  • Instal·lació / Installation
  • Configuració / Setup
    • /etc/sysconfig/memcached
      • tcp port
        • PORT="11211"
          USER="memcached"
          MAXCONN="1024"
          CACHESIZE="64"
          OPTIONS=""

      • unix socket
        • ...
          OPTIONS="-s '/var/run/memcached/memcached.sock' -a 0766"

  • Ús / Usage
    • Django
    • Stats
      • memcached-tool 127.0.0.1:11211
      • memcached-tool 127.0.0.1:11211 stats
      • echo stats | nc localhost 11211

XAMPP

  • XAMPP
  • To be accessible from outside (and on port 8080) http://192.168.1.15:8080
    • <install_dir>\xampp\apache\conf\httpd.conf
      • Listen 8080
      • ServerName 192.168.1.15
    • <install_dir>\xampp\apache\conf\extra\httpd-xampp.conf
      • # Close XAMPP security section here
        <LocationMatch "^/(?i:(?:security))">
            Order deny,allow
            #Deny from all
            #Allow from ::1 127.0.0.0/8
            ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
        </LocationMatch>

        # Close XAMPP sites here
        <LocationMatch "^/(?i:(?:xampp|licenses|phpmyadmin|webalizer|server-status|server-info))">
            Order deny,allow
            #Deny from all
            #Allow from ::1 127.0.0.0/8
            ErrorDocument 403 /error/HTTP_XAMPP_FORBIDDEN.html.var
        </LocationMatch>
  • ...

Tomcat

  • Per a instal·lar-lo en MS Windows, falta el fitxer:
  • Axis2: name of the host behind a NAT (wdsl file) (*)
    • WEB-INF/conf/axis2.xml
      • <axisconfig name="AxisJava2.0">
              ...
            <!-- Following parameter will set the host name for the epr-->
            <parameter name="hostname" locked="true">myhost.com</parameter>

Django

Squid (HTTP Proxy)

  • urpmi squid
  • How To: Configure Squid Proxy Server
  • Setting up Squid Proxy on Ubuntu
  • /etc/squid/squid.conf
    • acl localnet src <client_ip>/32
      http_access allow localnet

  • service squid start
  • chkconfig --level 345 squid on
  • client (<client_ip>):
    • export http_proxy='http://<server_ip>:3128'
      export https_proxy='http://<server_ip>:3128'
      export ftp_proxy='http://<server_ip>:3128'

DOS-UNIX

  • Per a canviar el tipus de fitxer de DOS (amb retorns de carro ^M) a UNIX (retorns de carro senzills): dos2unix
  • Noms de fitxer de majúscula a minúscula:
    • #! /bin/csh
      foreach f ( * )
      mv $f `echo $f | tr '[A-Z]' '[a-z]'`
      end
    • #! /bin/bash
      for f in *;
      do mv $f `echo $f | tr '[A-Z]' '[a-z]'`;
      done

Canvi de nom 

  • #! /usr/bin/bash
    comptador=1;
    while test $comptador -le $1
    do
    mv Imatge${comptador}.hist Imatge${comptador}_rgb_256d.hist
    let comptador=$comptador+1
    done

Conversió de MS-Word a PDF

  • Des d'OpenOffice:
    1. Obriu el fitxer .doc i feu "Exporta com a PDF".
    2. Per a generar vistes prèvies i hiperenllaços: extendedPDF
  • Des de MS Word:
    1. Assegureu-vos que a Windows teniu configurada una impressora PostScript. Si no, aneu a Inici/Configuració/Impressores i afegiu-ne una altra, del tipus PostScript (p.ex. qualsevol HP LaserJet, o bé una genèrica).
    2. Obriu el fitxer amb MS Word.
    3. Imprimir / A fitxer: toto (assegureu-vos que a les opcions d'impressora hi ha Opcions de Postscript / Màxima portabilitat; si està activa l'opció de màxima velocitat podeu tenir problemes de numeració de les pàgines en el fitxer PS generat). La impressora seleccionada ha de ser la de tipus PostScript.
    4. Des de l'explorador de Windows (o similar) canvieu el nom de fitxer de toto.prn a toto.ps
    5. Feu la conversió de Postscript a PDF.
  • Des de MS Word:

Conversió de Postscript a PDF

  • UNIX
    1. ps2pdf toto.ps toto.pdf
  • MS Windows
    1. Obriu toto.ps amb el GSView (assegureu-vos que utilitzi Ghostscript >=6.01; si no, algunes lletres poden quedar amb quadrets [format bitmap en lloc del desitjat vectorial])
    2. Imprimiu-lo a fitxer amb el dispositiu pdfwrite: toto.pdf

Múltiple pàgina en PostScript

  • psnup -2 toto.ps toto.2.ps

PDF

  • Manipulació
    • pdftk
      • Manipulación de ficheros PDF (CRySoL)
      • separa en pàgines individuals / split into single pages:
        • pdftk toto.pdf burst
      • uneix documents / join documents:
        • pdftk 1.pdf 2.pdf cat output 12.pdf
      • afegeix un peu de pàgina / add a footer:
        • pdftk input.pdf multistamp footer.pdf output input_with_footer.pdf
      • compilation (Mandriva)
        • urpmi fastjar gcc-java
        • modify Makefile.Base:
          • ... -I$(JAVALIBPATH) -I/usr/include/libgcj-4.4.3 ...
        • make -f Makefile.RedHat
    • PDF-Xchange viewer
  • Edició
    • Inkscape

Substitució / Replacement

X-face

  • giftoppm face.gif | ppmtopgm |pgmnorm |pnmscale -xy 48 48 |pgmtopbm > face.pbm
  • pbmmake -white 48 48 |pnmpaste face.pbm 0 0 |pbmtoicon |tail +3 |compface > face.xface

Registre MS Windows

  • Auto login: HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon\
    • AutoAdminLogon REG_SZ 1
    • DefaultUsername REG_SZ usuari
    • DefaultPassword REG_SZ contrasenya
    • DefaultDomainName REG_SZ
  • Auto login gràfic: control userpasswords2
  • Execució a l'inici: HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Xerces

  • Xerces C++ samples
  • MS Visual / MFC:
    • To avoid errors of type "error LNK2001: unresolved external symbol" about a function containing wchar:
      • Project Poperties (All Configurations) / Configuration Properties / C/C++ / Language / Treat wchar_t as Built-in type: No
  • Ambiguous DOMDocument
    • XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument
    • XERCES_CPP_NAMESPACE_QUALIFIER DOMDocumentFragment
    • #define WIN32_LEAN_AND_MEAN // to vaoid using MSxml.h
  • DOMWriter
    • delete of object LocalFileFormatTarget to close and release the file
  • Active-X: to avoid failed registration, copy all xerces .lib and .dll files into the same directory of .ocx file to be registered.
  • Memory leaks
    • cal alliberar sempre el resultat d'un transcode (or better: use std:string instead of char*):
      • char *pStringValorNode;
      • pStringvalorNode = XMLString::transcode( nodeAtribut->getNodeValue() );
      • XMLString::release(&pStringValorNode);
  • Avoid loading (downloading) external DTD:
  • Read from memory (parse a string):
    • string cadena;
    • const char*  gXMLInMemBuf = cadena.c_str();
    • static const char*  gMemBufId = "prodInfo";
    • MemBufInputSource* memBufIS = new MemBufInputSource(
              (const XMLByte*)gXMLInMemBuf,
              strlen(gXMLInMemBuf),
              gMemBufId,
              false );
    • XercesDOMParser *parser = new XercesDOMParser;
    • parser->parse(*memBufIS);
    • XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *doc = parser->getDocument();
  • Copy of a node:
    • same document:
      • nodeA2 = nodeA1->cloneNode( true );
      • nodeRootA->appendChild( nodeA2 );
    • different documents (docA -> docB):
      • nodeB1 = docB->importNode( nodeA1, true );
      • nodeRootB->appendChild( nodeB1 );
  • Moving nodes from one document (docA, containing nodeA1) to another (docB, containing elB1), using fragments:
    • nodeA1_bis = nodeA1->cloneNode(true); (true: recursive; false: non recursive)
    • fragA1 = docA->createDocumentFragment();
    • nodeAi = fragA1->appendChild(nodeA1_bis);
    • elB2 = docB->createElement("tag");
    • nodeB3 = docB->importNode( fragA1, true );
    • elB2->appendChild(nodeB3);

VMWare / QEmu

  • Install RPM:
  • urpmi kernel-desktop-devel
  • Launch config:
    • /usr/bin/vmware-config.pl
  • Resize virtual disk size
    1. vmplayer
    2. select virtual machine -> Settings -> Utilities -> Expand disk
    3. start guest OS (eg Mandriva) in safe mode
    4. #drakdisk -> resize partition
    5. reboot
  • Resize virtual disk file (6GB -> 8GB) (NOTA: les noves versions de vmplayer ja permet el redimensionament dels discos):
    1. Install needed software
      1. urpmi qemu
      2. urpmi dkms-kqemu (plf) (needed to activate -kernel-kqemu option)
    2. resize disk from several parts (option 1, recommended):
      1. qemu-img convert WindowsXP-s001.vmdk -O raw WindowsXP-s001.raw
      2. qemu-img convert WindowsXP-s002.vmdk -O raw WindowsXP-s002.raw
      3. qemu-img convert WindowsXP-s003.vmdk -O raw WindowsXP-s003.raw
      4. qemu-img convert WindowsXP-s004.vmdk -O raw WindowsXP-s004.raw
      5. cat WindowsXP-s001.raw WindowsXP-s002.raw WindowsXP-s003.raw WindowsXP-s004.raw > WindowsXP_8G.raw
      6. dd bs=1 if=/dev/zero of=WindowsXP_8G.raw seek=8G count=0
      7. qemu-img convert WindowsXP_8G.raw -O vmdk WindowsXP_8G.vmdk
    3. resize disk from several parts (option 2):
      1. qemu-img convert WindowsXP-s004.vmdk -O raw WindowsXP-s004.raw
      2. dd bs=1 if=/dev/zero of=WindowsXP-s004.raw seek=2G count=0
      3. qemu-img convert WindowsXP-s004.raw -O vmdk WindowsXP-s004.vmdk
      4. edit WindowsXP-s004.vmdk:
        • RW 6144 SPARSE "WindowsXP-s004.vmdk" -> RW 4192256 SPARSE "WindowsXP-s004.vmdk"
    4. resize disk from one part
      1. qemu-img convert WindowsXP_6GB.vmdk -O raw WindowsXP_8GB.raw
      2. dd bs=1 if=/dev/zero of=WindowsXP_8GB.raw seek=8G count=0
      3. qemu-img convert WindowsXP_8GB.raw -O vmdk WindowsXP_8GB.vmdk
    5. resize partition with Gparted-LiveCD (select "force Vesa"):
      1. (modprobe kqemu)
      2. qemu -kernel-kqemu [-no-kvm] -m 512 -k es -cdrom gparted-livecd-xxx.iso -boot d -hda WindowsXP_8G.vmdk
    6. cp WindowsXP.vmx WindowsXP_8G.vmx and edit it:
      1. ide0:0.fileName = "WindowsXP_8G.vmdk"
    7. vmplayer WindowsXP_8G.vmx
  • serial device on file.vmx:
    • serial0.present = "TRUE"
    • serial0.fileName = "Auto Detect"
    • serial0.autodetect = "TRUE"
    • serial0.hardwareFlowControl = "TRUE"
  • Xarxa / Network

NFS/Samba

  • server SMBFS
    • urpmi samba-server
    • add user
  • server NFS (configure with MCC or use the folowing:)
    • install service
      • CentOS
        • Chapter 18. Network File System (NFS)
        • Sharing files with NFSv4 on Fedora (Server & Client configuration)
        • Setting Up NFS Server And Client On CentOS 7
        • yum install nfs-utils nfs-utils-lib
        • firewalld
          • systemctl start firewalld.service
          • NFSv4
            • firewall-cmd --permanent --add-service=nfs
            • firewall-cmd --permanent --add-service=rpc-bind
            • firewall-cmd --permanent --add-service=mountd
          • firewall-cmd --reload
        • SELinux (in server or in client?)
          • option 1: booleans
            • getsebool -a | grep -i nfs
            • setsebool -P <someboolean>=1 <someotherbool>=1 ...
          • option 2: policy
            • grep rpc.statd /var/log/audit/audit.log | audit2allow -M mypol
            • semodule -i mypol.pp
        • NFSv4
          • systemctl enable rpcbind.service nfs-idmapd.service nfs-server.service
          • systemctl start rpcbind.service nfs-idmapd.service nfs-server.service
          • Problemes / Problems
            • # systemctl enable nfs-idmap.service
              Failed to execute operation: No such file or directory
              • Solució / Solution
                • /usr/lib/systemd/system/nfs-idmapd.service
                  • [Install]
                    WantedBy=multi-user.target
                • systemctl enable nfs-idmapd.service
        • NFSv3
          • systemctl start rpc-statd.service
          • systemctl start rpcbind nfs-lock nfs-idmap
      • Mageia
        • urpmi nfs-utils
        • service nfs-server start
        • firewall (shorewall) (Réseau Linux avec NFS - Mandriva) (Configuring NFS under Linux for Firewall control)
          • /etc/sysconfig/nfs-common:
            • STATD_OPTIONS="--port 4000"
          • service nfs-common restart
          • /etc/sysconfig/nfs-server:
            • RPCMOUNTD_OPTIONS="--port 4002"
          • service nfs-server restart
          • /etc/modprobe.conf:
            • options lockd nlm_udpport=4001 nlm_tcpport=4001
          • reboot computer
          • open ports: 111/tcp 111/udp 2049/tcp 2049/udp 4000:4002/tcp 4000:4002/udp
          • check port attibution:
            • rpcinfo -p
    • configure idmap
      • /etc/idmapd.conf
        • [General]
          Domain = domain.tld

          [Mapping]
          Nobody-User = nfsnobody
          Nobody-Group = nfsnobody
    • configure permissions
      • /etc/hosts.allow
        • rpcbind: 172.16.11.0/255.255.255.0
    • configure export points
      • /etc/exports
        • /tmp 172.16.11.0/24(no_all_squash,async,secure,no_subtree_check,ro)
        • # NFSv4 (in client: mount -t nfs4 server_address:/var/toto)
          /var/toto 172.16.11.0/24(rw,sync)

        • # NFSv4(in client: mount -t nfs4 server_address:/)
          /var/toto 172.16.11.0/24(rw,sync,fsid=0)
        • # NFSv4 (in client: mount -t nfs4 server_address:/)
          # exported dir /mnt/vol1 is itself a mounted drive
          /mnt/vol1 172.31.0.0/16(rw,async,mountpoint=/mnt/vol1,fsid=0,no_root_squash)

      • Options
        • 21.6 NFS Server Configuration
        • 21.7 The /etc/exports Configuration File
        • Optimizing performance: Network File Systems (MythTV)



        • optimized
          (suggested by MythTV)
          general options ro, rw
          read only, read and write

          insecure
          allow connections from port 1024 and higher

          insecure_locks
          allow insecure file locking

          no_subtree_check
          disable subtree checking

          sync / async
          sync write operations on request
          async
          no_wdelay
          force sync of write operations immediately

          nohide
          do not hide filesystems beneath

          mountpoint[=/mnt/xxx]
          export only if mounted

          fsid=X
          set explicit filesystem ID

          tcp / udp

          udp
          user access
          no_root_squash
          remove map of root in client to anonymous in server (use carefully)

          all_squash
          map all users in client to anonymous in server

          anonuid
          specify uid of the anonymous user in server

          anongid
          specify gid of the anonymous group in server
    • manage export points
      • exportfs man page
      • list of export points
        • exportfs
      • reload (-r) all (-a) exports points
        • exportfs -rav
      • unexport (-u) all (-a) export points
        • exportfs -uav
  • client SAMBA from Unix (*):
    • urpmi mount-cifs [samba_client]
    • mount -t [cifs,smbfs] //server/dir /mnt/toto -o username=usuari_remot,password=contrasenya_remota
    • mount -t [cifs,smbfs] //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd
    • /home/usuari_local/.smbpasswd
      • username=usuari_remot
      • password=contrasenya_remota
    • server client
      mount /etc/fstab
      CIFS no UNIX ext mount -t cifs //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd,
      uid=usuari_local,gid=grup_local
      //server/dir /mnt/toto cifs credentials=/home/usuari_local/.smbpasswd, uid=usuari_local,gid=grup_local 0 0
      UNIX ext mount -t cifs //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd //server/dir /mnt/toto cifs credentials=/home/usuari_local/.smbpasswd 0 0
      Samba mount -t smbfs //server/dir /mnt/toto -o credentials=/home/usuari_local/.smbpasswd,
      uid=usuari_local,gid=grup_local,nounix
      //server/dir /mnt/toto smbfs credentials=/home/usuari_local/.smbpasswd, uid=usuari_local,gid=grup_local,nounix 0 0
    • konqueror/dolphin: smb://usuari_remot@server/dir
    • if local computer is using UTF8:
      • ... iocharset=utf8,credentials=...
    • Explora / Browse
      • nmblookup domain_name
      • smbclient -L192.168.1.100
        • without password:
          • smbclient -L192.168.1.100 -N
    • Problemes / Problems
      • ??????????  ? ?       ?   ?                ? directory
        • Solution: umount -l /mnt/directory
    • Grups secundaris / Supplementary groups
      • feu servir CIFS / UNIX ext
      • a l'ordinador local heu de tenir el mateix user_id que al servidor
      • a l'ordinador local heu de pertànyer als mateixos grups secundaris que al servidor. Si pertanyeu a un grup secundari de forma local, però no al servidor, això no us donarà permisos addicionals al servidor! A la màquina local heu de fer:
        1. creeu els grups amb el mateix GID que al servidor:
          • # groupadd -g 8001 grup_secundari_1
          • # groupadd -g 8002 grup_secundari_2
          • ...
        2. assigneu a l'usuari aquests grups secundaris:
          • # usermod -a -G grup_secundari_1 grup_secundari_2 nom_usuari
        3. (opcional) si l'usuari no vol esperar a sortir i tornar a entrar, pot forçar l'actualització dels grups:
          • $ newgrp grup_secundari_1 grup_secundari_2
  • client NFS from Unix:
    • Mageia
      • urpmi nfs-utils-clients
      • needed?
        • service rpcbind start
        • service nfs-common start
      • Browse:
        • Dolphin: network NFS
    • CentOS
      • sudo yum install nfs-utils
    • Configure idmap
      • /etc/idmapd.conf
        • [General]
          Domain = domain.tld

          [Mapping]
          Nobody-User = nfsnobody
          Nobody-Group = nfsnobody

    • mkdir /mnt/toto
    • Mount temporarily:
      • mount -t nfs server:/var/toto /mnt/toto
      • mount -t nfs4 server:/var/toto /mnt/toto
    • Mount permanently:
      • /etc/fstab (see examples of present mounts at: /etc/mtab)
        • <ip-address-to-server>:/var/toto /mnt/toto nfs4 rsize=8192,wsize=8192,timeo=14,soft 0 0
        • Example (generated by manual mount in CentOS 7: mount -t nfs4 192.168.1.218:/ /mnt/nfs) in /etc/mtab
          • 192.168.1.218:/ /mnt/nfs nfs4 rw,relatime,vers=4.0,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,clientaddr=192.168.1.236,local_lock=none,addr=192.168.1.218 0 0
      • Common NFS mount options



        • optimized
          general options
          hard / soft
          soft: not recommended when using a very busy server

          timeo=value_seconds
          default: 600

          actimeo=value_seconds

          actimeo=0
          sync / async

          async
          intr
          Makes I/O to a NFS mounted filesystem interuptable if the server is down intr
          nfsvers={2,3}


          vers=4.0


          nolock


          noexec


          namlen=255


          port=num


          rsize=num,wsize=num
          default for v2,v3: 8192; default for v4: 32768 (CentOS: 262144)
          rsize=32768,wsize=32768
          sec={sys,krb5,krb5i,krb5p}


          tcp / udp


          proto=tcp


          retrans=2


          relatime


          noatime


          user access
          nosuid

          noacl

      • Check real values:
        • cat /proc/mounts
    • User permissions
      • create a dir owned by a user with login:
        • su my_user -c "mkdir /mnt/nfs/my_dir"
        • the following variant cannot be called from userdata in aws cloudformation because you cannot use sudo in it (you will have the error "sudo: sorry, you must have a tty to run sudo"):
          • sudo su - my_user -c "mkdir /mnt/nfs/my_dir"
      • create a dir owned by a user without login:
        • su nginx -s /bin/bash -c "mkdir /mnt/nfs/my_dir; chmod 777 /mnt/nfs/my_dir; chmod g+s /mnt/nfs/my_dir"
    • Utils
      • List exported dirs in a remote server:
        • showmount -e <remote_server_ip_address>

Compartició de carpetes en MS Windows / MS Windows sharing folders

  1. Comparteix la carpeta / Share the folder
  2. Dóna permisos a l'usuari
    • Properties / Security / Add / Advanced options / Search now
    • if Security tab is not present:
      • Tools / Folder options / View / (don't use) Simple file sharing

Open Office / Libre Office

  • Configuració / Settings
    • ~/.config/libreoffice/
  • Tipus de lletres generals / General fonts
    • Eines -> Opcions -> OpenOffice.org Writer -> Tipus de lletra bàsic
  • Plantilles / Templates (.ot*)
  • Write
    • Estils i formatació / Styles and formatting
      • Format -> Estils i formatació (F11)
      • Copying and moving styles
      • Aplicar estils d'una pàgina mestra (ooimpress)
        • A partir d'una pàgina mestra:
          • Plafó lateral dret: Pàgines mestres -> Disponibles per a ser utilitzades (les de ~/.ooo3/user/template/)
          • Si heu modificat la pàgina mestra d'una plantilla disponible, haureu de tancar i tornar a obrir l'OpenOffice perquè els canvis es recarreguin.
        • Per a tenir més pàgines mestres disponibles, a partir de plantilles (Load additional slide masters):
          • Format -> Disseny de la diapositiva -> Carrega -> Les meves plantilles (potser les que ja surten no són les de ~/.ooo3/user/template/)
        • Si es vol importar la pàgina mestra des d'una altra presentació, primer s'haurà de desar aquesta altra presentació com a plantilla, i després aplicar el procediment descrit en el punt anterior.
    • Numeració dels esquemes (seccions i subseccions)
      • Eines -> Numeració d'esquemes
      • A la taula de continguts, per a afegir un espai entre el nombre i el títol
    • Taula de continguts / Table of content
      • Espai entre la numeració i el títol de secció
        • Insereix -> Índexs i taules -> Índexs i taules -> Entrades
          • A la casella en blanc que hi ha entre «E#» i «E» poseu-hi un espai (amb el teclat)
      • Make Table of Contents hyperlink?
        • (menú contextual) Edita l'índex o la taula -> Entrades
        • a la posició desitjada (casella en blanc), amb el botó Enllaç, incloure principi d'enllaç (LS); a la posició final, tornar a prémer el botó Enllaç per a posar un final d'enllaç (LE). El text així delimitat serà clicable.
    • Removing line breaks
      • Tools / AutoCorrect/AutoFormat
      • Options: Combine single line paragraphs if length is greater than 50%
      • Select text
      • Apply Style: Default
      • Format / AutoFormat / Apply
    • Peus / capçaleres
      • Per a distingir entre capçalera i peu per a la primera pàgina i la resta, assegureu-vos que el format de pàgina és el que correspon:
        • Visualitza -> Barra d'eines -> Formatació
        • Estils de pàgina -> Primera pàgina / Per defecte
      • Activeu capçalera/peu:
        • (Estil de pàgina -> Primera pàgina / Per defecte): menú -> Modifica -> Capçalera/Peu de pàgina -> Activa
      • Editeu-los normalment
      • Per a posar text a l'extrem dret i a l'esquerre, separeu-lo amb tabuladors.
    • Una sola pàgina horitzontal / One single horizontal page
    • Per a definir la llengua del text:
      • (impress) Format -> Caràcter -> Llengua
      • Per a tot el text:
        • Eines -> Opcions -> Language settings -> Languages -> Default languages for documents -> Només per al document actual
    • Per a activar la correcció ortogràfica automàtica:
      • Eines -> Opcions -> Configuració de la llengua -> Opcions: Revisa l'ortografia a mida que es teclegi
    • Per a activar/desactivar la substitució automàtica de paraules [suposadament] mal escrites:
    • Activeu el control de canvis: Edita -> Canvis -> Registra
    • L'estructura lògica s'ha de veure reflectida en la visió de l'estructura del document:
      • Edita -> Navegador
    • El cos de text ha de tenir l'estil "Cos de text".
    • Autofit text (Impress for Linux) equivalent:
      • Format -> Text -> Fit to frame
    • Per a incloure figures (dibuix fet amb Draw):
      • [creeu un marc]
      • Obriu la vostra figura amb el Draw, seleccioneu-la i copieu-la
      • Posicioneu-vos al lloc on la voleu enganxar (dins del marc si n'heu creat un)
      • Enganxeu la figura
      • Per a posar un peu:
        • [seleccioneu el marc]
        • menú contextual: Llegenda...
      • Posicionament del marc (marc = imatge+llegenda):
        • Alineació -> Centrada
        • Àncora -> Al paràgraf
        • Ajusta -> Sense ajustament (Cap)
      • Nota: si la lletra us surt massa grossa, l'haureu de canviar prèviament al Draw.
    • Per a incloure figures (imatge):
      • Insereix -> Imatge
      • Si encara no té llegenda, afegiu-la amb el menú contextual: Llegenda
      • Per a properes ocasions, si voleu que cada vegada que s'insereixi una imatge es posi automàticament una llegenda:
        • Eines -> Opcions -> OpenOffice.org writer -> Llegenda automàtica -> Imatge de l'OpenOffice Writer -> Categoria: Figura
      • Posicionament del marc (marc = imatge+llegenda):
        • Alineació -> Centrada
        • Àncora -> Al paràgraf
        • Ajusta -> Sense ajustament (Cap)
      • Referència a una figura:
        • Insereix -> Referència creuada -> Insereix una referència creuada a: Categoria i número.
    • Inclusió de fitxers PDF:
      • si teniu un fitxer EPS, el podeu convertir a PDF amb: eps2pdf
      • Insereix -> Objecte -> Objecte OLE -> Crea'n un a partir de fitxer
      • es veurà bé a la pantalla i s'imprimirà en alta qualitat
    • Inclusió de fitxers EPS:
      • el fitxer EPS a inserir ha d'haver estat normalitzat amb eps2eps.
      • des de l'OpenOffice: Insereix -> Imatge -> Des d'un fitxer
      • es veurà bé a la pantalla i s'imprimirà en alta qualitat
    • Taules
      • Tipus de numeració:
        • ...
      • Peu automàtic de taules:
        • Eines -> Opcions -> OpenOffice.org writer -> Llegenda automàtica -> Taula de l'OpenOffice Writer -> Categoria: Taula
    • Per a eliminar les modificacions locals de format respecte el format de l'estil:
      • Format -> Formatació per defecte
    • Clipart (png, svg)
      • urpmi clipart-openclipart
      • Eines -> Galeria
    • Enllaços / Hyperlinks
      • Using hyperlinks
      • Edita / Edit:
        • Select hyperlink
        • Edit -> Hyperlink
      • Exportació a PDF
    • Conversió a PDF
      • Enllaços / Hyperlinks
      • Problemes
        • Si s'han importat fletxes grosses bidireccionals des d'un MSPowerPoint, l'OpenOffice petarà quan s'intenti fer una exportació a PDF.
        • Okular
          • no apareixen els enllaços
            • assegureu-vos que esteu en mode «Visualització» (i no en «Selecció de text»)
  • Impress
  • Draw
    • Text alineat amb els connectors / Text aligned to the connectors:
      • Adjusting text to suit the connecting line
      • Configuració:
        • Eines -> Personalitza -> Barres d'eines -> Barra d'eines: Dibuix -> Afegeix -> Formata -> Fontwork
      • Ús / Usage:
        • Seleccioneu el connector i cliqueu sobre la icona que acabeu d'afegir (Fontwork)
  • Calc
    • Congelació de files i columnes en un full de càlcul / Freeze rows and columns in a spreadsheet (*):
      • Seleccioneu la primera fila o columna o cel·la que volgueu que es pugui moure
      • Finestra -> Congela / Window -> Freeze
    • Entrada automàtica / Auto completion
    • Amaga i mostra files i columnes
      • Format -> {Fila,Columna,Full} -> {Amaga. Mostra}
    • Ordenació alfabètica / Alphabetic sort
      • Dades -> Ordena
    • Text a columnes / Text to column
    • Ordinals
      • Eines -> Opcions de correcció automàtica... -> Opcions de llengua -> Formata els sufixos dels nombres ordinals (1r -> 1^r)
    • Funcions del full de càlcul
      • CONSULTAV / VLOOKUP
        • poseu el 4t paràmetre a 0 per a trobar el valor exacte (no el primer que se li assembli)
    • Base de dades
    • Histograma / Histogram
  • Problemes amb Mandriva i KDE/Qt:
  • Bugs
    • Impress 2.1.7
    • un cop desada una plantilla, la llista de la diapositiva mestra no s'actualitza (aquesta mestra inactualitzable seguirà així en els documents creats a partir d'aquesta plantilla). Però l'estil, que és el que compta, es modificarà bé i serà el que s'aplica als documents creats a partir d'aquesta plantilla.
    • per a tornar a aplicar la mateixa plantilla un cop modificada, cal aplicar una altra plantilla, desar el document, tancar i obrir l'OpenOffice, i aplicar de nou la plantilla que hem modificat.

Google Docs

x264 compilation

x265 compilation

  • dependències / dependencies
    • Mageia
      • urpmi task-c++-devel
  • one of the following
    • x265.org
      • hg clone https://bitbucket.org/multicoreware/x265
    • Videolan x265
      • hg clone http://hg.videolan.org/x265
  • cd x265/build
  • cmake ../source
  • make
  • make install
  • to avoid "ERROR: x265 not found" when configuring ffmpeg with --enable-x265, check that /usr/local/lib/pkgconfig is on pkg-config path:
    • pkg-config --list-all | grep x265
    • if nothing appears, then:
      • export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
      • to make it permanent:
        • ...

libav / ffmpeg compilation on Linux

  • See also GPAC compilation
  • How-To Build FFmpeg on Debian Squeeze
  • Dependencies
    • General
      • Mageia
        • 64 bits (x86_64)
          • urpmi glibc-devel libstdc++-devel gcc lib64SDL-devel lib64sdl2.0-devel lib64raw1394-devel lib64dc1394-devel lib64gsm-devel lib64speex-devel lib64zlib-devel yasm
        • 32 bits
          • urpmi libSDL-devel libdc1394-devel libgsm-devel libspeex-devel zlib-devel yasm
      • Mandriva:
        • urpmi libSDL-devel libdc1394-devel libgsm-devel libspeex-devel zlib1-devel yasm
      • Ubuntu
        • 32/64 bits
          • sudo apt-get install make yasm
      • CentOS
        • sudo yum install yasm
    • Specific

      • ffmpeg
        dependencies
        configure
        src Mageia
        Ubuntu
        CentOS

        --enable-gpl --enable-nonfree
        32-bit
        64b


        general






        yasm
        lib64freetype6-devel



        ffplay

        [--disable-ffplay]



        libsdl2.0-devel
        lib64sdl2.0-devel


        audio codecs

        MP3
        --enable-libmp3lame


        liblame-devel lib64lame-devel libmp3lame-dev
        AAC
        (native)







        --enable-libvo-aacenc


        libvo-aacenc-devel lib64vo-aacenc-devel libvo-aacenc-dev
        --enable-libfaac
        x

        libfaac-devel


        --enable-libfdk-aac
        x
        fdk-aac


        fdk-aac-devel
        AAC+
        --enable-libaacplus







        --enable-libfdk-aac
        x




        fdk-aac-devel
        HE-AAC
        --enable-libfdk-aac
        x




        fdk-aac-devel
        Opus
        --enable-libopus




        lib64opus-devel

        opus-devel
        Vorbis




        libvorbis-devel

        libvorbis-devel
        video codecs
        AV1








        Dirac
        --enable-libschroedinger


        libdirac-devel
        libschroedinger-devel
        lib64dirac-devel
        lib64schroedinger-devel
        libschroedinger-dev
        Theora
        --enable-libtheora


        libtheora-devel lib64theora-devel libtheora-dev libtheora-devel
        VPX (VP8, VP9)
        --enable-libvpx

        libvpx
        libvpx-devel lib64vpx-devel libvpx-dev libvpx-devel
        H.264 / AVC
        --enable-libx264 x

        x264 libx264-devel lib64x264-devel libx264-dev x264-devel
        H.265 / HEVC
        --enable-libx265

        x265


        x265-devel
        Xvid
        --enable-libxvid x


        libxvid-devel lib64xvid-devel
        lib64xvidcore-devel
        libxvidcore-dev
        image
        JPEG




        jpeg-devel



        JPEG 2000
        --enable-libopenjpeg



        libopenjpeg-devel lib64openjpeg-devel

        PNG




        libpng-devel


        filters
        drawtext
        --enable-libfreetype
        [--enable-fontconfig]







        subtitles
        --enable-libass






        transport
        https
        --enable-openssl

        x





      • ffmpeg >= 0.6.1:
        • urpmi tetex-texi2html libjack-devel libvpx-devel jpeg-devel libpng-devel bzip2-devel rtmp-devel vdpau-devel libva-devel libfaad2-devel opencore-amr-devel [x264-devel]
  • Baixada / Download
    • ffmpeg
      • releases
      • development (git repository):
        • git clone git://git.ffmpeg.org/ffmpeg.git (git clone git://github.com/FFmpeg/FFmpeg.git ffmpeg)
          • libvpx-decoder >=0.9.1
          • libx264 >= 0.99 (/usr/include/x264.h: #define X264_BUILD 99)
    • libav
      • versions
        • 9.8
          • wget http://www.libav.org/releases/libav-9.8.tar.gz
        • 0.8.7
          • wget http://www.libav.org/releases/libav-0.8.7.tar.gz
      • development (git repository):
        • first time:
          • git clone git://git.libav.org/libav.git libav
        • cd libav
        • not the first time:
          • git pull
  • Compilació / Compilation
    • Passos / steps
      1. configuration
        • License:
          configure option
          resulting license
          (no option)
          LGPL v3 or later
          --enable-nonfree nonfree and unredistributable
          --enable-gpl GPL v3 or later
        • Acceleració per maquinari / Hardware acceleration (Linux graphics (Intel)):

          configure option
          (./configure --list-hwaccels)
          codecs
          needed libraries

          libav
          ffmpeg
          mpeg2
          mpeg4
          h263
          h264
          vc1
          wmv3
          Mageia
          Ubuntu

          --disable-dxva2




          x




          VA API
          --enable-vaapi
          --enable-hwaccel=h264_vaapi x
          x
          x
          x
          x
          x
          vaapi-driver-intel
          lib64va-devel
          libva-dev
          VDA
          --enable-vda
          --enable-hwaccel=h264_vda


          x




          VDPAU
          --enable-hwaccel=h264_vdpau





          vaapi-driver-vdpau
        • AAC audio (MPEG-4)
          • option 1:
            • use native embedded aac encoder (not experimental any more)
            • if you are coding your own client, you need to allow experimental codecs:
              • p_codec = avcodec_find_encoder_by_name("aac");

                AVDictionary *opts = NULL;
                av_dict_set(&opts, "strict", "experimental", 0);
                if (avcodec_open2(p_codec_ctx, p_codec, &opts) < 0) {
                ...
          • option 2:
            • use an external coder:
              • ./configure ... --enable-libfdk-aac --enable-nonfree ...
                • p_codec = avcodec_find_encoder_by_name("libfdk_aac");
              • ./configure ... --enable-libvo-aacenc ...
                • p_codec = avcodec_find_encoder_by_name("libvo_aacenc");
          • Exemples / Examples:
        • Configuration examples:
          • H264 + AAC (native) + [https]
            • ./configure --enable-gpl --enable-libx264 --enable-shared [--enable-nonfree --enable-openssl]
          • H264 + HE-AAC (Fraunhofer)
            • ./configure --enable-nonfree --enable-libfdk-aac --enable-gpl --enable-libx264 --enable-shared
          • Usual codecs
            • ./configure [--enable-nonfree --enable-libfdk-aac] [--enable-gpl --enable-libx264 --enable-libxvid] --enable-libtheora --enable-version3 --enable-libschroedinger --enable-libmp3lame --enable-libvpx
              --enable-shared
          • close to dextop for CentOS
            • --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic'
              --enable-nonfree
              --enable-libfdk-aac
              --enable-gpl --enable-libx264 --enable-libx265
              --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads
              --disable-static --enable-shared --shlibdir=/usr/lib64 --enable-runtime-cpudetect
          • CentOS dextop
            • ffmpeg version 2.6.8 Copyright (c) 2000-2016 the FFmpeg developers
                built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-4)
                configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfaac --enable-nonfree --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect
      2. make
      3. sudo make install
      4. update ld:
        • echo "/usr/local/lib" > /etc/ld.so.conf.d/local.conf
        • ldconfig
    • Problem:

ffmpeg compilation on MSWindows

  • using cygwin
    • [Mplayer-cygwin] list
    • setup Cygwin. Install packages:
      • make
      • gcc
      • diffutils (cmp)
      • patch
    • install and compile yasm (nasm not always works)

    • static dynamic
      x264
      (*)
      svn co svn://svn.videolan.org/x264/trunk x264

      patch -p0 < dll.patch
      ./configure ./configure --enable-shared
      modify config.mak:
      delete all -mno-cygwin occurences

      make libx264.a make
      install -m 644 libx264.a /usr/local/lib
      install -m 644 x264.h /usr/local/include
      make install
      ffmpeg svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
      modify libavcodec/mpegaudiodec.c. Add line:
      #define llrint lrint
      or apply a patch

      ./configure --enable-libx264 --enable-gpl ./configure --enable-shared --disable-static --enable-libx264 --enable-gpl
      make
      make install
  • using MinGW
    • ffmpeg Windows help
    • setup MinGW
      • install MSYS in c:\msys (from minGW / Download / Current)
        • MSYS_1.0.10.exe
      • install MinGW in c:\MinGW (from minGW / Download / Current) (use f.i. 7zip to untar)
        • MinGW Runtime: mingw-runtime-3.9.tar.gz
        • Windows API: w32api-3.6.tar.gz
        • binutils: binutils-2.15.91-20040904-1.tar.gz
        • GCC: gcc-core-3.4.2-20040916-1.tar.gz, gcc-g++-3.4.2-20040916-1.tar.gz
      • copy needed tools from MS Visual:
        • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\bin\lib.exe, link.exe -> c:\MinGW\bin
        • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Common7\IDE\mspdb71.dll -> c:\MinGW\bin
      • Start / MinGW / MSYS / msys.exe
    • install and compile yasm (nasm not always works)
    • compile x264
    • compile ffmpeg
    • cd /c/.../gpac_extra_libs/ffmpeg
    • ./configure --enable-shared --disable-debug --enable-memalign-hack
    • make

GPAC

  • Linux compilation
    • fmpeg / libav gpac



      ffmpeg configure
      errors when compiling gpac
      solutions
      dashcast problems
      library
      version
      ./configure
      gpac modifications from mpeg2video source

      extra_lib







      libav 9
      9.8





      9.10
      --enable-debug --enable-gpl --enable-libx264 --enable-version3 --enable-shared audio_decoder.c:215:58: error: ‘AVFrame’ has no member named ‘channels’: solved in r4959

      ok
      incorrect mp2 output audio (estrident) from aac input
      10





      git
      git





      ffmpeg 1.2
      1.2.4





      2.0
      2.0.2
      --enable-debug --enable-gpl --enable-libx264 --enable-version3 --enable-shared
      (no errors)
      ok incorrect mp2 output audio (estrident) from aac input
      2.1
      2.1.1 --enable-debug --enable-gpl --enable-libx264 --enable-version3 --enable-shared
      (no errors)
      -
      ok
      incorrect mp2 output audio (estrident) from aac input
      2.1.2

      2.1.3



      2.2
      2.2 --enable-debug --enable-gpl --enable-libx264 --enable-libx265 --enable-version3 --enable-shared --enable-avresample



      2.3
      2.3.3
      --enable-debug --enable-gpl --enable-libx264 --enable-libx265 --enable-version3 --enable-shared --enable-avresample --enable-libfreetype




      2.4






    • step 1: install needed libraries
      • to compile your own version of libav/ffmpeg, choose one of the following:
        • ffmpeg from source
        • libav from source
          • libav 9.10
            • cd libav-9.10; ./configure --enable-debug --enable-gpl --enable-libx264 --enable-version3 --enable-shared
          • GPAC rev >=4772 (22nd sep 2013): install and compile libav from git (55)
          • GPAC rev >= 4731: install or compile libav 9.8 (54) (only libs are needed):
          • GPAC rev < 4731: install or compile libav version 0.8.7 (53) (only libs are needed):
            • cd ~/src/libav-0.8.7/
            • make install-libs
        • gpac_extra_lib (ffmpeg and other libraries, provided by gpac)
          • steps
            • urpmi automake (to avoid aclocal not found)
            • cd gpac/extra_lib
            • wget https://sourceforge.net/p/gpac/code/HEAD/tree/trunk/gpac_extra_libs/gpac_extra_libs.zip
            • unzip gpac_extra_libs.zip
            • chmod +x compile.sh */configure */bootstrap
            • ./compile.sh
          • problems
            • configure.in:27: error: 'AM_CONFIG_HEADER': this macro is obsolete.
                  You should use the 'AC_CONFIG_HEADERS' macro instead.
      • Paquets / Packages
        • CentOS
          • sudo yum install ...
        • Mageia 2/3/4, 64bit:
          • if you have compiled your own version of libav/ffmpeg:
            • urpmi lib64pulseaudio-devel lib64xv-devel lib64xmlrpc-c-devel lib64cairo-devel lib64wxgtku2.8-devel lib64openjpeg-devel lib64faad2-devel lib64mad-devel lib64a52dec-devel [lib64sdl2.0-devel]
          • if you use the system libav/ffmpeg:
            • urpmi lib64pulseaudio-devel lib64xv-devel lib64xmlrpc-c-devel lib64cairo-devel lib64wxgtku2.8-devel lib64openjpeg-devel lib64faad2-devel lib64mad-devel lib64a52dec-devel lib64ffmpeg-devel[lib64sdl2.0-devel]
        • Ubuntu (*)
          • if you have compiled your own version of libav/ffmpeg:
            • sudo apt-get install make pkg-config g++ zlib1g-dev libsdl1.2-dev [libsdl2-dev]
          • if you use the system libav/ffmpeg:
            • sudo apt-get install make pkg-config g++ zlib1g-dev firefox-dev libfreetype6-dev libjpeg62-dev libpng12-dev libopenjpeg-dev libmad0-dev libfaad-dev libogg-dev libvorbis-dev libtheora-dev liba52-0.7.4-dev libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libxv-dev x11proto-video-dev libgl1-mesa-dev x11proto-gl-dev linux-sound-base libxvidcore-dev libssl-dev libjack-dev libasound2-dev libpulse-dev libsdl1.2-dev dvb-apps libavcodec-extra-53 libavdevice-dev libmozjs185-dev
        • Mageia 1:
          • urpmi libmad-devel libxvid-devel libjs-devel libopenjpeg-devel libjpeg-devel liba52dec-devel libSDL-devel libcairo-devel libwxgtku2.8-devel libpulseaudio-devel libxmlrpc-c-devel libxulrunner-devel libxv1-devel libffmpeg-devel libdirectfb-devel
        • Mandriva 2010.2:
          • add plf to your distribution sources (Easy URPMI)
          • urpmi libmad-devel libxvid-devel libjs-devel libopenjpeg-devel libjpeg-devel liba52dec-devel libSDL-devel libwxgtku2.8-devel libpulseaudio-devel libxmlrpc-c-devel libxulrunner-devel xulrunner-headless-devel libxv1-devel libffmpeg-devel
        • Mandriva 2008.x:
          • from 2008.1: urpmi libfaad2-devel libffmpeg-devel (liblame-devel libfaac-devel libmpeg4ip-devel liba52dec-devel libmrnb-devel libtheora-devel libvorbis-devel libx264-devel libmrwb-devel) libglib2.0-devel libmesaglut3-devel
          • from 2008.0: urpmi libfreetype6-devel libjs-devel libmad0-devel libopenjpeg1-devel libopenssl0.9.8-devel libpng-devel libSDL1.2-devel libwxgtk2.8-devel (libxml2-devel) libwxgtku2.8-devel 
        • Mandriva 2007.x:
          • urpmi libfaad2_0-devel libffmpeg51-devel libfreetype6-devel libjpeg62-devel libjs1-devel libmad0-devel libogg0-devel libopenjpeg1-devel  libopenssl0.9.8-devel libpng3-devel libSDL1.2-devel libtheora0-devel  libvorbis0-devel libwxgtk2.6-devel libwxgtku2.6-devel libxml2-devel libxvid4-devel zlib1-devel libmesaglut3-devel
          • ln -s /usr/include/js-1.5 /usr/include/js
    • step 2: get GPAC source:
    • step 3: compile gpac (Compiling GPAC on Ubuntu)
      • Problemes / Problems
      • Dashcast modifications
      • modify GPAC code according to libav / ffmpeg versions used:
        • ffmpeg 2.2 (compiled with --enable-avresample)
          • gpac/applications/dashcast/Makefile (GPAC svn > r5237)
            • CFLAGS+=-DDC_AUDIO_RESAMPLER
              LINKLIBS+=-lavresample

        • ffmpeg 2.1
          • (no modifications needed on latest svn gpac)
        • libav git
          • if using GPAC rev>=4772 (2013-09-22)
            • ffmpeg_decode.c:112:7: error: ‘CODEC_ID_SVQ3’ undeclared (first use in this function)
              ...
              • Solució / Solution:
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' modules/ffmpeg_in/ffmpeg_decode.c
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' modules/ffmpeg_in/ffmpeg_demux.c
            • modules/ffmpeg_in/ffmpeg_decode.c:633: undefined reference to `avcodec_decode_audio3'
              • Solution:
                • use libav 9.x
          • if using GPAC rev. >= 4731 (2013-09-05)
            • error: ‘AV_CH_LAYOUT_STEREO’ undeclared
              • Solució / Solution:
                • audio_muxer.h
                  • #include "libavcodec/version.h"
                    #if (LIBAVCODEC_VERSION_MAJOR>53)
                    #include "libavutil/channel_layout.h"
                    #endif
            • error: ‘AVStream’ has no member named ‘r_frame_rate’
              • libavformat/avformat.h
              • solució / solution
                • video_decoder.c
                  • comment if statament where r_frame_rate appears
            • error: ‘CODEC_ID_RAWVIDEO’ undeclared
              • solució / solution
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' video_decoder.c
            • error: ‘CODEC_ID_H264’ undeclared
              • sol:
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' video_encoder.c
            • video_encoder.o: In function `dc_video_encoder_encode':
              video_encoder.c:(.text+0x26b): undefined reference to `avcodec_encode_video'
              • in libav from git, avcodec_encode_video has changed to avcodec_encode_video2 and parameters are different (libavcodec/avcodec.h)
              • sol:
                • use libav 9.1
          • make sure that extra_lib is not refrenced by configure:
            • rm -rf extra_lib
          • error: ‘CODEC_ID_MPEG4’ not declared in this scope
            • Solució / Solution:
              • cd modules/ffmpeg_in/
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' ffmpeg_decode.c
                • sed -i 's/CODEC_ID/AV_CODEC_ID/g' ffmpeg_demux.c
                • sed -i 's/av_close_input_file/avformat_close_input/g' ffmpeg_demux.c
                • sed -i 's/av_open_input_stream/avformat_open_input/g' ffmpeg_demux.c
                • ...
          • applications/dashcast/audio_encoder.h
            • #include "libautil/channel_layout.h"
          • ‘AVStream’ has no member named ‘r_frame_rate’
            • it is an issue in libav from repository; use libav-9.1 instead
        • libav 9.10
          • ...
        • libav 9.8
          • if using GPAC rev. >= 4731 (2013-09-05)
            • error: ‘AV_CH_LAYOUT_STEREO’ undeclared
              • Solució / Solution:
                • audio_muxer.h
                  • #include "libavcodec/version.h"
                    #if (LIBAVCODEC_VERSION_MAJOR>53)
                    #include "libavutil/channel_layout.h"
                    #endif
        • libav 53 / 0.8.7 / ffmpeg
          • no GPAC modifications needed
      • ./configure [--enable-debug] [--use-js=no]
      • make
      • make install
      • update ld.so:
        • new fashion (e.g. Mageia 3):
          • echo /usr/local/lib > /etc/ld.so.conf.d/local32.conf
          • ldconfig
        • old fashion
          • add lines to /etc/ld.so.conf
            • /usr/local/lib
            • /usr/lib/xulrunner-1.9.../
      • ldconfig
      • MP4Box usage
    • Problemes / Problems
      • durant la compilació / during compilation
        • with libav
        • problems with libavformat/avio.h
          • error: ‘URL_WRONLY’ was not declared in this scope
        • compilation with libav (>0.8.7) instead of ffmpeg or libav 0.8.7
          • /usr/bin/ld: /usr/local/lib/libavcodec.a(allcodecs.o): relocation R_X86_64_32 against `ff_a64multi_encoder' can not be used when making a shared object; recompile with -fPIC
            • Solució / Solution:
              • assegureu-vos que libav s'ha compilat amb l'opció: /make sure that libav was compiled with option:
                • --enable-shared
          • problems with ffmpeg libavcodec/avcodec.h (*) and libav (ffmpeg fork)
        • /usr/bin/ld: /usr/local/lib/libavcodec.a(allcodecs.o): relocation R_X86_64_32 against `ff_a64multi_encoder' can not be used when making a shared object; recompile with -fPIC
        • ../../bin/gcc/libgpac.so: undefined reference to `JSVAL_NULL'
          ../../bin/gcc/libgpac.so: undefined reference to `JSVAL_VOID'

          • solution:
            • ??
        • undefined reference to JS_ClearNewbornRoots
        • DirectFB not found by configure
          • solution:
            • bug: in configure file, you shoud have:
              • directfb_inc="/usr/include/directfb"
      • després de la compilació / after compilation
        • confirm that the following files point to the right place (/usr/local/lib/libav...):
          • ldd /usr/local/lib/gpac/gm_ffmpeg_in.so
            • libavcodec.so.54 => /usr/local/lib/libavcodec.so.54
              ...
          • ldd /usr/local/bin/DashCast
          • ldd /usr/local/bin/MP4Client
          • if not:
            • /etc/ld.so.conf.d/local32.conf
              • /usr/local/lib
            • ldconfig
        • ldd DashCast apunta a libavcodec.53, i heu compilat amb la versió 54:
          • Solució:
            • comproveu que els fitxers a bin/gcc/DashCast i altres .so són recents. Si no, esborreu-los i feu make
      • en execució / on execution
        • DashCast
          • si feu servir l'ffmpeg (o bé altres paquets de la distribució), us podeu trobar que DashCast us dóna errors del tipus "Cannot open video file", perquè es barregen versions de l'ffmpeg i libav / if you are using ffmpeg or libav packages from your distribution, you may find errors like "Cannot open video file", because several versions of the libraries are mixed (confirm with "ldd DashCast")
            • Solució / Solution:
              • desinstal·leu els paquets de la distribució, perquè gpac agafi els que acabeu de compilar / uninstall distribution development packages, so as gpac takes the newly compiled files:
                • ubuntu:
                  • sudo apt-get remove libavcodec-dev libavformat-dev libavutil-dev
              • comproveu ldd / check ldd
          • "Cannot open output audio codec" / "Cannot open output audio stream"
            • us hi podeu trobar si feu servir aac com a còdec àudio de sortida amb el DashCast
            • solució / Solution:
          • "Cannot find a video stream"
            • Solution:
              • make sure that ./configure gives:
                • FFMPEG: system
          • L'àudio de sortida (mp2) és soroll estrident / Output audio (mp2) is an annoying noise:
          • dashcast.conf file is not generated
            • if -conf option is not used, a generic dashcast.conf file should be generated and written, but only after DashCast is cleanly closed (q)
          • "Rep v1 UTC diff at segment close: 7769 is lower than cumulated segment duration 15000 (diff -7231) - frame rate is probably not correct or frames were lost !!"
            • occurs with libav-9.10
            • Solution
              • ??
    • compile osmozilla (plug-in for Firefox)
      • urpmi libxulrunner-devel
      • cd applications/osmozilla
      • make
      • make install (as user)
      • Desenvolupament / Development
        • applications/osmozilla/osmo_npapi.{cpp,h}
        • applications/osmozilla/osmozilla.cpp
      • Utilització / Usage
      • Problems:
    • compile MP4Client (ja es compila en la compilació general / already compiled in general compilation):
      • cd applications/mp4client
      • modify Makefile:
        • comment line:
          • #rm...
      • make
      • make install
      • MP4Client usage
    • compile gpac with OpenSVC (gpac/modules/opensvc_dec)
      • compile and install OpenSVC libraries
      • modify modules/Makefile (solved in rev 3686):
        • PLUGDIRS=aac_in ... opensvc_dec
      • compile gpac
      • usage
        • ~/.gpacrc
          • You can directly use ctrl+(H,L) or add shortcuts to ~/.gpacrc (during playback, they are taken into account when the MP4Client window has the focus: WINDOW SHORTCUTS):
            • [Shortcuts]
              QualityDown=1
              QualityUp=2
              TemporalIdDown=8
              TemporalIdUp=9
          • In [System] section, check that "codec_04_21" is not associated to "FFMPEG decoder". It must be associated to "OpenSVC Decoder":
            • codec_04_21="FFMPEG decoder"
            • codec_04_21="OpenSVC Decoder"
          • In [PluginsCache] section, check that opensvc_dec is not an invalid module.
        • MP4Client toto_svc.mp4 (amb fitxers .264 no funciona bé)
        • To change layer:
          • Ctrl+H
          • Ctrl+L
      • Problems
        • Segmentation fault
        • [Thread MediaManager] Couldn't set priority(2) for thread ID 0x00000000
          [Thread MediaManager] Couldn't set priority(2) for thread ID 0xb1077b70
          • Solution:
            • ??
    • compile hbbtvplayer
      • cd applications/hbbtvplayer/hbbtvbrowserplugin
        • chmod +x autogen.sh
        • ./autogen.sh
        • ./configure
        • make install
      • cd applications/hbbtvplayer/hbbtvterminal
        • (webkit-1.0 >= 1.5.2)
        • chmod +x autogen.sh
        • ./autogen.sh
        • ./configure
        • make install
    • compile with OpenHEVC decoder (HEVC)
    • compile gpac
      • [chmod +x configure]
      • run configure:
        • cvs: ./configure
        • svn (portivity): ./configure --disable-ipv6 (to avoid error in utils/os_net.c: sin_port)
        • 0.4.2-rc2: ./configure --use-ffmpeg=local
      • to prepare for debugging:
        • ./configure --enable-debug
        • to get an unstripped installed /usr/local/lib/libgpac-xx-DEV.so (to be used by gdb):
          • src/Makefile: INSTFLAGS= (not INSTFLAGS=-s, which installs a stripped version in /usr/local/lib)
      • make
      • (gcc -O3  -fno-strict-aliasing -Wno-pointer-sign -Wall -I/home/fpinyol/src/svn-portivity/trunk/wp5/gpac_0.4.4/include -DGPAC_HAS_SPIDERMONKEY -DXP_UNIX -I/usr/include/js -c -o laser/lsr_[dec,enc,tables].o laser/lsr_[dec,enc,tables].c)
      • make install
      • add line to /etc/ld.so.conf:
        • /usr/local/lib
      • ldconfig
    • using kdevelop
      • Import project: C (?with automake)
    • using Eclipse (Indigo) and subversion (SVN)
      • Setup Eclipse with Subversion
      • From scratch:
        • ...
      • From existing and working svn tree:
        • File -> Import...
        • C/C++ / Existing Code as Makefile project
        • Existing code location: Browse...
        • Toolchain for Indexer Settings: Linux GCC
      • Config for using debug:
        • ./configure --enable-debug
      • Build targets
    • using Eclipse and CVS
      • CVS
        • File / New / Project: CVS / Projects from CVS
        • Create a new repository location
          • Host: gpac.cvs.sourceforge.net
          • Repository path: /cvsroot/gpac
          • User: anonymous
          • Password:
          • Connection type: pserver
        • Use specified module name: gpac
        • Check Out As: Check out as a project configured using New Project wizard
        • Select tag: HEAD
        • Select a wizard: C / C Project
        • Project name: gpac_cvs
        • Project types: Makefile project
        • Configuration: Default
        • cd gpac_cvs; chmod +x configure; ./configure --enable-debug
        • Project / Build All
      • Build targets
    • Build on Eclipse
      • ./configure --enable-debug
      • Make Targets: applications / testapps / broadcaster
        • gpac
          • select "gpac"
          • Add make target:
            • Project -> Make target -> Create...
              • Target name: "gpac_all"
              • Make target: "all"
              • (?) Deactivate "Run all project builders"
          • Build make target:
            • Project -> Make target -> Build...
        • broadcaster
          • Add make "broadcaster_all" target:
            • Target name: broadcaster_all
            • Make target: all
            • Deactivate "Run all project builders"
          • Build:
            • Select "broadcaster_all" / Build Make target
          • Add make "broadcaster_clean" target:
            • Target name: broadcaster_clean
            • Make target: clean
            • Deactivate "Run all project builders"
          • Build:
            • ...
      • Launch an application on debug mode:
        • Run -> Debug Configurations...
        • C / C++ Application
        • New
          • Name: "DashCast_toto"
          • Main
            • C / C++ Application: bin/gcc/DashCast
            • Project: gpac
          • Arguments
            • "-av toto.mp4 -live-media -seg-dur 10000"
        • New
          • Name: "MP4Box_1"
          • Main
            • C / C++ Application: bin/gcc/MP4Box
            • Project: gpac
        • New
          • Name: "MP4Box_add"
          • Main
            • C / C++ Application: bin/gcc/MP4Box
            • Project: gpac
          • Arguments
            • "-add toto.h264 toto.mp4"
      • Debug
        • Open Debug Dialog / C/C++ Local Application
        • Environment:
          • Variable: LD_LIBRARY_PATH
          • Value: .../gpac_cvs/bin/gcc
  • DashCast usage
  • DashCast modifications (gpac/applications/dashcast)
    • audio transcode to AAC (instead of MP2) (needed by HbbTV 1.5):
      • dashcast.conf
        • [a1]
          type=audio
          bitrate=192000
          samplerate=48000
          channels=2
          codec=aac

      • applications/dashcast/audio_muxer.h (not needed anymore?)
        • #include "libavcodec/version.h"
          #if (LIBAVCODEC_VERSION_MAJOR>53)
          #include "libavutil/channel_layout.h"
          #endif
      • applications/dashcast/audio_muxer.c, in function dc_gpac_audio_moov_create:
        • //esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_MPEG1;
          esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_AAC_MPEG4;

        • //acfg.base_object_type = GF_M4A_LAYER2;
          acfg.base_object_type = GF_M4A_AAC_LC;
        • //audio_stream->codec->sample_fmt = AV_SAMPLE_FMT_S16;
          audio_stream->codec->sample_fmt = audio_codec_ctx->sample_fmt;

      • applications/dashcast/audio_encoder.c, in function dc_audio_encoder_open:
        • //p_aout->p_codec = avcodec_find_encoder_by_name("mp2");
          p_aout->p_codec = avcodec_find_encoder_by_name(p_adata->psz_codec);
        • //audio_output_file->codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;
          if( strcmp(audio_data_conf->codec, "aac") == 0 ) {
              audio_output_file->codec_ctx->sample_fmt = AV_SAMPLE_FMT_FLTP;
          }
          else {
              audio_output_file->codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;
          }

        • /* open the audio codec */
          AVDictionary *opts = NULL;
          if( strcmp(audio_data_conf->codec, "aac") == 0 ) {
            av_dict_set(&opts, "strict", "experimental", 0);
          }
          //if (avcodec_open2(audio_output_file->codec_ctx, audio_output_file->codec, NULL) < 0) {
          if (avcodec_open2(audio_output_file->codec_ctx, audio_output_file->codec, &opts) < 0) {
              /*FIXME: if we enter here (set "mp2" as a codec and "200000" as a bitrate -> deadlock*/
              GF_LOG(GF_LOG_ERROR, GF_LOG_DASH, ("Cannot open output audio codec\n"));
              return -1;
          }

    • avc1 vs avc3 (revision >=4726)
      • controler.c
        • avc1:
          • #define VIDEO_MUXER GPAC_INIT_VIDEO_MUXER_AVC1
        • avc3:
          • #define VIDEO_MUXER GPAC_INIT_VIDEO_MUXER_AVC3

    • applications/dashcast/video_encoder.c, in function dc_video_encoder_open (needed for having SPS and PPS available on video_muxer.c) (solved on revision 4726: avc1)
      • p_voutf->p_codec_ctx->flags |= CODEC_FLAG_GLOBAL_HEADER;
    • applications/dashcast/video_muxer.c, in function dc_gpac_video_moov_create
      • avccfg = gf_odf_avc_cfg_new();
      • SPS and PPS on init mp4 (modification on video_encoder.c needed. see above) (solved on revision 4726: avc1)
        • int sps_size, pps_size, nal_separator_size;
          nal_separator_size = 4; // 00 00 00 01
          pps_size = 4;
          sps_size = p_video_codec_ctx->extradata_size - 2*nal_separator_size - pps_size;

          /*SPS*/
          GF_AVCConfigSlot *sl_sps;
          sl_sps = (GF_AVCConfigSlot*)gf_malloc(sizeof(GF_AVCConfigSlot));
          sl_sps->size = sps_size;
          sl_sps->data = (char *)gf_malloc(sizeof(char) *sl_sps->size);
          memcpy(sl_sps->data, p_video_codec_ctx->extradata + nal_separator_size, sizeof(char)*sl_sps->size);
          gf_list_add(avccfg->sequenceParameterSets, sl_sps);

          /*PPS*/
          GF_AVCConfigSlot *sl_pps;
          sl_pps = (GF_AVCConfigSlot*)gf_malloc(sizeof(GF_AVCConfigSlot));
          sl_pps->size = pps_size;
          sl_pps->data = (char *)gf_malloc(sizeof(char) * sl_pps->size);
          memcpy(sl_pps->data, p_video_codec_ctx->extradata + sps_size + 2*nal_separator_size, sizeof(char)*sl_pps->size);
          gf_list_add(avccfg->pictureParameterSets, sl_pps);

      • avc1 instead of avc3 (inband). (Needed by HbbTV 1.5) Comment the following fragment: (solved on revision 4726: avc1)
        • /*
          gf_odf_avc_cfg_del(avccfg);
          //printf("time scale: %d \n",
          //        p_video_codec_ctx->time_base.den);
          ret = gf_isom_avc_set_inband_config(p_voutf->p_isof, track, 1);
          if (ret != GF_OK) {
              fprintf(stderr, "%s: gf_isom_avc_set_inband_config\n",
                      gf_error_to_string(ret));
              return -1;
          }
          */
      • size on [tkhd] and [avc1]:
        • u32 width, height;
          width=640;
          height=360;
        • // set size in [tkhd]
          gf_isom_set_track_layout_info(p_voutf->p_isof, track, width<<16, height<<16, 0<<16, 0<<16, 0);
        • // set size in [avc1]
          // requires adding GF_EXPORT before "GF_Err gf_isom_set_visual_info(GF_ISOFile...",
          // in file src/isomedia/isom_write.c
          ret = gf_isom_set_visual_info(p_voutf->p_isof, track, di, width, height);
      • alternate brand:
        • // set alternate brand
          gf_isom_modify_alternate_brand(p_voutf->p_isof, GF_4CC('a','v','c','1'), 1);
      • other modifications to avccfg:
        • // other modifications to avccfg
          avccfg->AVCLevelIndication = 31;
          ret = gf_isom_avc_config_update(p_voutf->p_isof, track, di, avccfg);
      • ret = gf_isom_finalize_for_fragment(p_voutf->p_isof, 1);
  • Linux usage
    • Fonts
      • import MSWindows fonts
        • Mandriva Control Centre / System / Manage Windows fonts / Obtain Windows fonts 
      • modify ~/.gpacrc:
        • [FontEngine]
          FontDirectory=/usr/share/fonts/drakfont/ttf
  • MS Windows compilation
    • compile gpac_extra_libs
    • compile ffmpeg
    • MSYS_1.0.10.exe
    • MinGW Runtime: mingw-runtime-3.9.tar.gz
    • Windows API: w32api-3.6.tar.gz
    • binutils: binutils-2.15.91-20040904-1.tar.gz
    • GCC: gcc-core-3.4.2-20040916-1.tar.gz, gcc-g++-3.4.2-20040916-1.tar.gz
    • copy needed tools from MS Visual:
    • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Vc7\bin\lib.exe, link.exe -> c:\MinGW\bin
    • copy c:\Archivos de programa\Microsoft Visual Studio .NET 2003\Common7\IDE\mspdb71.dll -> c:\MinGW\bin
    • Start / MinGW / MSYS / msys.exe
    • some checks
    • cd /c/.../gpac_extra_libs/lib
    • mkdir w32_deb w32_rel
    • edit /c/.../gpac_extra_libs/libavformat/Makefile and fix the bug:
    • cp avcodec... should be: cp avformat...
    • cd /c/.../gpac_extra_libs/ffmpeg
    • ./configure --enable-shared --disable-debug --enable-memalign-hack
    • make
    • compile the rest of gpac_extra_libs with MS Visual:
    • Open build\msvc6\BuildAll.dsw
    • Batch Build
    • compile gpac with MSVisual 6.0
      • Open gpac\build\msvc6\gpac.dsw
      • set gpac_dll as active (StartUp) project
      • Build libgpac_dll
    • compile gpac with MSVisual 2005 (svn portivity)
      • open build/win32/win32.sln
      • check "Solution Platforms": Win32
      • for computers with HT or dual core: set 1 parallel process
      • Build solution
  • MS Windows Mobile compilation
    1. Be sure you have VS2005 and WM 5.0 Developer Resource Kit installed
    2. From the VS2005 open the solution file for WM5 located at: <download folder>\build\wm5\wm5.sln 
    3. Select the correct solution configuration and platform (Debug/Release and Windows Mobile 5.0 Pocket PC SDK (ARMV4I) 
    4. Connect you device using the USB cable and verify that you can communicate with it (Explore from the ActiveSync) 
    5. Compile and deploy as usual

libdash

  • How to use (libdash README.md)
  • Dependencies
    • Mageia
      • urpmi cmake lib64curl-devel
  • Download
    • git clone git://github.com/bitmovin/libdash.git libdash
  • Compilation(libdash)
    • cd libdash/libdash
    • mkdir build
    • cd build
    • cmake ..
    • make
    • cd bin
    • ./libdash_networpart_test
  • sampleclient compilation
    • Dependencies
      • Mageia
        • urpmi lib64SDL-devel
    • Problems
      • error: ‘UINT64_C’ was not declared in this scope
        • Solution
        • mv sdl sdl_old
        • Renderer/SDLRenderer.h
          • #include <SDL/SDL.h>
            #include <SDL/SDL_thread.h>

        • Renderer/IVideoObserver.h
          • #ifdef __cplusplus
            #define __STDC_CONSTANT_MACROS
            #ifdef _STDINT_H
            #undef _STDINT_H
            #endif
            # include <stdint.h>
            #endif

            #ifndef UINT64_C
            #define UINT64_C(c) (c ## ULL)
            #endif
      • error : Sleep was not declared in this scope
        • Solution
          • Decoder/LibavDecoder.cpp
            • #include <unistd.h>
              ...
              sleep...

    • cd libdash/libdash
    • CMakeLists.txt
      • add_subdirectory(sampleplayer)
    • cd build
    • cmake ..
    • make
  • qtsampleplayer compilation
    • Dependencies
      • Mageia
        • urpmi lib64qt5widgets-devel lib64qt5multimedia-devel lib64qt5network-devel lib64qt5multimediawidgets-devel lib64qt5opengl-devel
    • cd libdash/qtsampleclient
      • CMakeLists.txt
        • set(CMAKE_PREFIX_PATH /usr/lib64/qt5/lib/cmake/)
    • cd libdash/libdash
    • CMakeLists.txt
      • add_subdirectory(qtsampleplayer)
    • cd build
    • cmake ..
    • make
    • Problems
      • error: ‘usleep’ was not declared in this scope
        • Solution
          • libdashframework/Portable/MultiThreading.h
            • #include <unistd.h>
  • Usage
    • ..

Butterflow

  • Motion interpolated videos
  • Instal·lació / Installation
    • Dependències / Dependencies
      • Mageia
        • urpmi task-c++-devel lib64ffmpeg-devel python-numpy-devel
    • git clone https://github.com/dthpham/butterflow.git
    • cd butterflow
    • setup.py
      • np_includes = '/usr/lib64/python2.7/site-packages/numpy/core/include'
    • virtualenv env; source env/bin/activate
    • python setup.py develop

Bento4

  • Get the source (choose one of the following methods)
  • Prerequisites
    • urpmi gcc-c++ scons
  • Compile
    • cd ~/src/Bento4
    • scons
  • Binaries
    • ~/src/Bento4/Build/Targets/x86_64-unknown-linux/Debug/
  • Installation
    • cd /usr/local/bin
    • su; ln -s ~/src/Bento4/Build/Targets/x86_64-unknown-linux/Debug/* .
  • Documentation
    • ~/src/Bento4/Documents/SDK/Bento4_SDK_documentation.pdf
    • unzip ~/src/Bento4/Documents/Doxygen/Bento4-HTML.zip
    • ~/src/Bento4/Documents/Doxygen/Bento4-HTML/index.html

LASeR reference software

  1. Install eclipse
  2. Download ref_software_2007-01-26.zip (w8869) from MPEG site (access needed)
    1. mv LASeRCodec1206 LASeRJPlayer1206 ~/workspace
  3. Download and install Sun's J2ME Wireless Toolkit (WTK)
  4. Download and install eclipseme, a J2ME plugin from eclipse. On the web site, there are detailed instructions for setting up the plugin and for linking it with the WTK.
  5. From Eclipse, create a new Java Project, and give it the name of the directory you put into the workspace (eg. LaserJPlayer, J2ME_Renderer). Eclipse will import the project (the source files and the libraries). It is recommended to have different source/output directories (see "Window/Preferences/Java/Build path" before creating the project)
  6. Convert the newly created project into a J2ME project (right click on the project, J2ME/Convert to J2ME Midlet Suite). Select the MIDP 2.0 Platform
  7. Change the build settings as following. Right click on the project, Properties, Java Build Path, Order and Export - check library.jar.
  8. Add some .lsr input files. For doing that, create a new source directory - eg res (right click on your project, New Source Folder). Put inside the .lsr files, and rebuild
     (if you have automatic build turned on - which is the case by default - right click on the directory, and click Refresh)
  9. In the file iso.mpeg.streamezzo.player.tool.SceneLoader, you should change the INIT_LASER_URL attribute according to the input file you wish to play.
  10. For executing / debugging, right click on iso.mpeg.streamezzo.player.tool.LASeRPlayer, Run as / Debug as Emulated J2ME Midlet

OpenSVC

  • mplayer compilation
    • RTSP/RTP streaming support for MPlayer (Live555)
    • dependencies
      • Mageia 1:
        • urpmi make libvdpau-devel live-devel live libdirac-devel libxv1-devel libopenjpeg-devel libjpeg-devel libSDL-devel libpulseaudio-devel liba52dec-devel
      • Mandriva
      • urpmi libvdpau-devel libfaac-devel live-devel live libdirac-devel libxv1-devel libopenjpeg-devel libjpeg-devel libSDL-devel libpulseaudio-devel liba52dec-devel
    • get the code
      • svn co https://opensvcdecoder.svn.sourceforge.net/svnroot/opensvcdecoder opensvcdecoder
      • [svn update]
    • compile
      • cd opensvcdecoder/Mplayer
      • ./configure --enable-svc --enable-menu
      • make
    • installation
    • with Eclipse:
      • ./configure --enable-svc --enable-menu --enable-debug
      • In C/C++ Perspective -> Make Target (second tab on right panel) -> select Mplayer -> New...
        • Target name: all
    • usage
  • compilació de només les biblioteques / only libraries compilation (per a ser utilitzades, per exemple, amb GPAC MP4Client)
    • dependencies
      • Mageia 1
        • urpmi cmake gcc-c++ libSDL-devel
    • compilation
      • cd opensvcdecoder/Libs
      • cmake CMakeLists.txt
      • make
    • installation
      • make install (it will install /usr/local/lib/libOpenSVCDec.so)
    • with Eclipse:
      • In C/C++ Perspective -> Make Target (second tab on right panel) -> select Libs -> New...
        • Target name: all
    • player usage
  • GPAC with OpenSVC

SVC reference software (JSVM)

  • Modules:
    • DownConvertStatic
    • H264AVCEncoderLibTestStatic
    • H264AVCDecoderLibTestStatic
    • AvcRewriter
    • BitStreamExtractorStatic
    • QualityLevelAssignerStatic
    • MCTFPreProcessor
    • PSNRStatic
    • FixedQPEncoderStatic
    • SIPAnalyser
    • YUVCompareStatic
  • Compilació / Compilation
    • dependencies
    • get the code
      • GitHub
        • floriandejonckheere/jsvm
      • cvs (outdated)
        • cvs -d :pserver:jvtuser:xxxxx@garcon.ient.rwth-aachen.de:/cvs/jvt login
        • cvs -d :pserver:jvtuser@garcon.ient.rwth-aachen.de:/cvs/jvt checkout jsvm
        • cvs update
    • compile
    • cd jsvm/JSVM/H264Extension/build/linux
    • make
  • Utilització / Usage
    • H264AVCEncoderLibTestStatic -pf encoder.cfg
    • example configuration files:
      • JSVM/H264Extension/data
      • JSVM0-config-samples
    • AVC / MVC:
      • encoder.cfg
        • AVCMode 1
        • InputFile toto.yuv
        • OutputFile toto_avc.264
        • ReconFIle toto_recon.yuv
        • SourceWidth win
        • SourceHeight hin
        • FrameRate fps
        • FramesToBeEncoded frames
        • SequenceFormatString (A: IDR intra; I: non-IDR intra; P: predicted: B: bidirectional) (upper case: to be used as reference; lower case: not to be used as reference):
          • A0*2{P2b0b1}
          • A0*1{P2P5P8b0b1b3b4b6b7b9b10}
          • ...
        • GOPSize, IntraPeriod, IDRPeriod not working? Only for SVC (AVCMode 0)?
    • SVC
      • Number of layers:
        • Spatial or CGS quality (D):
          • NumLayers
        • MGS quality (Q):
          • MgsVectorMode
          • MGSControl
        • Temporal (T)
          • log_2(GOPSize) + 1
      • Preparation:
        • DownConvertStatic win hin toto.yuv w1 h1 toto_w1xh1.yuv method t skip frames
        • DownConvertStatic win hin toto.yuv w2 h2 toto_w2xh2.yuv method t skip frames
      • encoder.cfg
        • [AVCMode 0]
        • OutputFile toto_svc.264
        • GOPSize
        • IntraPeriod
        • IDRPeriod
        • NumLayers
        • LayerCfg cfg/layer0.cfg
        • LayerCfg cfg/layer1.cfg
        • ...
      • cfg/layer0.cfg
        • InputFile orig/toto_w1xh1.yuv
        • IntraPeriod
        • IDRPeriod
      • cfg/layer1.cfg
        • InputFile orig/toto_w2xh2.yuv
        • IntraPeriod
        • IDRPeriod
      • ...
  • info about an SVC file (DTQ)
    • jsvm/bin/BitStreamExtractorStatic toto.264
  • IDR (to be able to switch layers more often):
    • layer cfg file (section INPUT/OUTPUT):
      • IDRPeriod     8

Flameproject

  • urpmi libgnome2_0-devel

Biblioteques compartides / Shared libraries

  • Per a afegir un camí amb biblioteques compartides / To add a path which contains shared libraries:
    • edit /etc/ld.so.conf
    • ldconfig

Llengua / Language


Servei / Service

  • UbuntuBootupHowto
  • /etc/init.d/toto:
    • #!/bin/sh
      #
      # Startup script for the toto daemon
      #
      # chkconfig: 2345 26 59
      #
      # description: toto daemon
      #
      ### BEGIN INIT INFO
      # Provides: toto
      # Should-Start: xxxx
      # Required-Start: xxx
      # Required-Stop: xxx
      # Default-Start: 2 3 4 5
      # Short-Description: Toto daemon
      # Description: Toto daemon
      ### END INIT INFO

      . /etc/init.d/functions

      case "$1" in
        start)
              gprintf "Starting toto daemon: "
              daemon "/usr/bin/toto -i 172.16.11.5" -d
              RETVAL=$?
              echo
              [ $RETVAL -eq 0 ] && touch /var/lock/subsys/toto
              ;;
        stop)
              gprintf "Shutting down toto daemon: "
              killproc toto
              RETVAL=$?
              echo
              [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/toto
              ;;
        status)
              status toto
              RETVAL=$?
              ;;
        restart|reload)
              $0 stop
              $0 start
              ;;
        condrestart)
              [ -f /var/lock/subsys/toto ] && restart || :
              ;;
        *)
              gprintf "Usage: %s {start|stop|status|restart}\n" "$0"
              RETVAL=1
              ;;
      esac

      exit $RETVAL
  • ln -s /etc/init.d/toto /etc/rc5.d/S99toto
  • service toto start
  • Configuració / Setup
    • chkconfig
      • chkconfig -list
    • install a service:
      • update-rc.d to make all the links from /etc/rc?.d/ to /etc/init.d/toto (start: 90, kill: 10)
        • sudo update-rc.d toto defaults 90 10
    • uninstall a service:
      • sudo rm /etc/rc*/*toto

Logitech Harmony

  • concordance (develop)
    • Harmony 700
      • concordance >= 0.22
    • [cvs -d:pserver:anonymous@concordance.cvs.sourceforge.net:/cvsroot/concordance login]
    • [cvs -z3 -d:pserver:anonymous@concordance.cvs.sourceforge.net:/cvsroot/concordance co -P concordance]
    • urpmi autoconf automake make gcc-c++ libtool-base libusb-compat0.1-devel
    • cd concordance/libconcord
      • autoreconf --install
      • ./configure
      • make
      • make install
    • cd concordance/libconcord/bindings/python
      • urpmi libpython2.6-devel
      • python setup.py install
    • cd concordance/concordance
      • autoreconf --install
      • ./configure
      • make
      • make install
    • Add /usr/local/lib to the library path
  • congruity (GUI)
  • http://members.harmonyremote.com/ (it will call Congruity)

SVG

  • Include scalable SVG into HTML (Inkscape ViewBox bug, Bug #168261) (feedicons examples):
    • .svg
      • <svg ...
        width="..."
        height="..."
        ViewBox="0 0 200 100">
        ...

    • .html (figure scaled to 40x20 pixels)
      • <object type="image/svg+xml" data="figure.svg" width="40" height="20">
        You cannot display SVG files.
        </object>

Dropbox

  • Dropbox
  • The Unofficial Dropbox wiki
  • Linux installation (Dropbox: Painless and Free Backup)
    • from package
      • Mageia
        • urpmi nautilus-dropbox (will also install dropbox package)
    • from code:
      • Mageia
        • urpmi gcc make lib64nautilus-devel python-docutils
      • wget https://linux.dropbox.com/packages/nautilus-dropbox-1.6.1.tar.bz2
      • tar xjf nautilus-dropbox-1.6.1.tar.bz2
      • cd nautilus-dropbox-1.6.1
      • ./configure; make;
      • su; make install
    • (as user): dropbox start -i
    • nautilus will open /home/user/Dropbox/ folder
    • rm -f ~/.dropbox-dist/libz.so.1
      dropbox start

    • (run dropbox again and follow the displayed URL to sync your Dropbox account to your PC)
  • Problems:
    • Plasma / KDE5 (e.g. Mageia 6)
      • "isn't running"
      • Solució provisional / Workaround
        • CTRL + ALT F2 to open a text console
          • $ dropbox start
        • or use Gnome instead of Plasma
    • Dropbox Not Syncing On Ubuntu Linux
      • Solution:
        • kill the dropbox process
        • dropbox start
  • Website host

Google Drive

  • Grive
    • Installation [Grive]
      • Dependències / Dependencies
        • urpmi cmake lib64json-devel
      • yajl
        1. git clone git://github.com/lloyd/yajl yajl
        2. cd yajl
        3. ./configure
        4. cmake .
        5. make
        6. su; make install
      • grive
        1. git clone https://github.com/Grive/grive.git
        2. cd grive
        3. cmake .
        4. make
        5. su; make install
    • Usage
      • ...

Media Tomb (UPnP server)

  • urpmi mediatomb
  • /etc/mediatomb.conf
    • MT_INTERFACE="eth0"
  • service mediatomb start
  • /etc/mediatomb/
    • config.xml
      • <name>Servidor MediaTomb</name>
  • add supoort for mts (MPEG-2 TS) files:
    • config.xml
      • <map from="mts" to="video/mpeg"/>
        <map from="ts" to="video/mpeg"/>
        <map from="m2ts" to="video/mpeg"/>
  • Administració / Administration

DirectFB

Emacs 

  • Paquets / Packages
    • ELPA / MELPA
      • Emacs: How to Install Packages Using ELPA, MELPA
      • Installation
        • ~/.emacs
          • (when (>= emacs-major-version 24)
              (require 'package)
              (add-to-list
               'package-archives
               '("melpa" . "http://melpa.org/packages/")
               t)
              (package-initialize))
      • Usage
        • M-x list-packages
  • Meta key (M-)
    • ESC (and release)
    • Alt (and keep)
  • xemacs indent tutorial
  • c-set-style java
  • Instal·lació d'un mode / Mode installation
    • set ~/.emacs.d as part of load-path
      • ~/.emacs
        • (add-to-list 'load-path "~/.emacs.d")
    • put your file in:
      • ~/.emacs.d/toto.el
    • load it from ~/.emacs
      • ~/.emacs
        • (require 'toto)
  • carregar un fitxer .el / load a .el file
    • M-x load-file
    • .emacs:
      • (load "~/nxml-mode-200YMMDD/rng-auto.el")
  • carregar un mode / load a mode
    • M-x [sh-mode c-mode xml-mode...]
    • .emacs:
      • (setq auto-mode-alist
                (cons '("\\.\\(xml\\|xsl\\|rng\\|xhtml\\)\\'" . nxml-mode)
                      auto-mode-alist))
  • informació sobre un mode / information about a mode
    • M-x describe-mode
  • newline in replace:
    • C-q C-j
  • Inverted colours (reverse video):
    • emacs -rv
  • printf colors
    • Ansi Color (built-in)
      • M-x load-library ansi-color
        M-: (ansi-color-apply-on-region (point-min) (point-max))

  • columnes / columns
    • M-x column-number-mode
    • .emacs
      • (setq column-number-mode t)
  • parèntesis
  • cerca
    • tornar al lloc després de la cerca:
      • C-x C-x
  • Índex a partir d'una cerca:
    • M-occurs
  • .emacs:
    • disable bell
      • (setq visible-bell t)
    • font
      • (set-default-font "6x13")
  • auto-fill (automatic introduction of newlines for long lines):
    • mouse-3 button over (Text) at bottom to activate or deactivate it
  • posar bé un paràgraf / fill paragraph:
    • M-q
  • eliminar els retorns de carro / join line:
    • aneu a la darrera línia del paràgraf i aneu fent una de les següents opcions:
      • M-^ (cal fer un espai, perquè ^ és una tecla morta)
      • M-x join-line
  • conflictes / conflicts (text diff)
  • envoltar un text seleccionat
    • wrap-region.el
      • dependencies
        • M-x package-install
      • cd ~/.emacs.d/
      • wget https://raw.githubusercontent.com/rejeep/wrap-region.el/master/wrap-region.el
      • i18n in Smarty
        • (wrap-region-add-wrapper "{t}" "{/t}" "/")     ; hit / then region -> {t}region{/t}
      • .emacs
        • (add-to-list 'load-path "~/.emacs.d/wrap-region.el")
      • usage
        • M-x html-mode
        • M-x wrap-region-mode
        • select text
        • type '/'
  • Indentation
  • tabs
    • Show white space
      • WhiteSpace
        • install
          • ~/.emacs
            • (require 'whitespace)
        • activate
          • C-u 1 M-x whitespace-mode RET
        • deactivate
          • C-u 0 M-x whitespace-mode RET
    • usage


      only for this session permanently, in ~/.emacs
      display

      M-x set-variable RET tab-witdth RET 4 (setq tab-width 4);
      insert
      CCMode
      c-basic-offset


      perl
      cperl-indent-level






    • inserting
      • (setq tab-stop-list 4);
    • (setq default-tab-width 4);
    • (setq-default indent-tabs-mode t);
    • tabs -> spaces
      • M-x untabify
    • spaces -> tabs
      • M-x tabify

Fitxers de text / Text files

  • Codificació de text / Text encoding
    • Per a saber en quina codificació està un fitxer .tex (*):
    • Per a canviar la codificació del fitxer (d'iso-8859-1 a UTF-8):
      • iconv -f iso-8859-1 -t utf8 toto.tex > toto2.tex
      • recode UTF-8 toto.tex
      • convert_html_encoding.sh
        • #!/bin/bash

          # defaults
          output_encoding=utf-8

          EXPECTED_ARGS=1
          if (( $# != $EXPECTED_ARGS ))
          then
              cat <<EOF
          Usage: `basename $0` html_filename

          Converts html_filename to ${output_encoding}, by modifying the file text encoding and setting:
            <meta content="text/html; charset=${output_encoding}" http-equiv="Content-Type">
          EOF
              exit 1
          fi

          # parameters
          input_path=$1

          input_basename=$(basename ${input_path})
          input_name=${input_basename%.*}
          input_extension=${input_basename##*.}
          input_dirname=$(dirname ${input_path})

          output_basename=${input_name}.${output_encoding}.${input_extension}
          output_path=${input_dirname}/${output_basename}

          # get present mime-type
          mime=$(file -bi ${input_path})
          echo "file mime: ${mime}"

          # get present text encoding charset
          charset=${mime##*=}
          echo "file charset: ${charset}"

          if [[ $charset != $output_encoding ]]
          then
              echo "converting file to $output_encoding"
             
              # convert file encoding
              iconv -f ${charset} -t ${output_encoding} ${input_path} >${output_path}
             
              # convert html charset
              sed -i "/<meta.*charset/ c\  <meta content=\"text/html; charset=${output_encoding}\" http-equiv=\"Content-Type\">" ${output_path}
             
              # rename output file
              rm -f ${input_path}
              mv ${output_path} ${input_path}
          else
              echo "file already in $output_encoding"
          fi

          exit 0

  • Per a canviar la codificació del nom del fitxer:
    • convmv -f ascii -t utf8 --notest [filename] > [newfilename]
  • Diferències / Differences

eyeOS

  1. urpmi php-curl php-mbstring php-mcrypt php-mysqli php-sqlite3 php-pdo_mysql php-pdo_sqlite openoffice.org-pyuno
  2. Download the latest version
  3. untar it
  4. /etc/httpd/conf/vhosts.d/eyeos.conf:
    • Alias /eyeOS /var/www/eyeOS
      <Directory "/var/www/eyeOS">
          Options -Indexes FollowSymLinks MultiViews
          AllowOverride None
          Order allow,deny
          Allow from all
      </Directory>
  5. Open http://localhost/eyeOS/install

LDAP (Lightweight Directory Access Protocol)

  • Info
  • Servidor / Server
    • OpenLDAP
      • slapd (server)
      • modes
      • install
        • urpmi openldap-servers
      • config:
      • afegir entrades / add entries
        • ldapadd
          • -x: simple authentication
          • -W: prompt for password
          • -D: bind dn
        • general:
          • edit general.ldif:
            • dn: dc=example,dc=com
              dc: example
              objectClass: top
              objectClass: domain

              dn: ou=usuaris,dc=example,dc=com
              ou: usuaris
              objectClass: top
              objectClass: organizationalUnit

              dn: ou=grups,dc=example,dc=com
              ou: grups
              objectClass: top
              objectClass: organizationalUnit

          • ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f general.ldif
        • grups / groups:
          • grups.ldif (or generated by a script)
            • dn: cn=example,ou=grups,dc=example,dc=com
              objectClass: posixGroup
              cn: grup1
              gidNumber: 10000
          • ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f grups.ldif
        • persones / people:
          • usuaris.ldif (or generated by a script)
            • ...
              objectClass: posixAccount
              ...

          • ldapadd -x -W -D "cn=Manager,dc=example,dc=com" -f usuaris.ldif
    • Apache DS
  • Clients
    • command line
      • openldap client
        • urpmi openldap-clients
        • usage:
          • ldapsearch -x -b 'dc=example,dc=com' '(objectclass=*)'
          • ldapsearch [-h ldap_server] -xLLL -b 'dc=example,dc=com' '(objectclass=posixGroup)' cn gidNumber
      • shelldap
        • urpmi shelldap
      • smbldap-tools
        • urpmi smbldap-tools
        • /etc/smbldap-tools/smbldap.conf
          • ...
        • usage:
          • smbldap-...
          • smbldap-passwd
          • ...
    • GUI tools (Samba & LDAP)
    • Apache Directory Studio
      • Bind DN or user:
        • cn=Manager,dc=example,dc=com
    • LUMA browser
    • Mandriva Directory Server - MDS
  • Integration with:
    • Bugzilla
    • DHCP
    • MMC (Pulse2)
    • OpenSSH
      • /etc/ssh/sshd_config
        • PAMAuthenticationViaKbdInt yes
    • PAM (Pluggable Authentication Module) in Unix
      • Mageia
        • drakauth (urpmi drakxtools-curses) (MCC: Sistema -> Autenticació)
        • [urpmi nss_ldap pam_ldap autofs nss_updatedb pam_ccreds]
    • Samba
    • Subversion

MMC Mandriva Management Console

  • Mandriva Management Console
  • Packages

    • MMC
      (3.0.4)
      Pulse2
      (1.3.1)
      Mandriva Directory Server
      (2.4.2.2)
      core
      plugins

      source
      mmc-core-3.0.3.2.tar.gz
      mmc-core-3.0.3.2.tar.gz
      pulse2-1.3.1.1.tar.gz mds-2.4.2.2.tar.gz
      server
      MMC web interface

      • mmc-web-base
      • mmc-web-ppolicy
      • mmc-web-pulse2
      • mmc-web-dyngroup
      • mmc-web-glpi
      • mmc-web-imaging
      • mmc-web-inventory
      • mmc-web-msc
      • mmc-web-pkgs
      • mmc-web-bulkimport
      • mmc-web-mail
      • mmc-web-network
      • mmc-web-proxy
      • mmc-web-samba
      • mmc-web-sshlpk
      • mmc-web-userquota
      MMC agent
      • mmc-agent
      • python-mmc-core
      • python-mmc-base
      • python-mmc-ppolicy

      • python-mmc-pulse2
      • python-mmc-dyngroup
      • python-mmc-glpi
      • python-mmc-imaging
      • python-mmc-inventory
      • python-mmc-msc
      • python-mmc-pkgs
      /usr/share/doc/python-pulse2-common/ contrib/<PLUGIN>/sql/install.sh
      /etc/mmc/plugins/
      • python-mmc-bulkimport
      • python-mmc-mail
      • python-mmc-network
      • python-mmc-proxy
      • python-mmc-samba
      • python-mmc-sshlpk
      • python-mmc-userquota
      servers


      • pulse2-common
      • pulse2-imaging-server
      • pulse2-inventory-server
      • pulse2-launcher
      • pulse2-package-server
      • pulse2-scheduler
      /etc/mmc/pulse2

      client


      • pulse2-imaging-client

  • Pre-install
    • Get MMC source
      • wget http://mds.mandriva.org/pub/mmc-core/sources/3.0.2.1/mmc-core-3.0.2.1.tar.gz
      • tar xvzf mmc-core-3.0.2.1.tar.gz
    • Get MMC / Pulse2 packages
      • Debian Squeeze
        • /etc/apt/sources.list
          • deb http://pulse2.mandriva.org/pub/pulse2/server/debian squeeze 1.3.1.1
          • [deb http://mds.mandriva.org/pub/mds/debian squeeze main]
        • sudo apt-get update
        • dpkg-reconfigure debconf
          • medium
        • sudo apt-get install slapd mysql-server
        • sudo apt-get install mmc-agent python-mmc-dyngroup python-mmc-imaging python-mmc-inventory python-mmc-msc python-mmc-pkgs python-mmc-pulse2 mmc-web-base mmc-web-dyngroup mmc-web-imaging mmc-web-inventory mmc-web-msc mmc-web-pkgs mmc-web-pulse2
      • Mandriva / Mageia
        • urpmi php-xmlrpc php-gd python-sqlalchemy python-mysql python-OpenSSL python-ldap
  • Install from source (README, INSTALL)
    • cd mmc-core-3.0.2.1
    • ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
    • make
    • make install
      • ### MMC LDAP schema must be added to your LDAP directory in order for
        ### mmc-agent to run.
        ### If using dynamic backend (from OpenLDAP 2.3), schema must be converted
        ### in LDIF format.
        ### You can use "mmc-add-schema" to convert and add the schema.
        ### Schema file is available in: /usr/share/doc/python-mmc-base/contrib/ldap
  • Install from package
    • Debian:
      • LDAP and MySQL root password will be configured after package installation
  • Post-install
    • LDAP ("slapd using LDAP based configuration") (INSTALL)
      • Debian
        • dpkg-reconfigure slapd
          • DN: example.com (must match baseDN in /etc/mmc/plugins/base.ini)
        • [slappasswd -s secret]
        • [sudo debconf-show slapd]
        • sudo apt-get install ldap-utils
        • mmc-add-schema /usr/share/doc/python-mmc-base/contrib/ldap/ /etc/ldap/schema/
        • sudo /etc/init.d/slapd restart
      • Mageia
        • mmc-add-schema /usr/share/doc/python-mmc-base/contrib/ldap/ /usr/share/openldap/schema/
        • service slapd restart
    • MMC agent
      • /etc/mmc/plugins/base.ini
        • baseDN = dc=example, dc=com
        • password = secret
        • [computers]
          method = inventory
      • mkdir /home/archives
      • /etc/default/mmc-agent
        • ENABLE=yes
      • /etc/init.d/mmc-agent start
      • If you get a "failed", try with debugging:
        • mmc-agent -d
    • Apache
      • Debian
        • ln -s /etc/mmc/apache/mmc.conf /etc/apache2/conf.d/
        • sudo /etc/init.d/apache2 restart
      • Mandriva / Mageia
        • ln -s /etc/mmc/apache/mmc.conf /etc/httpd/conf.d/
        • service httpd restart
  • MMC usage

Pulse2




  • latest (1.3.1) 1.3.0
    download
    http://pulse2.mandriva.org/pub/pulse2/
    Pulse2 Downloads Pulse2 Downloads (Previous releases)
    documentation
    install
    from source

    from packages
    Pulse2-Install-Debian-Lenny.pdf
    user

    User manuals
    development




  • Architecture
    • Services
      • Inventory
      • Launcher
      • Package
      • Scheduler
    • MMC (Mandriva Management Console) plugins
      • Dyngroup
      • Inventory
        • Fusion Inventory agent for Android
          • "FusionInventory agent for other platforms (Linux, Windows, ...) can also be used as a drop-in in replacement of OCSInventory agent for inventory part."
      • GLPI (when Inventory is not used)
      • MSC
      • Pkgs
  • General
  • Pulse2 Documentation (Previous documentation)
  • Documentation
  • Prerequisites
    • MMC
    • urpmi python-sqlalchemy python-mysql
  • Installation from package
  • Installation from source (README, INSTALL)
    • Info
      • /usr/share/doc/pulse2/
    • Compilation and installation
      1. wget pulse2-1.3.1.1.tar.gz
      2. tar xvzf pulse2-1.3.1.1.tar.gz; cd pulse2-1.3.1.1
      3. ./configure --disable-nsis --prefix=/usr --sysconfdir=/etc --localstatedir=/var
      4. make
      5. make install
    • Post-install (choose one of the following)
      • pulse2-setup
      • manual MySQL config:
        • setup
          • mysql -u root -p
          • create database pulse2;
          • create database msc;
          • create database imaging;
          • create database inventory;
          • create database dyngroup;
          • create user 'mmc'@'localhost' identified by 'mmc';
          • grant all on pulse2.* to 'mmc'@'localhost';
          • grant all on msc.* to 'mmc'@'localhost';
          • grant all on imaging.* to 'mmc'@'localhost';
          • grant all on inventory.* to 'mmc'@'localhost';
          • grant all on dyngroup.* to 'mmc'@'localhost';
          • flush privileges;
        • installation
          • cd /usr/share/doc/pulse2-common/contrib/
          • ./pulse2/sql/install.sh
          • ./msc/sql/install.sh
          • ./imaging/sql/install.sh
          • ./inventory/sql/install.sh
          • ./dyngroup/sql/install.sh
    • usage

FLUTE

DSM-CC

  • redbutton
    • Installation
      • urpmi redbutton-download redbutton-browser
    • Compilation
      • Compiling and using MHEG Engine Redbutton
      • rb-download
        • urpmi zlib1-devel
        • get it (one of the following):
          • svn checkout https://redbutton.svn.sourceforge.net/svnroot/redbutton/redbutton-download/trunk/ redbutton-download
          • wget http://sourceforge.net/projects/redbutton/files/current/redbutton-download-20090727.tar.gz
        • make
        • usage:
          • you need a channels.conf file correctly generated. The last field in each line corresponds to the service_id
          • dvbtune -f 658000 -qam 64 -gi 4 -cr AUTO -bw 8 -tm 8 && rb-download -vv
          • dvbtune -f 818000 -qam 64 -gi 4 -cr AUTO -bw 8 -tm 8 && rb-download -vv -c 35490 (TVE La1)
          • dvbtune -f 650000 -qam 64 -gi 32 -cr AUTO -bw 8 -tm 8 && rb-download -vv [-c carousel_id] service_id
          • ...
      • rb-browser
        • urpmi libexpat1-devel libfreetype6-devel libffmpeg-devel libxrender1-devel libxft-devel libpng-devel
        • get it:
          • svn checkout https://redbutton.svn.sourceforge.net/svnroot/redbutton/redbutton-browser/trunk/ redbutton-browser
        • make

dvbsnoop

  • Compilació / Compilation
    • Get the source:
      • ...
    • Get and apply patches
    • Compile

Diccionaris per a Netscape

  • Aquests són alguns diccionaris:
  • Linux: poseu-los a /usr/lib/netscape/spell
  • MS Windows: poseu-los a ...\Netscape\Communicator\Program\SpellChk\

Diccionaris per a ispell

  1. Obteniu els diccionaris (de català: ispell-ca, Softcatalà)
  2. Modifiqueu [/usr/share/emacs/20.7/lisp/]ispell.el per a afegir el català i compilar-lo (menú Emacs-Lisp/Byte-compile this file) Amb això ens funcionarà ispell-change-disctionary (accessible també des del menú Edit/Spell/Change dictionary)
  3. Modifiqueu [/usr/share/emacs/20.7/lisp/]loaddefs.el per a afegir el català i compilar-lo (menú Emacs-Lisp/Byte-compile this file) Amb això funcionarà el menú Edit/Spell/Select Catala.

Internacionalització de Netscape

Per a tenir el Netscape internacionalitzat des de UNIX us heu d'instal·lar:
  1. netscape-communicator
  2. (algun netscape-llengua)
Després establiu la variable d'entorn LANG al valor desitjat:
  • ca -> català
  • es -> castellà
I el netscape se us engegarà en aquella llengua.

Diccionari català per a MS Word

Descarregueu-vos aquest fitxer i seguiu les instruccions del fitxer HTML:

Defunció del ratolí en Linux

Si el ratolí se us ha mort mentre utilitzàveu Linux, proveu el següent:
  1. CTRL+ALT+F1 per anar a una sessió de text.
  2. Mogueu el ratolí i veureu el cursor (quadrat blanc) que belluga.
  3. CTRL+ALT+F7 per a tornar allà on éreu. El ratolí hauria d'anar bé.

Ratolí estrany en MSWindows 2000 sota VMWare

  • Dins de MSWindows: mireu si teniu dues petites icones a baix a la dreta que siguin "VMWare tools". Elimineu la que té el martellet i deixeu la del logotip de VMWare.
  • Més informació a vmware.for-linux.configuration: Jumpy mouse

CVS

  • server (computer_name)
    • urpmi cvs xinetd
    • cvs -d /usr/local/cvsroot/repository_name init
    • chown cvs.cvs /usr/local/cvsroot
    • sticky group (els nous fitxers i directoris es crearan amb el grup cvs / new files and directories are created as group cvs): 
      • chmod 2775 /usr/local/cvsroot
    • edit/etc/cvs/cvs.conf:
      • CVS_REPOS="/usr/local/cvsroot/repository_name"
    • start cvspserver (as root): 
      • (urpmi xinetd)
      • chkconfig cvs on
      • service xinetd restart
    • tallafoc / firewall:
      • mcc:
        • 2401/tcp
    • client: cvs -d :pserver:usuari@computer_name:/usr/local/cvsroot/repository_name login
  • Per a fer servir el WinCVS:
    • La primera vegada
      • CVSROOT -> :pserver:username@dev.isoco.com:/usr/local/cvs-repository
      • Identification: password on CVS server
      • Admin / Login
      • Create / Checkout del projecte que ens interessa:
        • Local directory: BackOfficeCVS (o un altre qualsevol)
        • CVS directory: BackOfficeRepository
      • Globals / read-only deshabilitada
    • Les altres vegades
      • per a pujar un fitxer que hem modificat: commit
      • per a baixar-nos l'última versió que hi ha al CVS: update
  • Si els fitxers es pugen per primera vegada al CVS en mode binary es baixaran com a tals quan es faci checkout o update.
  • L'inconvenient de fer-ho en binari és que si es modifica localment una versió més antiga que la que hi havia al CVS, no es fa el merge automàticament quan es puja.
  • Les combinacions text/binary són:
    PC local (commit) CVS (update) PC local fitxer final
    paraula^M -(bin)-> paraula^M -(-kb)-> paraula^M PC



    -(-ko)-> paraula^M^M Netscape
    paraula^M -(text)-> paraula -(-kb)-> paraula UNIX



    -(-ko)-> paraula^M PC

  • Per a eliminar "-kb" d'un fitxer (*):
    • cvs admin -kkv toto.txt
    • cvs update -A toto.txt (des de lincvs: "Treure opcions locals (-kx")
  • Per a eliminar "-kb" de tots els fitxers d'un directori (*):
    • find . -type f -maxdepth 1 -print | xargs -n1 cvs admin -kkv
    • find. -type f -maxdepth 1 -print | xargs -n1 cvs update -A
  • Els finals de línia es fan de les formes següents, depenent del sistema operatiu (aquesta nomenclatura és la que fa servir TextPad):
    PC ^M \r \n CR LF
    UNIX      \n    LF
    Mac ^M \r CR
    Netscape ^M^M \r \r \n CR CR LF
    CR: 0D, LF: 0A

  • Vigileu que el rellotge del vostre ordinador estigui ben configurat (GMT+1) i a l'hora. Si no, pot ser que no es detectin diferències entre els fitxers locals i els corresponents al CVS.
  • Canvi de log en un commit:
    • crear nou_log.txt amb els nous comentaris per a la versió 1.35 de fitxer.cpp (que conté uns comenatris erronis)
    • Linux:
      • cvs admin -m 1.35:"`cat nou_log.txt`" fitxer.cpp
    • Cygwin:
      • /cygdrive/c/Archivos\ de\ programa\LinCVS\cvs admin -m 1.35:"`cat nou_log.txt`" fitxer.cpp
    • MS Windows (amb text de comentari simple):
      • "c:\Archivos de programa\LinCVS\cvs.exe" admin -m 1:35:"canvis de l'actual versió" fitxer.cpp

WinCVS -> LinCVS

  • CVS/Root:
    • :pserver;username=usuari;hostname=maquina:/cvsroot -> :pserver:usuari@maquina:/cvsroot

Subversion

  • servidor (maquina)
  • Sincronització / Synchronisation
  • GUI client
    • Eclipse
    • esvn
      • File / Options / Other / Authentication / User and Password
      • ~/.qt/esvnrc
    • TortoiseSVN
  • Client
    • List of modules:
      • svn list svn://maquina/repo1 --verbose --non-interactive
      • ~/.subversion
    • Creació de directoris / Creation of directories
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/ -m "added module_name"
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/trunk/ -m "added module_name trunk"
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/tags/ -m "added module_name tags"
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/branches/ -m "added module_name branches"
      • svn mkdir svn://usuari@maquina/repo1/module_name_remote/trunk/dir1/ -m "added dir1"
    • Pujada de codi per primera vegada / First time upload
      • cd module_name_local_dir_no_svn
      • svn import . svn://host/repo1/module_name_remote/trunk/
    • Baixada de codi per primera vegada / First time download:
      • svn co svn://host/repo1/module_name_remote/trunk/ /local/dir/module_name_local
    • Estat local / Local status
      • svn status
    • Estat remot / Remote status
      • svn status -uv
    • Actualització / Update
      • svn update
    • Afegir / Add
      • svn add file1 file2 ...
      • svn delete --keep-local file1 file2 ...
      • un directori, però sense el seu contingut / a directory without its contents
        • svn add --depth=empty name_dir
    • Pujada / Commit
      • svn commit [fitxer_local] -m "comentari"
    • Diferències locals / Local differences
      • svn diff
      • svn diff | kompare -on -
      • meld .
    • Diferències remotes / Remote differences
      • svn diff -r HEAD
    • Dóna un conflicte per resolt / Mark a conflict as resolved
      • svn resolved toto.txt
    • Etiquetes / Tags
      • svn copy http://svn.example.com/repos/calc/trunk http://svn.example.com/repos/calc/tags/release-1.0 -m "Tagging the 1.0 release of the 'calc' project."
    • Propietats / Properties
      • Estableix les propietats / Set properties (*)
        • directament / directly:
          • svn propset svn:ignore dirname .
        • editant-les / editing:
          • svn propedit svn:ignore . --editor-cmd emacs
        • des de fitxer / from file:
          • svn propset svn:ignore -F file.txt .
          • on / where file.txt
            • dir1
              dir2

      • Unset
        • svn pdel svn:ignore .
      • Get properties
        • svn proplist
        • svn propget svn:ignore
      • List of properties
        • svn:ignore
        • svn:external
      • Eclipse
    • Remote dump:
      • svnrdump (v>=1.7)
        • urpmi subversion-tools
      • rsvndump
      • Creació del dump:
        • svnrdump dump http://server_name/repository_name/ > repository_name.dump
      • Recuperació del dump:
        • svnrdump load http://new_server_name/new_repository_name/ < repository_name.dump
        • Problemes / Problems:
          • svnrdump: E165006: Repository has not been enabled to accept revision propchanges;
          • Solució / Solution (*):
            • al servidor / on server (new_server_name):
              • cd /var/lib/svn/repositories
              • echo '#!/bin/sh' > new_repository_name/hooks/pre-revprop-change
              • chmod 755 new_repository_name/hooks/pre-revprop-change
    • Canvi de servidor:
      • svn sw --relocate old_url new_url
    • svn+ssh
      • NOTE: if you don't generate the pair of keys, you can use svn+ssh schema with login/password, but you need to specify the absolute path.
      • ssh-keygen -t rsa -C remoteserver_name -f ~/.ssh/id_rsa_remoteserver
      • edit file ~/.ssh/config
        • Host hostname
              HostName hostname
              User username
              IdentityFile ~/.ssh/id_rsa_remoteserver
      • chmod 600 ~/.ssh/config
      • send ~/.ssh/id_rsa_hostname.pub to hostname and put it under ~username/.ssh/authorized_keys. All this is done by simply:
        • ssh-copy-id -i .ssh/id_rsa_remoteserver.pub username@remoteserver
      • svn list svn+ssh://username@hostname/absolute_path/to/repo1
      • if you want to avoid the specification of the absolute path, edit the file on the server:
        • ~username/.ssh/authorized_keys
          • command="/path/to/svnserve -t -r /virtual/root" ssh-rsa KEY COMMENT (where /virtual/root could be, e.g. /var/lib/svn/repositories/)
        • then you can access the repository with:
          • svn list svn+ssh://username@hostname/repo1
  • cvs2svn
    • urpmi cvs2svn
    • Documentation
    • without options file
      • cvs2svn -s /var/lib/svn/repositories/repo2 --encoding latin_1 /usr/local/cvsroot/repository_name/module_name (/usr/local/cvsroot/repository_name/CVSROOT exists)
      • cvs2svn --dumpfile DUMPFILE CVSREPOS
    • with options file
        • (cd /home/cvs)
        • wget http://cvs2svn.tigris.org/source/browse/*checkout*/cvs2svn/tags/2.3.0/cvs2svn-example.options
        • cp cvs2svn-example.options your_file.options
      • your_file.options:
        • ctx.cvs_author_decoder = CVSTextDecoder(['latin1',],)
          ctx.cvs_log_decoder = CVSTextDecoder(['latin1',],)
          ctx.cvs_filename_decoder = CVSTextDecoder(['latin1',],)
        • ctx.output_option = DumpfileOutputOption(
              dumpfile_path=r'toto.dump', # Name of dumpfile to create
              )
        • run_options.add_project(
          'my/cvsrepo/project_a',
          trunk_path='project_a/trunk',
          branches_path='project_a/branches',
          tags_path='project_a/tags',
          symbol_transforms=[
          #...whatever...
          ],
          symbol_strategy_rules=[
          #...whatever...
          ] + global_symbol_strategy_rules,
          )
        • run_options.add_project(
          'my/cvsrepo/project_b',
          trunk_path='project_a/trunk/dir_b',
          branches_path='project_a/branches/dir_b',
          tags_path='project_a/tags/dir_b',
          symbol_transforms=[
          #...whatever...
          ],
          symbol_strategy_rules=[
          #...whatever...
          ] + global_symbol_strategy_rules,
          )
      • cvs2svn --options=your_file.options
    • Importar el fitxer dump.

Git

  • Problemes / Problems
    • fatal: unable to access 'https://github.com/...': Peer reports incompatible or unsupported protocol version.
      • Check if the problem is the same with curl:
        • bad response:
          • $ curl -v -I -X GET https://github.com/meetecho/janus-gateway/
            * About to connect() to github.com port 443 (#0)
            *   Trying 192.30.253.112...
            * Connected to github.com (192.30.253.112) port 443 (#0)
            * Initializing NSS with certpath: sql:/etc/pki/nssdb
            *   CAfile: /etc/pki/tls/certs/ca-bundle.crt
              CApath: none
            * NSS error -12190 (SSL_ERROR_PROTOCOL_VERSION_ALERT)
            * Peer reports incompatible or unsupported protocol version.
            * Closing connection 0
            curl: (35) Peer reports incompatible or unsupported protocol version.
        • good response:
          • $ curl -v -I -X GET https://github.com/meetecho/janus-gateway/
            * About to connect() to github.com port 443 (#0)
            *   Trying 192.30.253.112...
            * Connected to github.com (192.30.253.112) port 443 (#0)
            * Initializing NSS with certpath: sql:/etc/pki/nssdb
            *   CAfile: /etc/pki/tls/certs/ca-bundle.crt
              CApath: none
            * SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
            * Server certificate:
            *       subject: CN=github.com,O="GitHub, Inc.",L=San Francisco,ST=California,C=US,postalCode=94107,STREET="88 Colin P Kelly, Jr Street",serialNumber=5157550,incorporationState=Delaware,incorporationCountry=US,businessCategory=Private Organization
            *       start date: Mar 10 00:00:00 2016 GMT
            *       expire date: May 17 12:00:00 2018 GMT
            *       common name: github.com
            *       issuer: CN=DigiCert SHA2 Extended Validation Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US
            > GET /meetecho/janus-gateway/ HTTP/1.1
            > User-Agent: curl/7.29.0
            > Host: github.com
            > Accept: */*
            >
            < HTTP/1.1 200 OK
            ...
      • Solució / Solution
        • update nss (3.19 -> 3.28):
          • CentOS
            • sudo yum install nss
  • Pujar un projecte a un servidor central / Import a project into a central server
    • on server (user connected via ssh), create the repository:
      • $ cd /opt/git
        $ mkdir project.git
        $ cd project.git
        $ git --bare init [--shared=group]
      • shared for group members:
        • git config core.sharedRepository true
        • chgrp unix_project_group -R /opt/git/project.git/
        • find /opt/git/project.git/ -type d -exec chmod 2770 {} +
        • find /opt/git/project.git/ -type f -exec chmod660 {} +
    • on client computer with the original code:
      • $ cd myproject
        $ git init
        $ echo -e "*.pyc\n*~\n.project\n.pydevproject" > .gitignore
        $ git add .
        $ git commit -m 'initial commit'
        $ git remote add origin git@gitserver:/opt/git/project.git
        $ git push origin master
    • on other client computer:
      • $ git clone git@gitserver:/opt/git/project.git
        $ cd project
        $ vim README
        $ git commit -am 'fix for the README file'
        $ git push origin master
  • GUI
    • until HEAD (yellow circle)
      • gitk
    • all (HEAD is yellow circle)
      • gitk --all
    • history of all modifications for a specific file (See changes to a specific file using git):
      • gitk [--all] <filename>
    • simplificat / simplified
      • gitk --simplify-by-decoration --all
  • info
    • git status
      • do not show untracked files:
        • git status -uno
    • git remote -v
      • project_name=$(git remote -v | head -n1 | awk '{print $2}' | sed -e 's,.*:\(.*/\)\?,,' -e 's/\.git$//')
    • git remote show [remote-name]
    • git show
      • git describe --tags --long --abbrev=7 | xargs git show -s --format=format:"%C(yellow)%h|%C(red)%ai|%C(blue)%an|%C(green)%d %C(reset)%s"
      • git describe --tags --long --abbrev=7 | xargs git show -s --format=format:"%h | %ai | %an | %d %s"
      • git_date=$(git describe --tags --long --abbrev=7 | xargs git show -s --format=format:"%aI")
    • git show-ref
    • git describe
      • git describe --tags --long --abbrev=7
    • git branch -a
      • git_branch=$(git branch | grep \* | awk '{print $2}' | tr -d '(')
    • git log
      • options
        • --oneline: one line per commit
        • --decorate: add HEAD, branch, tag information
        • --graph: print as a graph
        • --all: print all commits (not only until HEAD)
      • examples
        • logs until HEAD:
          • git log --oneline --decorate --graph
          • git log --pretty=oneline
        • all logs:
          • git log --oneline --decorate --graph --all
        • with dates and authors:
          • git log --pretty=format:'%C(yellow)%h|%C(red)%ad|%C(blue)%an|%C(green)%d %C(reset)%s' --date=short --graph --all
    • git reflog
    • Inclusió de la informació del git en el codi font / Include git info in source files:
    • list files
    • git blame <filename>
      • show who modified lines in filename
    • git bisect
      • Use binary search to find the commit that introduced a bug
  • Change log
  • build a local repository (fetch) and a working copy (...) from a remote repository:
    • git clone [--depth=...] nom_usuari@origin_server:/full/path/to/repository.git
    • branca específica (branch_name) en un directori diferent (repository-branch_name):
      • git clone -b branch_name nom_usuari@origin_server:/full/path/to/repository.git repository-branch_name
    • Problemes / Problems
      • fatal: '/home/git/toto.git' does not appear to be a git repository
        fatal: The remote end hung up unexpectedly
        • Solució / Solution
          • make sure that user/group has the right permissions for all the subdirectories. For instance, if all the users from a given group must have write access to the origin repository:
            • chmod g+wX -R /home/git/toto.git
    • only a specific directory (dir_in_project) inside a project:
      • git init ~/my_dir
      • cd ~/my_dir
      • git remote add -m branch_name origin https://github.com/user/project.git
      • git config core.sparsecheckout true
      • echo dir_in_project >> .git/info/sparse-checkout
      • git pull origin branch_name
      • git checkout branch_name
  • commit to local repository
    • option 1:
      1. add selected modified files to stage:
        • git add fitxer1 fitxer2
      2. commit files that are on stage:
        • git commit -m "comentari"
    • option 2:
      1. add all modified files to satge ans commit them in a single step:
        • git commit -a -m "comentari"
    • modify comment:
  • diferències / differences
    • entre les modificacions locals i el repositori (per exemple, abans de fer l'add) / between local modifications and repo (e.g. before making add)
      • git diff toto_file | kompare -
      • git difftool -d -t kompare
      • git difftool -d -t meld
    • entre dues branques / between two branches:
    • entre dues versions del mateix fitxer:
    • entre dues version de dos fitxers diferents:
      • git diff <revision_1>:<file_1> <revision_2>:<file_2>
      • git difftool revision_1:file_1 revision_2:file_2
  • sync with remote origin
    • show the remote origin:
      • git remote -v
    • remove the remote origin
      • git remote remove origin
    • add a new remote origin
      • git remote add origin remote_user@remote_server.org:/home/user/toto.git
    • check origin changes
    • get the origin changes into the local repository (e.g. to get new branches):
    • pull (= git fetch + git merge FETCH_HEAD) the origin changes to local repository:
      • git pull origin master
    • push the local repository to origin:
      • git push
    • Problemes / Problems
  • change the remote origin (e.g. to GitLab):
    • git remote -v
    • git remote remove origin
    • git remote add origin git@gitlab.com:<your_group>/<your_project>.git
    • git branch --set-upstream-to=origin/master master
    • git pull
  • get a given branch or commit
    • git checkout master
    • git checkout remotes/git-svn
    • git checkout c8a1
  • ignore
    • gitignore
    • gitignore.io (create .gitignore file for a lot of languages/frameworks)
    • user
      • $HOME/.config/git/ignore
    • repository
      • .gitignore
    • exemples / examples:
      • *.pyc
  • revert / reset
    • Undo commit
      • not pushed yet:
      • already pushed:
        • git revert ...
        • only last commit:
          • git revert HEAD
          • git push
        • last two commits:
          • git revert HEAD~1
          • git push
        • ...
    • Undoing Merges
      • local:
        • git reset --hard <hash_of_commit_previous_to_merge>
      • local and remote:
        • git revert -m 1 <hash_of_merge_commit>
    • Rolling back changes with revert
  • branch
    • Git - Branches in a nutshell
    • clone a given branch
      • git clone -b branch_name nom_usuari@origin_server:/full/path/to/repository.git repository-branch_name
    • list all local branches
      • git branch
    • list all available (local and remote) branches
      • git branch -a
      • sort by date
        • git branch -v --sort=committerdate
        • git branch -a -v --sort=committerdate --no-merged
        • git for-each-ref --sort=-committerdate refs/heads/
    • get current branch
      • git rev-parse --abbrev-ref HEAD
      • git symbolic-ref --short HEAD
    • branch management
      • git branch
      • git branch -v
      • git branch --merged
      • git branch --no-merged
      • git branch -v --sort=committerdate --no-merged
    • create a new branch
      • git branch <branch_name>
    • switch to the new branch
      • git checkout <branch_name>
    • create a new branch and switch to it
      • git checkout -b <branch_name>
    • rename a local branch (*)
      • git branch -m <old_branch_name> <new_branch_name>
    • rename a remote branch (*)
      • git branch -m <old_branch_name> <new_branch_name>
      • git push origin :<old_branch_name>
      • git push --set-upstream origin <new_branch_name>
      • other users:
        • git fetch origin --prune
    • push a local branch
      • git push origin <branch_name>
    • get new branches from origin
      • git fetch
    • merge master into your branch
      • git checkout <branch_name>
      • git merge --no-ff master
      • Abort merge
        • git reset --merge
    • merge your branch into master
      • git checkout master
      • git merge --no-ff <branch_name>
    • discard local merge, not pushed yet
    • revert / undo a merge
    • conflicts
      • solve conflicts
        • manually, or
        • git mergetool
      • git add <file_with_resolved_conflicts>
      • git status
      • git commit -m ...
    • delete branch
  • tag
    • Git - Tagging
    • Semantic versioning 2.0.0
    • crea una etiqueta / create a tag:
      • git tag -a nom_tag [-m "my comments"]
      • lightweight
        • git tag lw_nom_tag
      • git push origin nom_tag
    • etiqueta un commit anterior / tag a previous commit:
      • git log --pretty=oneline
        • 9fceb02...
      • git tag -a v1.2 9fceb02
    • llista d'etiquetes / list of tags:
      • git tag
    • detalls sobre una etiqueta / details about a tag
      • git show nom_tag
    • puja a origin
      • una etiqueta
        • git push origin nom_tag
      • totes les etiquetes
        • git push origin --tags
    • afegeix un comentari a una etiqueta existent / add a comment to an existing tag:
      • git tag -f existing_tag existing_tag -m "my comments"
    • esborra una etiqueta / delete a tag:
      • local
        • git tag -d old_tag
      • origin
        • git push --delete origin old_tag
    • reanomena una etiqueta / rename old_tag -> new_tag:
      • git tag new_tag old_tag
      • git tag -d old_tag
      • git push origin new_tag
    • get
  • patch
    • 5.3 Distributed Git - Maintaining a Project
    • Creació / Creation
      • diferències entre el git local (amb els commits fets) i l'origin:
    • Aplicació / Application
      • git apply 0001-toto-description.patch
      • git am ...
    • Desfer l'aplicació / Undo application
      • git apply -R 0001-toto-description.patch
  • archive
  • git - svn
    • 9.1 Git and Other Systems - Git as a Client
    • Git and Subversion
    • git-svn(1)
    • Howto Use Git and Svn Together
    • git-svn tutorial
    • Git Diff between HEAD and SVN Master
    • Bitbucket
    • Exemples / Examples
      • rèplica de tot el repositori (s'hi pot estar una bona estona):
        • git svn clone svn://svn.code.sf.net/p/gpac/code/ [-T trunk -b branches -t tags] [local_name]
        • you can replace "-T trunk -b branches -t tags" by the equivalent, shorter one "-s"
        • només una part de la història:
          • git svn clone -s -r 4000:HEAD svn://svn.code.sf.net/p/gpac/code/
      • baixa només la darrera versió de trunk:
        • primera vegada / first time
          • cd /path/to/; mkdir gpac; cd gpac
          • git svn init svn://svn.code.sf.net/p/gpac/code/trunk/gpac
          • git svn fetch -rHEAD (or specific revision, obtained with "svn log svn://svn.code.sf.net/p/gpac/code/trunk/gpac")
          • git svn clone -rHEAD svn://svn.code.sf.net/p/gpac/code/trunk/gpac
          • or a range of revisions (from r4000 to HEAD)
            • git svn clone -r 4000:HEAD svn://svn.code.sf.net/p/gpac/code/trunk/gpac
      • actualitza el git a partir de l'svn / update git from svn:
        • git svn rebase
      • des d'un altre ordinador, sincronitza cap a aquest nou git creat / attach another client computer to this newly created git
        • git clone user@server:/path/to/gpac.git
        • o bé, des del matiex ordinador, en un altre directori / or, from the same computer, on another directory:
          • git clone /path/to/gpac/
      • a l'ordinador que sincronitza l'svn, mira les diferències que hi ha entre el git local (master) (amb els commits fets) i la versió que s'ha baixat de l'svn remot (remotes/git-svn):
        • comprova les branques existents
          • git branch -a
        • git diff remotes/git-svn..
        • crea un patch amb aquestes diferències:
          • git format-patch remotes/git-svn
    • Migració / Migration svn -> git
      • 8.2 Git and Other Systems - Migrating to Git
      • Passos / Steps
        1. Optional: get the authors from svn history, and edit the resulting users.txt file:
          • svn log --xml | grep -P "^<author" | sort -u | perl -pe 's/<author>(.*?)<\/author>/$1 = /' > users.txt
        2. Clone the remote svn to a local git (as before):
          • git svn clone svn://server/remote_project_name [--authors-file=users.txt] --no-metadata local_project_name
        3. post-import cleanup (for branches and tags)
          • ...
        4. Add a remote server:
          • git remote add origin your_login_name@remote_git_server:/path/to/project_name.git
        5. On the remote server, create the repository
        6. from your local computer push to it:
          • git push origin --all

Calendaris / Calendars

apropos

  • makewhatis

Matlab

  • gcf = figure( 'Position', [0 0 mida_x mida_y] );
    ...
    axis( [0 255 0 Inf] );
    set( gcf, 'PaperPositionMode', 'auto' );
    print( '-r72', '-dtiff', 'toto.tif' );

C / C++

  • Temps / Time
    • include <time.h>
    • time_t tHoraActualUTC;
    • time( &tHoraActualUTC ); // get present time
-> time_t tm str
time_t
(sec from 1 jan 1970)
- gmtime
localtime ctime
tm
(struct)
timegm (gnu c)
_mkgmtime (ms visual)
- asctime
mktime (ansi)
timelocal (gnu c)

str
getdate
strptime
strftime
-

NO fa la conversió a hora local
fa la conversió a hora local

Cygwin

Postfix (servidor de correu / email server)

  • Instal·lació / Installation
    • CentOS
      • sudo yum install postfix
  • Configuració / Configuration
    • MSA
      Mail Submission Agent
      MTA
      Mail Transfer Agent
      MDA
      Mail Delivery Agent
      Postfix smtpd (server) Postfix smtpd (SMTP server: receiving)
      Postfix smtp (SMTP+LMTP client: sending) dovecot, cyrus
      /etc/postfix/master.cf
      /etc/postfix/main.cf
      (sudo postconf -e ...)
      /etc/postfix/main.cf
      (sudo postconf -e ...)

      Enable port 587:
      • submission inet n       -       n       -       -       smtpd
          -o syslog_name=postfix/submission
          -o smtpd_tls_security_level=encrypt
          -o smtpd_sasl_auth_enable=yes
          -o smtpd_reject_unlisted_recipient=no
          -o smtpd_client_restrictions=$mua_client_restrictions
          -o smtpd_helo_restrictions=$mua_helo_restrictions
          -o smtpd_sender_restrictions=$mua_sender_restrictions
          -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
          -o milter_macro_daemon_name=ORIGINATING
      • # network interfaces that listen
        inet_interfaces
        = localhost, 192.168.1.100
      • # trusted networks that can send messages
        mynetworks = 192.168.1.0/24, 127.0.0.0/8
      • # domain name for this email server
        mydomain = example.org
      • # host name of the system
        myhostname = mail.example.org
      • # domain for locally-posted email
        myorigin = $mydomain
      • # this server is destination for emails with this domain
        mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
      • # destination domains this server can relay to
        relay_domains =
      • home_mailbox = Maildir/


      SASL: cyrus
      • ...
      SASL: dovecot
      • smtpd_sasl_auth_enable = yes
      • broken_sasl_auth_clients = yes
      • smtpd_sasl_type = dovecot
      • smtpd_sasl_path = private/auth
      • smtpd_sasl_security_options = noanonymous
      • smtpd_sasl_local_domain =
      • smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
      SASL (when relaying: connection to a remote STMP for submission):
      • smtp_sasl_auth_enable = yes
      • smtp_tls_security_level = encrypt
      • smtp_sasl_tls_security_options = noanonymous
      • relayhost = [mail.isp.example]
        # Alternative form:
        # relayhost = [mail.isp.example]:submission
      • smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd




      certificates (server):
      • self signed test certificates (including key) can be created with OpenSSL: "cd /etc/postfix/; make -f /etc/pki/tls/certs/Makefile mail.example.org.pem"
        • smtpd_tls_cert_file = /etc/postfix/mail.example.org.pem
        • smtpd_tls_key_file = $smtpd_tls_cert_file
      • Let's Encrypt certificates:
        • smtpd_tls_cert_file = /etc/letsencrypt/live/mail.example.org/fullchain.pem
        • smtpd_tls_key_file = /etc/letsencrypt/live/mail.example.org/privkey.pem
      STARTTLS:
      • smtpd_tls_security_level = may
      TLS (server):
      • smtpd_use_tls = yes
      • smtpd_tls_loglevel = 1
      • smtpd_tls_received_header = yes
      • #smtpd_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
      • smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination

      TLS (client) (connection to destination MTA; e.g. if not secure, Gmail will mark message as non secure):
      • smtp_use_tls (obsolete since Postfix 2.3)
      • smtp_tls_security_level = may
      • smtp_tls_note_starttls_offer = yes
      • smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt # see also: ca-root-nss.crt



      Virtual maps
      • virtual_alias_domains = $mydomain
      • virtual_alias_maps = hash:/etc/postfix/virtual



      /etc/postfix/virtual
      • postmaster@example.org root
        root@example.org root
        info@exampe.org info
      • sudo postmap /etc/postfix/virtual


    • Postfix Standard Configuration Examples
    • Test configuration
      • postconf
    • Django + Postfix
    • Postfix rate limiting – Politeness goes a long way
    • CentOS 5
    • Port
      • Enable port 587 (submission), that will enable STARTTLS on 250 responses to EHLO request
        • /etc/postfix/master.cf
          • submission inet n       -       n       -       -       smtpd
              -o syslog_name=postfix/submission
              -o smtpd_tls_security_level=encrypt
              -o smtpd_sasl_auth_enable=yes
              -o smtpd_reject_unlisted_recipient=no
              -o smtpd_client_restrictions=$mua_client_restrictions
              -o smtpd_helo_restrictions=$mua_helo_restrictions
              -o smtpd_sender_restrictions=$mua_sender_restrictions
              -o smtpd_recipient_restrictions=permit_sasl_authenticated,reject
              -o milter_macro_daemon_name=ORIGINATING

    • Seguretat / Security
      • Info
      • Let's Encrypt
      • STARTTLS
        • Problemes / Problems
          • warning: TLS library problem: 5294:error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol:s23_srvr.c:647:
            • Solució / Solution
              • telnet/nc does not allow sending non-encrypted text once STARTTLS has been invoked
              • use openssl s_client instead
      • Autenticació / Authentication
        • SASL - Simple Authentication and Security Layer
          • Postfix SASL Howto
          • supported SASL implementations:
            • postconf -a
          • Cyrus SASL
            • Instal·lació / Installation
              • CentOS
                • sudo yum install cyrus-sasl
                • systemctl enable saslauthd.service
                • systemctl start saslauthd.service
          • Dovecot SASL
            • Instal·lació / Installation
            • Configuració / Configuration
              • Basic configuration
                • Authentication (users and passwords)
                  • Example from real user, with password stored as plain text (do not use it in real deployments):
                    • $ echo "$USER:{PLAIN}password:$UID:$(id -g)::$HOME" > users
                    • sudo mv users /etc/dovecot/
                  • Add non-system users with encrypted passwords
                    • Password Schemes (How To Safely Store A Password)
                    • check availability of encryption schemes:
                      • doveadm pw -l
                    • encrypt with SHA256-CRYPT:
                      • $ doveadm pw -s SHA256-CRYPT -p my_password
                        {SHA512-CRYPT}$6$...
                    • echo "$USER:{SHA512-CRYPT}$6$...:$UID:$(id -g)::$HOME" > /etc/dovecot/users
                  • sudo chown root.root /etc/dovecot/users; sudo chmod 600 /etc/dovecot/users
                  • /etc/dovecot/conf.d/10-auth.conf
                    • # Remove '#' to use passwd-file:
                      !include auth-passwdfile.conf.ext
                  • check:
                    • doveconf -n passdb userdb
              • /etc/dovecot/conf.d/10-master.conf (or under directory included by file specified when running: doveconf -n | head -n1)
                • service auth {
                  ...
                  # Postfix smtp-auth
                  unix_listener /var/spool/postfix/private/auth {
                  mode = 0660
                  # Assuming the default Postfix user and group
                  user = postfix
                  group = postfix
                  }
                  ...
                  }

                  # Outlook Express and Windows Mail works only with LOGIN mechanism, not the standard PLAIN:
                  auth_mechanisms = plain login
            • Prova / Test
              • Testing SASL authentication in the Postfix SMTP Server (postfix.org)
              • encode username and password in base64 (if password starts with a digit, and bash version >=2.3, check that you are using four zeros):
                • $ echo -ne '\0000username\0000password' | base64
                  <username_and_password_in_base64>
                • check decoding:
                  • $ echo -ne <username_and_password_in_base64> | base64 -d
                    usernamepassword
              • $ openssl s_client -connect mail.example.org:587 -starttls smtp
                ...
                250 DSN
                AUTH PLAIN <username_and_password_in_base64>
              • Problemes / Problems
                • dovecot: auth-worker(5017): Error: passwd-file: open(/etc/dovecot/users) failed: Permission denied
    • non-relayed (local Postfix acts as a server: smtpd_...)
      • (feu servir el fitxer /etc/postfix/main.cf predeterminat / use the default /etc/postfix/main.cf file)
      • el camp "from" es crearà a partir de:
        • `whoami`@`hostname`
      • seguretat / security
      • usuaris / users
      • accessible des de fora / accessible from outside
        • inet_interfaces = ...
    • relayed (local Postfix acts as a client: smtp_...)
    • Debug
      • telnet localhost 25
        • 220 hostname.local ESMTP Postfix
      • mailq
      • /var/log/maillog
  • Client

Dovecot (servidor IMAP)

MySQL / MariaDB

  • Instal·lació / Iinstallation
    • Mageia
      • urpmi mysql mysql-MariaDB
      • # urpmi mariadb
    • Ubuntu
    • CentOS
      • yum install mariadb-server
    • # TMPDIR=/var/tmp mysql_install_db
    • # chmod 755 -R /var/lib/mysql
    • check that:
      • installation is ok (no errors about mysql user or group)
    • start the service
      • Mageia
        • systemctl enable mysqld.service
        • systemctl start mysqld.service
        • old way
          • service mysqld start
      • Ubuntu
        • sudo service mysql start
      • CentOS
        • systemctl enable mariadb.service
        • systemctl start mariadb.service
    • (cal?) # mysql_upgrade
    • check that it is working:
      • mysql [-h localhost -u root]
      • Note: "mysql -h 127.0.0.1 -u root" will not work
    • Establiu la contrasenya de root / Set the root password
    • Problemes / Problems
      • només s'hi pot connectar des de superusuari. Des d'usuari, apareix l'error "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)"
        • Solució / Solution:
          • # chmod 755 -R /var/lib/mysql
  • Set the root password (How to reset the root password) by using one of the following methods:
    1. mysql_secure_installation
    2. Command line (recommended by MariaDB after running mysql_install_db):
      • # /usr/bin/mysqladmin -u root password ['new-password']
      • # /usr/bin/mysqladmin -u root -p -h localhost password ['new-password']
      • # service mysqld restart
      • Check that it is working when logged as a regular user:
        • $ mysql -u root -p
    3. Use mysql-workbench
    4. Use mysql-administrator
    5. $ mysql -u root
      • mysql> UPDATE mysql.user SET password = password('new_password') WHERE user = 'root';
        mysql> FLUSH PRIVILEGES;
  • Afegir usuaris / Add users
    • Adding users
    • mysql -u root -p -h localhost mysql
      • CREATE USER 'monty'@'localhost' IDENTIFIED BY 'some_pass';
    • Creació d'una base de dades i un usuari:
      • mysql -u root -p -h localhost
        • CREATE DATABASE IF NOT EXISTS toto_db;
          GRANT ALL ON toto_db.* TO 'usuari'@'localhost' IDENTIFIED BY 'contrasenya';
          FLUSH PRIVILEGES;
          exit;
        • CREATE DATABASE IF NOT EXISTS toto_db;
          GRANT ALL ON toto_db.* TO 'usuari'@'%' IDENTIFIED BY 'contrasenya';
          FLUSH PRIVILEGES;
          exit;
  • Bolcat des d'un fitxer / Dump from file
  • Execució de comandes SQL en línia (o des d'un script) / Execution of on-lin SQL commands (or inside a script):
    • How to feed mysql queries from bash
    • Opció 1: using EOF:
      • mysql -u root -p mysql <<EOF
        CREATE USER 'usuari'@'localhost' IDENTIFIED BY 'contrasenya';
        EOF
      • mysql -u root -p > toto.txt <<EOF
        use toto_db;
        select * from toto_table;
        EOF
    • Opció 2: auxiliary file
      • mysql --host=localhost --user=user --password=password [database_name] < commands.sql
    • Opcions / Options
      • -s / --silent
      • -N / --skip-column-names
  • Time Zone Tables
  • Admin (GUI)
    • mysql-workbench
      • urpmi mysql-workbench
      • Set the root password:
        • New connection:
          • Connection Name: your_label
          • Connection Method: Local Socket/Pipe
          • Socket/Pipe Path: (leave empty)
          • Username: root
          • Password / Store in Keychain...: your_password
          • Default Schema: (leave empty)
      • Problemes / Problems
        • "pure virtual method called"
          • Solution:
            • ...
    • phpMyAdmin
    • mysql-administrator
      • urpmi mysql-administrator
      • Set the root password:
        • mysql-administrator
        • Stored connection / Save this connection...: your_label
        • Server hostname: localhost
        • Username: root
        • Password: (empty)
        • Connect
        • User Administration / root : New password / Apply changes
  • Accés remot / Remote access
    • server (IP address: server_ip_address):
      • /etc/my.cnf
        • comment "skip-networking"
        • ? bind-address
      • grant privileges for a user (user_with_remote_privileges) from a remote location:
        • from command line (user_with_remote_privileges is mythtv):
          • mysql -u root -p
          • mysql> grant all on mythconverg.* to mythtv@"%" identified by "mythtv";
          • mysql> flush privileges;
        • (?) from mysql-workbench:
          • Server administration:
            • Security / Users and privileges
              • Server Access Management
                • Select user: user_with_remote_privileges
                • Login name: user_with_remote_privileges
                • Limit connectivity to hosts matching: % (for any host)
              • Schema Privileges
                • Select user: user_with_remote_privileges
                • Add entry...
      • service mysqld restart
    • client (IP address: client_ip_address):
      • mysql -h server_ip_address -u user_with_remote_privileges -p
  • Logs
  • Problemes / Problems
  • Esborrar totes les bases de dades i eliminar la contrasenya de root:
    • rm -rf /var/lib/mysql
    • service mysqld restart
  • Esborrar mysql / Removing mysql
    • urpme mysql mariadb
    • this will not remove all the data (root password...). To completely remove mysql:
      • # rm -rf /var/lib/mysql
  • Causes of Access denied Errors
  • Configuration for:
  • Client (GUI)
    • sqlgui
      • urpmi sqlgui libsqlguimysql
      • ln -s /usr/lib/libsqlguimysql-0.1.1.so /usr/lib/libsqlguimysql.so
  • Backup
    • mysqldump database_name -u root -p > database_name.sql
    • mysqldump --all-databases -u root -p > all_databases.sql
    • cron backup
      • /var/spool/cron
        • 0 23 * * * /root/backup_base_dades.sh
      • /root/backup_base_dades.sh
        • #!/bin/bash
          DB_BACKUP_DIR="/var/export/backup"
          DB_USER="root"
          DB_PASSWD="******"
          DATE="`date '+%Y%m%d_%H%M'`"
          mysqldump -u$DB_USER -p$DB_PASSWD timetracker > $DB_BACKUP_DIR/backup_timetracker_$DATE.sql
          mysqldump -u$DB_USER -p$DB_PASSWD wikidb > $DB_BACKUP_DIR/backup_wikidb_$DATE.sql
          echo "$DATE: Backup done" > /tmp/backup_base_dades.txt
          mail -s "[backup] Backup base de dades" $EMAIL < /tmp/backup_base_dades.txt
    • backup from mysql-administrator (mabackup)
    • backup from mysql-workbench
  • Restore

Bugzilla

  • MySQL
  • Instal·lació / Installation
    • Mageia
      • urpmi apache-mpm-prefork postfix perl-DBD-mysql
      • [urpmi bugzilla-contrib eclipse-bugzilla]
      • [urpmi apache-mod_perl perl-GDGraph perl-Template-GD perl-Chart perl-PatchReader perl-Image-Magick perl-HTML-Scrubber perl-Apache-DBI perl-DBD-Pg perl-MIME-tools perl-Email-MIME-Attachment-Stripper perl-Email-Reply interdiff]
      • [urpmi 'perl(Authen::Radius)' 'perl(SOAP::Lite)' 'perl(JSON::RPC)' 'perl(JSON::XS)' 'perl(Test::Taint)' 'perl(TheSchwartz)' 'perl(Daemon::Generic)' 'perl(Math::Random::Secure)']
      • urpmi bugzilla
    • Ubuntu
      • sudo apt-get install liblist-moreutils-perl libdatetime-perl libtemplate-perl libemail-send-perl libemail-mime-perl liburi-perl libmath-random-isaac-perl
      • optional:
        • apt-get install lib...-perl
      • wget http://ftp.mozilla.org/pub/mozilla.org/webtools/bugzilla-4.4.4.tar.gz
      • sudo tar --directory /usr/local -xvzf bugzilla-4.4.4.tar.gz
  • Configuració / Configuration
    • Option 1: new bugzilla
      • run config:
        • Mageia
          • /usr/share/bugzilla/bin/checksetup.pl
        • Ubuntu
          • sudo /usr/local/bugzilla-4.4.4/checksetup.pl
      • configure mysql for bugzilla
        • add user 'bugs' with password xxxxx (specified with $db_pass in localconfig):
          • mysql -u root -p
          • mysql> GRANT SELECT, INSERT,
            UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,
            CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.*
            TO bugs@localhost IDENTIFIED BY 'xxxxx';
            mysql> FLUSH PRIVILEGES;
        • edit config file:
          • Mageia
            • /etc/bugzilla/localconfig
              • set $db_pass xxxxx
          • Ubuntu
            • /usr/local/bugzilla-4.4.4/localconfig
              • set $db_pass xxxxx
                $webservergroup = 'www-data';
        • run config again:
          • Mageia
            • /usr/share/bugzilla/bin/checksetup.pl
          • Ubuntu
            • sudo /usr/local/bugzilla-4.4.4/checksetup.pl
    • Option 2: from existing bugzilla
      • On previous machine: backup
        • mysqldump bugs -u root -p > bugs_$(date '+%Y%m%d_%H%M').sql
      • On new machine: restore
    • Apache configuration
      • Bugzilla using Apache
      • Mageia (Apache 2.4)
        • (config file /etc/httpd/conf/sites.d/bugzilla.conf already supplied by rpm package):
          • # Bugzilla Apache configuration
            Alias /bugzilla/data /var/lib/bugzilla/
            Alias /bugzilla /usr/share/bugzilla/www

            <Directory /usr/share/bugzilla/www>
                Require all granted

                Options ExecCGI
                DirectoryIndex index.cgi
                AddHandler cgi-script .cgi .pl
            </Directory>

            # The dot files must be accessible to the public webdot server
            # The png files locally created locally must be accessible
            <Directory /var/lib/bugzilla/webdot>
                <FilesMatch \.dot$>
                    Require host research.att.com
                </FilesMatch>

                <FilesMatch \.png$>
                    Require all granted
                </FilesMatch>
            </Directory>

      • Ubuntu (Apache 2.4)
        • /etc/apache2/sites-available/bugzilla.conf
          • Alias /bugzilla /usr/local/bugzilla-4.4.4

            <Directory
            /usr/local/bugzilla-4.4.4>
               
            Require all granted

                Options ExecCGI
                DirectoryIndex index.cgi
                AddHandler cgi-script .cgi .pl

            </Directory>
        • sudo a2ensite bugzilla
        • sudo a2enmod cgi
        • sudo service apache2 reload
      • Problemes / Problems
        • Service Unavailable. The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
          • Solution
            • sudo service apache2 restart
    • Mail server configuration
    • LDAP configuration
  • Usage:

Scmbug

  • CVS
  • Bugzilla
  • Scmbug
    • instal·lació dels paquets necessaris (exemple per a MandrivaLinux):
      • urpmi docbook-style-dsssl-doc perl-XML-Simple perl-Mail-Sendmail
    • correspondència entre usuaris de cvs i usuaris de bugzilla:
      • /etc/scmbug/daemon.conf
      • userlist => {enabled => 1, values => {'usuari' => 'usuari@domini.org'}}
    • inici del servei:
      • temporalment: service scmbug-server restart
      • permanentment: chkconfig scmbug-server on
    • enganxa l'scmbug entre cvs i bugzilla:
      • scm_install_glue --scm=CVS --product=nom_modul --repository=/usr/local/cvsroot --bug=1 --daemon=127.0.0.1 --binary-paths=/usr/bin
    • edita algunes preferències:
      • chmod 644 /usr/local/cvsroot/CVSROOT/etc/scmbug/glue.conf
      • /usr/local/cvsroot/CVSROOT/etc/scmbug/glue.conf 
      • presence_of_bugs_ids => {value => 'optional' }
      • valid_bug_owner => {enabled => 0}
      • log_regex => '[Bb][Uu][Gg].*?:(.*)'

Eclipse

Inno Setup

  • Execució MSI:
    • [Run]
      Filename "msiexec.exe"; Parameters: "/qb+ /i ""{pf}\toto.msi"""; Flags: runascurrentserver shellexec waituntilterminated;

NTP (Network Time Protocol)

  • UNIX / Linux
    • Data / Date
    • Quick HOWTO : Ch24 : The NTP Server
    • client (no funcionarà si el servei ntpd està funcionant, perquè ocupa el port) (maybe you need to open the NTP port: 123)
      • ntpdate -u europe.pool.ntp.org (amb l'opció -u sí que funcionarà quan el servei ntpd està en marxa / use -u option to force update when ntpd service is running)
      • ntpdate -q europe.pool.ntp.org (just query)
      • KDE adjust time: automatically
    • client / server (nom_servidor)
      • /etc/ntp.conf (/etc/chrony.conf)
        • server nom_servidor iburst (ex: aries.salle.url.edu)
      • service ntpd start / systemctl start ntpd.service
      • systemctl enable ntpd.service
      • comproveu que el port és accessible des dels clients / check that port is accessible from clients
        • [solved] ntp reachable but rejected
          • Open port 123 (udp, tcp):
            • iptables -I INPUT -p tcp -m multiport --dports 123 -m comment --comment "ntp incoming (tcp)" -j ACCEPT
              iptables -I INPUT -p udp -m multiport --dports 123 -m comment --comment "ntp incoming (udp)" -j ACCEPT

      • ntpq -c peers
      • ntpq -c assoc
      • nom_servidor no serà vàlid fins que no surti un * quan se'l pregunta amb ntpq -p nom_servidor / nom_servidor will not be valid until a * appears before it when calling ntpq -p nom_servidor
  • MS Windows XP, 2003
    • client / server
      • [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Parameters]
      • "NtpServer"="aries.salle.url.edu,0x1"
      • "Type"="NTP"
      • [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient]
      • "Enabled"=dword:00000001
      • "SpecialPollInterval"=dword:00000708 (cada 1800s es connecta al servidor / connected to server every 1800s)
    • server
      • [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpServer]
      • "Enabled"=dword:00000001

UUID

  • UNIX
    • urpmi libext2fs-devel (libuuid-devel) (libossp_uuid-devel)
    • #include <uuid/uuid.h>
    • uuid_generate( uu );
    • needed lib: -luuid
  • MS Windows
    • #inlcude <rpc.h>
    • UuidCreate(&uu);
    • needed lib: Rpcrt4.lib

Microsoft IIS (Internet Information Server)

MS Visual Web Services

  • Check that your web service is running:
    • http://localhost/<your_web_service>/<your_web_service>.asmx
  • "Server Application Unavailable" (when trying to access web services with .net 2.0):
    • uninstall .net 3.0
  • "Failed to access iis metabase". Solution:
    • WINDOWS\Microsoft.NET\Framework\vX.X.XXXXX\aspnet_regiis -i
  • "The process account used to run ASP.NET must have read access to the IIS metabase"
    • aspnet_regiis -ga <WindowsUserAccount>
  • Others:
    • aspnet_regiis -ua
    • aspnet_regiis -i -enable
  • "Parser Error Message: Unrecognized configuration section 'connectionStrings'" / "Server Error in '/<your_web_service>' Application, Configuration Error"
    • Check that your web service is using the right ASP version:
    • Start / Control Panel / Administrative Tools / Computer Management / Services and Applications / Internet Information Services / Web sites / Default Web Site
    • <your_web_service>: Properties / ASP.NET tab / ASP.NET version: <the_needed_version_for_your_web_service>
  • To install NET framework from Microsoft:
  • Verify that the ASPNET user have writing permissions in the wanted directories:
    • Properties / Security / Add / Advanced options / Search now
    • if Security tab is not present:
      • Tools / Folder options / View / (don't use) Simple file sharing
  • ASP tab not present
  • Virtual units (subst) do not work for user ASPNET.
  • Needed files for deployment of a web service in a computer without MS Visual installed (to be put under C:\Inetpub\wwwroot\<your_web_service>\bin\):
    • developed with MS Visual 2005:
      • Release
        • ...\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.CRT\
          • msvcp80.dll
          • msvcr80.dll
          • Microsoft.VC80.CRT.manifest
        • ...\Microsoft Visual Studio 8\VC\redist\x86\Microsoft.VC80.MFC\
          • mfc80.dll
          • Microsoft.VC80.MFC.manifest
      • Debug
        • ...\Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86\Microsoft.VC80.DebugCRT\
          • msvcp80d.dll
          • msvcr80d.dll
          • Microsoft.VC80.DebugCRT.manifest
        • ...\Microsoft Visual Studio 8\VC\redist\Debug_NonRedist\x86\Microsoft.VC80.DebugMFC\
          • mfc80d.dll
          • Microsoft.VC80.DebugMFC.manifest
  • Security issues (accessing network drives)

Toggle keybord layout in MS Windows

  • Control Panel / Regional and Language Options / Languages / Details
  • select the language and then Add
  • add a keyboard
  • Language bar: select all options

KDE

  • Font antialiasing
    • KDE control centre: Fonts / Use anti-aliasing / Enabled / Style: Complete
  • Menú / Menu
    • kmenuedit
    • /etc/xdg/menus/
    • /etc/xdg/kde4/menus/
  • Auto start of applications/scripts:
    • Configure desktop -> Advanced ->  Autostart
    • applications
      • ~/.config/autostart/*.desktop
    • scripts
      • ~/.kde4/Autostart/*.desktop
  • Netbook / HTPC

rdesktop

  • rdesktop -g 1024x768 -k es remote_server -r disk:C=/
  • Per a accedir a la sessió remota ja iniciada ("-0"):
    • rdesktop -0 -g 1024x768 -k es remote_server -r disk:C=/

rsync

  • setup an rsync server (to be used as rsync daemon):
    • /etc/xinetd.d/rsync
  • syntax (man rsync)

    remote shell
    rsync daemon
    pull
    rsync [OPTION...] [USER@]HOST:SRC... [DEST]
    rsync [OPTION...] [USER@]HOST::SRC... [DEST]
    push
    rsync [OPTION...] SRC... [USER@]HOST:DEST
    rsync [OPTION...] SRC... [USER@]HOST::DEST
  • Problemes amb l'horari d'estiu / Problems with daylight-savings time (DST)
  • examples:
    • -a archive mode; equals -rlptgoD (no -H,-A,-X)
    • list of shared modules (rsync daemon):
      • rsync admin@192.168.0.50::
      • rsync admin@192.168.0.50::photo
    • list of remote own (/home/admin/) directories (remote shell):
      • rsync admin@192.168.0.50:
    • from smartphone (mounted at /media/6636-3133) to local directory:
      • rsync -avvr /media/6636-3133/DCIM/ ~/Imatges/HTC_Magic/
      • rsync -avvr /media/.../DCIM/ ~/Imatges/HTC_One_X/
    • from video camera (mounted at /media/disk or /run/media/cesc/disk/, vfat) to local directory:
      • rsync [--modify-window=3601] -avvr /media/disk/ ~/Vídeos/Sony/
      • rsync --modify-window=3601 -avvr /run/media/cesc/disk/ ~/Vídeos/Sony2/
    • from SD card (mounted at /run/media/cesc/9016-4EF8) to local directory:
      • rsync --modify-window=3601 -avvr /run/media/cesc/9016-4EF8/ ~/Imatges/Nikon_S31/
    • from SD card (mounted at /run/media/cesc/9016-4EF8) to Synology NAS:
      • rsync --modify-window=3601 -avvr /run/media/cesc/9016-4EF8/ admin@diskstation.home::photo/album_1/sd1/
    • from local directory to Synology NAS (diskstation.local, 192.168.0.50):
      • rsync -avvr ~/Imatges/HTC_Magic admin@diskstation.local::photo
      • rsync -avvr ~/Imatges/ admin@diskstation.local::photo
      • rsync -avvr ~/Vídeos/ admin@diskstation.local::video
      • rsync -avvr ~/Vídeos/Sony2/ admin@diskstation.local::video/Sony2/
      • rsync -avvr /home/cesc/Documents/ cesc@diskstation.local::homes/cesc/Documents/
    • from local directory to external drive:
      • rsync -avvr /home/cesc/Documents /media/disc/copia_seguretat/
    • exclusió de fitxers / exclusion of files:
      • rsync --exclude='*.o' ...
    • exclusió de directoris / exclusion of directories:
      • rsync --exclude='bin' ...
    • preserva els enllaços / preserve links:
      • rsync -l ...
    • llistat de fitxers modificats
    • ssh en un port específic / on a specific remote ssh port 8023:
      • rsync -avvr dir_local --rsh='ssh -p8023' usuari_remot@adreca_servidor:/dir_remot_pare/
      • per a fer-ho sempre
        • ~/.ssh/config
          • Host etiqueta_per_a_servidor
              HostName adreca_servidor
              Port 8023
        • rsync -avvr dir_local usuari_remot@etiqueta_per_a_servidor:/dir_remot_pare/
    • ssh amb un certificat (-e, --rsh són equivalents) (nota: el camí cap al certificat .pem ha de ser absolut)
      • rsync -avvr -e 'ssh -i /home/cesc/.ssh/keys/my_key.pem' dir_local usuari_remot@adreca_servidor:/dir_remot .
    • rsync amb sudo remot
      • Getting files from remote server that need sudo
      • Pulling Read restricted files from a remote system with rsync and sudo
      • Server
        • /etc/sudoers.d/usuari_remot
          • usuari_remot ALL=(ALL) NOPASSWD:ALL
            # no need for "-t" when accessing via ssh
            Defaults:usuari_remot !requiretty

      • Client
        • rsync -avvr -e 'ssh -i /home/cesc/.ssh/keys/my_key.pem' --rsync-path='sudo rsync' usuari_remot@adreca_servidor:/etc/dir_remot .

ImageMagick

  • Instal·lació / Installation
    • Mageia
      • urpmi ...
    • CentOS
      • sudo yum install ...
  • Features
    • -list format
    • -list interlace
  • Info (-format)
    • identify -format '%wx%h' filename
    • identify -format '%[exif:orientation]' filename
    • identify -verbose filename
  • Python
  • Resize
    • convert input_filename -scale 120x90 output_filename
  • YUV
  • Reduce the number of colours (useful, e.g. for images from a scanner):
    • convert toto.pnm -colors 4 toto.png
  • Convert alpha transparency in png
  • Convert to pdf
    • convert toto.png toto.pdf
    • they can then be joined with pdftk
  • Create a BGRA image (e.g. for Snowmix)
    • which convert && convert -depth 8 -size 1280x720 canvas:black black_1280x720.bgra
    • convert -depth 8 -size 1280x720 canvas:green green_1280x720.bgra
  • Convert to raw BGRA (e.g. for Snowmix)
    • convert toto.png toto.bgra
  • Display a BGRA image:
    • display -size 1280x720 -depth 8 BGRA:green_1280x720.bgra

HTML parsing

  • Python
    • BeautifulSoup 4
    • BeautifulSoup 3
      • urpmi python-beautifulsoup
      • import BeautifulSoup                             # To get everything
        from BeautifulSoup import BeautifulSoup          # For processing HTML
        import urllib

        url="http://xxx/toto.html"
        txt = urllib.urlopen(url).read()  #Pull in the url

        soup = BeautifulSoup(txt)

        allTags = soup.findAll('h3')
        for node in allTags:
            print node.string
  • PHP

Expresions regulars / Regular expressions

  • Perl regular expressions
  • Regular expressions in bash
  • Regular expression (wp)
  • Regular Expression Flavor Comparison
  • Python regular expressions
  • Literal character
  • Exemples / Examples
    • awk
    • Java
    • Parsing URLs
      • RFC 3986 Appendix B
      • Faster and cleaner way to parse Parameters from URL in javascript/jQuery?
        • http://usuari:contrasenya@example.com:8080/path/to/file;parameters?a=b&c=d#section
        • ^(?:([^:/?#.]+):)?(?://(?:([^/?#]*)@)?([\\w\\d\\-\\u0100-\\uffff.%]*)(?::([0-9]+))?)?([^?#]+)?(?:\\?([^#]*))?(?:#(.*))?$
        • example
          RFC 3986 regex
          regular expression
          regexp group name
          javascript: location.
          Python urllib.parse
          bash

          ^
          ^





          http:
          (([^:/?#]+):)?
          (?:([^:/?#.]+):)? protocol protocol (includes ":")

          scheme

          scheme=${url%//*}


          (?:





          //usuari
          (//([^/?#]*))?
          //(?:([^/?#]*)@)? user


          netloc
          username
          url_wo_scheme=${url#*//}
          domain=${url_wo_scheme%%/*}

          :contrasenya@



          password
          example.com
          ([\\w\\d\\-\\u0100-\\uffff.%]*)
          hostname hostname
          host
          hostname
          :8080
          (?::([0-9]+))? port

          port


          )?





          /path/to/file
          ([^?#]*)
          ([^?#]+)? pathname pathname

          path

          path=${url_wo_scheme##$domain}
          ;parameters





          params


          ?a=b&c=d
          (\?([^#]*))?
          (?:\\?([^#]*))? search search

          query


          #section
          (#(.*))?
          (?:#(.*))? hash hash

          fragment



          $ $






    • dvbsnoop
  • Character classes
    [abc]
    any one character between brackets
    [^abc]
    any one character not between brackets
    .
    any character except newline
    \w
    word character
    \W
    non word character
    \s
    whitespace character
    \S
    non whitespace character
    \d
    digit
    \D
    non digit
  • Anchors
    • ^
      beginning
      $
      end
      \b

      \B

  • Repetition (specified aftter the character)
    • 0
      1
      more
      ?

      *

      +
    • n
      more
      m
      {n}


      {n,}

      {n,m}
    • ??
      non-greedy (stops at first occurrence)
      *?
      +?
      {}?
  • Grouping
    (...)

    |

    \n

  • Extended regular expressions
    (?#...)

    (?:...) matches, but does not return "..."
    (?=...)
    (?!...)

Tasques / Tasks

  • crontab
    • Cron and crontab usage and example
    • camps / fields
      • m h  dom mon dow   command
        • m: minut / minute (0-59)
        • h: hora / hour (0-23)
        • dom: dia del mes / day of month (1-31)
        • mon: mes / month (1-12) (Jan-Dec)
        • dow: dia de la setmana / day of week (0-6) (Sun-Sat)
      • Note: implicit AND, except dom-dow, combined with implicit OR
      • exemples / examples
        • cada divendres a les 20:00 UTC / every Friday at 20:00 UTC
          • 0 20 * * Fri
          • 0 20 * * 5
        • cada dues hores, a dos quarts / every 2 hours, at half past
          • 30 */2 * * *
        • a les 12 del migdia i a les dotze de la nit / at midnight and noon
          • 0 0,12 * * *
        • a les / at 1:30, 2:30, 3:30
          • 30 1-3 * * *
    • llistat / list
      • crontab -l
    • edició / edition
      • [export EDITOR=emacs]
      • crontab -e
    • logs
      • /var/log/cron
      • check mail of the owner of the crontab
    • Problemes / Problems
      • sudo: sorry, you must have a tty to run sudo
    • afegir línia des de shell / add line from shell:
    • Linux Execute Cron Job After System Reboot
      • @reboot
    • Crontab with Fabric
  • incron(incrond, incrontab)
    • config
      • tasca
        • /path/to/be/watched/ IN_CLOSE_WRITE /path/to/tasca.sh $@ $# $%
          ...

    • script
      • tasca.sh
        • #!/bin/bash
          ...
          directori=$1
          nom_fitxer=$2
          esdeveniment=$3
          ...

    • start service
      • #echo root > /etc/incron.deny
        #service incrond start
        $incrontab tasca

Data / Date

Telnet

  • See also: nc
  • Instal·lació / Installation
    • Mageia
      • urpmi netkit-telnet
    • CentOS
      • sudo yum install telnet
  • Utilització / Usage
    • escape characters:
      • ^] = Ctrl+]
      • ^@ = Ctrl+@
    • Exemple / Example: RadioDNS
  • Automate interactive session
    • Automating telnet session using bash scripts
      • /usr/bin/expect
        • urpmi expect expect-examples
          • /usr/share/doc/expect-examples/
        • telnet.sh
          • #!/usr/bin/expect
            set timeout 20
            set hostName [lindex $argv 0]
            set port [lindex $argv 1]
            set password [lindex $argv 2]

            spawn telnet $hostName $port
            expect "Password:"
            send "$password\r";

            send "...\r";

            sleep 2
            send "logout\r";
        • telnet.sh host_name port password
      • {echo "command1"; echo "command2"; sleep 2; } | telnet localhost 4212

OpenSSH

  • Instal·lació / Installation

    • server
      client

      installation
      service
      CentOS
      yum install openssh-server systemctl [enable,start,status,stop] sshd

      Cygwin


      Mageia urpmi openssh-server

      Ubuntu sudo apt-get install openssh-server

  • Default port: 22
  • Especificació dels usuaris autoritzats / Specify allowed users (Step 5):
    • /etc/ssh/ssh_config
      • AllowUsers ...
  • Change port (from default 22 to 10022)
    • server
      • sshd
        • /etc/ssh/sshd_config
          • Port 10022
      • sshd-xinetd
        • /etc/xinetd.d/sshd-xinetd
          • port = 10022
      • obrir el port 10022 al tallafoc
    • client
      • ssh -p 10022 username@server
  • Muntatge d'un sistema de fitxers remot en un directori local / Mount remote filesystem in a local directory:
    • urpmi sshfs-fuse
    • mkdir /mnt/local_dir/
    • sshfs remote_user@remote_address:/remote_dir /mnt/local_dir/ -o uid=local_user_numerical_id -o gid=local_group_numerical_id
  • OpenSSL
  • Parell de claus / Key pairs:


    storage

    generation server
    client
    server pair
    (ssh-server) /etc/ssh/ssh_host_rsa_key
    ~/.ssh/known_hosts
    [client pair] ssh-keygen via ssh-copy-id:
    • ~username/.ssh/authorized_keys
    • ~/.ssh/id_rsa
    • any other location specified by ssh-keygen -f filename

  • Autencicació sense contrasenya / Password-less authentication (optional):
    • server:
      • install ssh server
      • /etc/ssh/sshd_config
        • PubkeyAuthentication yes
        • # only pair of keys is allowed:
          PasswordAuthentication no
    • setup from client:
      • ssh-keygen -t rsa -C remoteserver_name -f ~/.ssh/id_rsa_remoteserver
      • if you generared the pair with openssl (remote_server.pem), extract the public key and convert it to pub (PKCS8) format (id_rsa_remote_server.pub):
        1. openssl rsa -in remote_server.pem -out remote_server.public.pem -outform PEM -pubout
        2. ssh-keygen -i -f remote_server.public.pem -m PKCS8 > id_rsa_remote_server.pub
      • ssh-copy-id -i ~/.ssh/id_rsa_remoteserver.pub username@remoteserver
      • this will create a line in the remotehost file ~username/.ssh/authorized_keys,  with the  following content:
        • ssh-dsa AAAABtce9euch… user@example.com
        • but it can be completed as (SSH configuration tricks):
          • command="program" ssh-dsa AAAABtce9euch… user@example.com
    • connection from client:
      • connexió al servidor utilitzant la clau / connection to the server using the key:
        • ssh -i ~/.ssh/id_rsa_remoteserver username@remoteserver
        • or, if you generated your key pair with openssl:
          • ssh -i ~/.ssh/remoteserver.pem username@remoteserver
      • per a evitar l'opció -i , i no haver de posar username / to avoid -i option and specification of username:
        • ~/.ssh/config
          • Host etiqueta_remoteserver
                HostName
            remoteserver
                User
            username
                IdentityFile ~/.ssh/id_rsa
            _remoteserver
        • chmod 600 ~/.ssh/config (si altres usuaris tenent permisos, ssh no funcionarà / if others than user have write permissions, ssh will not work)
        • ssh etiqueta_remoteserver
      • timeout
        • ssh -o ConnectTimeout=6000 ...
      • execució remota / remote execution:
        • usuari
          • ssh username@remoteserver my_command
          • ssh username@remoteserver 'bash -s' < local_script.sh
        • root / sudo (to avoid error: sudo: sorry, you must have a tty to run sudo)
      • Problemes / Problems
        • WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
          • ssh-keygen [-f ~/.ssh/known_hosts] -R remote_ip_address_with_problems
  • Control version with SSH
    • Subversion with SSH
    • Bitbucket / GitLab (git) with SSH
      • Use the SSH protocol with Bitbucket Cloud
      • Set up SSH for Git and Mercurial on Mac OSX/Linux
      • Configure multiple SSH identities for GitBash, Mac OSX, & Linux
      • Simple setup
        • Create a key pair (or get the one generated by e.g. weblate)
          • ssh-keygen -f ~/.ssh/keys/gitlab-user_i-id_from_work
        • ~/.ssh/config
          • # GitLab.com server
            Host gitlab.com
            RSAAuthentication yes
            IdentityFile ~/.ssh/keys/gitlab-user
            _i-id_from_work
        • git clone git@gitlab.com:accountname_i/repo_a.git
      • Complete setup
        • identity
          Bitbucket account / GitLab user
          git remote
          name
          .ssh/config account account can access to repositories

          each identity has a key pair;
          an identity replaces accountname/password, and must be unique in Bitbucket/GitLab;
          an account can have several identities
          must register the identity keys non-own repositories (e.g. a team) must grant permissions to the account, but should not register key pairs

          bitbucket-account_i-id_from_home
          Host bb-aci-id1
               HostName bitbucket.org
               IdentityFile ~/.ssh/keys/bitbucket-account_i-id_from_home
          accountname_i accountname_i/repo_a.git
          accountname_j/repo_d.git
          teamname_k/repo_m.git
          git@bb-aci-id1:accountname_i/repo_a.git
          git@bb-aci-id1:accountname_j/repo_d.git
          git@bb-aci-id1:teamname_k/repo_m.git
          bitbucket-account_i-id_from_work Host bb-aci-id2
               HostName bitbucket.org
               IdentityFile ~/.ssh/keys/bitbucket-account_i-id_from_work
          git@bb-aci-id2:accountname_i/repo_a.git
          git@bb-aci-id2:accountname_j/repo_d.git
          git@bb-aci-id2:teamname_k/repo_m.git
          bitbucket-account_ii-id_from_home Host bb-0acii-id1
               HostName bitbucket.org
               IdentityFile ~/.ssh/keys/bitbucket-account_ii-id_from_home
          accountname_ii accountname_ii/repo_b.git
          accountname_jj/repo_e.git
          teamname_kk/repo_n.git
          git@bb-acii-id1:accountname_ii/repo_b.git
          git@bb-acii-id1:accountname_jj/repo_e.git
          git@bb-acii-id1:teamname_kk/repo_n.git
          bitbucket-account_ii-id_from_production_server Host bb-acii-id2
               HostName bitbucket.org
               IdentityFile ~/.ssh/keys/bitbucket-account_ii-id_from_production_server
          git@bb-acii-id2:accountname_ii/repo_b.git
          git@bb-acii-id2:accountname_jj/repo_e.git
          git@bb-acii-id2:teamname_kk/repo_m.git
        • Steps
          1. Create key pairs (maybe several for each account in Bitbucket; you don't need to create a key pair to access to a team account: just use one of your key pair):
            • Bitbucket
              • ssh-keygen -f ~/.ssh/keys/bitbucket-account_i-id_from_home -C "Bitbucket: identity to login as accountname_i, from home"
              • ssh-keygen -f ~/.ssh/keys/bitbucket-account_i-id_from_work -C "Bitbucket: identity to login as accountname_i, from work"
              • ssh-keygen -f ~/.ssh/keys/bitbucket-account_ii-id_from_home -C "Bitbucket: identity to login as accountname_ii, from home"
              • ssh-keygen -f ~/.ssh/keys/bitbucket-account_ii-id_from_production_server-C "Bitbucket: identity to login as accountname_ii, from work"
            • GitLab
              • ssh-keygen -f gitlab-account_i-id_from_home -t rsa -C "user@example.org" -b 4096
              • ...
          2. ~/.ssh/config
            • Bitbucket
              • Host bb-aci-id1
                     HostName bitbucket.org
                     IdentityFile ~/.ssh/keys/bitbucket-account_i-id_from_home

                Host bb-aci-id2
                     HostName bitbucket.org
                     IdentityFile ~/.ssh/keys/bitbucket-account_i-id_from_work
              • Host bb-acii-id1
                     HostName bitbucket.org
                     IdentityFile ~/.ssh/keys/bitbucket-account_ii-id_from_home

                Host bb-acii-id2
                     HostName bitbucket.org
                     IdentityFile ~/.ssh/keys/bitbucket-account_ii-id_from_production_server
            • GitLab
              • Host gl-aci-id1
                     HostName gitlab.com
                     IdentityFile ~/.ssh/keys/gitlab-account_i-id_from_home
              • ...
          3. Add public keys to accounts:
            • Bitbucket (web interface Settings: SECURITY / SSH Keys):
              • xclip -selection clipboard < ~/.ssh/keys/...:
                • into accountname_i:
                  • bitbucket-account_i-id_from_home.pub
                  • bitbucket-account_i-id_from_work.pub
                • into accountname_ii:
                  • bitbucket-account_ii-id_from_home.pub
                  • bitbucket-account_ii-id_from_production_server.pub
            • GitLab (Group -> Members)
              • Profile settings -> SSH Keys
              • xclip -selection clipboard < ~/.ssh/...
                • into accountname_i:
                  • bitbucket-account_i-id_from_home.pub
                  • ...
                • ...
          4. Clone repo:
            • git clone ...
          5. Change repository configuration
            • ~/src/repo_a/.git/config
              • url = git@bb-aci-id1:accountname_i/repo_a.git
            • ~/src/repo_b/.git/config
              • url = git@bb-acii-id1:accountname_ii/repo_b.git
  • Shh! OpenSSH Secrets Here
    • Password-less SSH logins
  • ssh-agent (ssh password caching)
  • Client
    • copy file from remote to local
      • scp -i ~/.ssh/keys/parell_claus.pem usuari@adreca_ip:/tmp/remote_file .
    • Tanca la sessió / End session
      • Enter + ~ + .
    • Mantenir la sessió oberta (alguns encaminadors desconnecten les sessions inactives al cap d'uns minuts) / Keep the session open (some routers disconnect inactive sessions after some minutes)
  • X11 forwarding (abans DISPLAY / fomerly DISPLAY)
    • How to forward X over SSH from Ubuntu machine?
    • servidor ssh / ssh server
      • CentOS
        • sudo yum install xorg-x11-xauth
      • /etc/ssh/sshd_config
        • X11Forwarding yes
    • client ssh
      • ssh -X nom_servidor_ssh
      • No cal establir la variable d'entorn DISPLAY / No need to specify environment variable DISPLAY
      • Resolució de problemes / Problem resolution
        • al servidor / in server
          • ssh -v -X nom_servidor_ssh
            • debug1: Requesting X11 forwarding with authentication spoofing.
              ...
        • al client / in client
          • (run a program with gui, e.g. xterm)
            • libGL error: unable to load driver: swrast_dri.so
              libGL error: failed to load driver: swrast

              • Solució / Solution
                • export LIBGL_DEBUG=verbose; xterm
                  • libGL: OpenDriver: trying /usr/lib64/dri/tls/swrast_dri.so
                    ...
                • CentOS
                  • sudo yum provides /usr/lib64/dri/tls/swrast_dri.so
                  • sudo yum install mesa-dri-drivers
  • LDAP
  • Problemes / Problems

Logs

Synology (NAS)

  • Synology Assistant
  • Administration
  • File Station
  • Video Station
  • Photo Station
    • http://diskstation.home/photo
    • http://diskstation.local/photo
    • http://<server_ip_address>/photo/
    • file structure
      • /volume1/photo/ (owner: nobody.nobody)
        • album_1/
          • im_1.jpeg
          • im_2.jpeg
          • @eaDir/
            • im_1.jpeg/
              • SYNOPHOTO:THUMB_B.jpg
              • SYNOPHOTO:THUMB_L.jpg
              • SYNOPHOTO:THUMB_M.jpg
              • SYNOPHOTO:THUMB_S.jpg
              • SYNOPHOTO:THUMB_XL.jpg
            • im_2.jpeg/
              • SYNOPHOTO:THUMB_B.jpg
              • SYNOPHOTO:THUMB_L.jpg
              • SYNOPHOTO:THUMB_M.jpg
              • SYNOPHOTO:THUMB_S.jpg
              • SYNOPHOTO:THUMB_XL.jpg
        • album_2/
        • @eaDir/
          • album_1/
            • SYNOPHOTO_ALBUM.sort
          • album_2/
            • SYNOPHOTO_ALBUM.sort
    • logs
      • /var/log/cstn/client.log
    • Problemes / Problems
      • When creating an album: "The system failed to perform the requested operation, there is an unknown error"
        • /var/log/cstn/client.log
          • [WARNING] worker.cpp(925): UploadLocal: '/volume1/photo/@eaDir/album_toto/SYNOPHOTO_ALBUM.sort' cannot be uploaded (blocked: -4)
        • ls -l album_toto
          • -rw-rw-rw-    1 nobody   nobody          21 Oct 12 18:07 SYNOPHOTO_ALBUM.sort
        • newly created album does not appear in the web page
    • thumbnail script
  • Synology wiki
  • Mertymade Synology Packages
  • Android apps
  • ssh access
    • Synology
      • Control Panel -> Terminal -> Enable SSH service
    • client:
      • ssh admin@diskstation.local
    • ssh for users other than admin:
      • Stage 1 of rsync work
      • ssh root@diskstation.local (or use Config File Editor)
        • edit /etc/ssh/sshd_config (don't put this line after a Macth User ...):
          • AllowUsers = root user1
        • edit /etc/passwd:
          1. for user1, change
          • /sbin/nologin
          • /bin/sh
        • # /usr/syno/sbin/sshd
    • ssh without password
  • ordres / commands
    • Synology Toolset


      • /bin
        • ...
        /sbin
        • blockdev
        • dhcp6c
        • dmsetup
        • e2fsck
        • fdisck ...
        /usr/bin
        • a2p ...
        /usr/sbin
        • statd
        • telnetd
        /usr/syno/bin
        • 7z
        • SYNOClearTdb
        • syno_disck_ctl
        • syno_hdd_util
        • syno_poweroff_task
        • synoactltool
        • synoauth
        • synoautoblock
        • synoblog_backup
        /usr/syno/sbin
        • syno ...
        • synoservice
        • ...

    • Syno command documentation
    • services
      • synoservice --help
      • synoservice --list
      • Exemples / Examples
        • synoservice --start pgsl
        • synoservice --start synoindexd
    • base de dades / database
  • logs
    • ssh root@diskstation.local
    • Photo Station
  • rsync
    • Backup Linux desktop data using rsync
    • setup rsync for users others than admin, root, rsync
      1. ssh for users other than admin
      2. Control Panel -> Network backup -> Enable network backup service -> Use customised rsync configuration
        • only enables modules defined in /etc/rsyncd.conf (e.g. NetBackup)
      3. ssh root@diskstation.local
        1. vi /etc/rsyncd.conf
          • pid file = /var/run/rsyncd.pid
            lock file = /var/run/rsync.lock
            use chroot = no

            [NetBackup]
            path = /var/services/NetBackup
            comment = Network Backup Share
            uid = root
            gid = root
            read only = no
            list = yes
            charset = utf-8
            auth users = root,rsync,user1
            secrets file = /etc/rsyncd.secrets

        2. /etc/rsyncd.secrets
    • list of available modules:
      • rsync admin@diskstation.local::
    • how to rsync over ssh as an unprivileged user
    • Synology: enable ssh user login other than root
    • Securing SSH
    • user
      rsync
      additional steps on Synology (as root)


      create user
      /etc/ssh/sshd_config
      /etc/passwd
      admin
      rsync -avvr ... admin@diskstation.local::homes/admin/
      rsync -avvr ... admin@diskstation.local::photo
      -
      -
      -
      rsync
      rsync -avvr ... rsync@diskstation.local::homes/rsync/
      x
      -
      -
      user1
      rsync -avvr ... user1@diskstation.local:/volume1/homes/user1/ x
      AllowUsers = ... user1 /bin/sh

  • NFS
    • from NAS:
      • Control Panel -> Shared Folder -> NFS Provileges:
        • Hostname or IP: 192.168.0.0/16
        • Privilege: Read / Write
    • from client:
      • mount -t nfs 192.168.0.50:/volume1/photo /mnt/photo
      • mount -t nfs 192.168.0.50:/volume1/music /mnt/music
      • mount -t nfs 192.168.0.50:/volume1/homes /mnt/homes
  • UPnP / DLNA
  • Packages

Iomega NAS

  • Iomega Storage Manager
    • urpmi libjpeg62 libupnp3
    • export LD_LIBRARY_PATH=/usr/bin/Iomega\ Storage\ Manager/lib/

TimeTracker

  • User guide
  • Installation (Installation instuctions, Upgrade instructions, Ubuntu installation)
    • Dependencies
      • Install MySQL and set the root password
      • urpmi task-lamp-php
      • urpmi apache-mod_php php-pear php-pear-DB php-mbstring [php-smarty php-mysql php-pear-MDB2_Driver_mysql]
    • download:
    • unzip -d /var/www anuko_time_tracker.zip
    • Information about version, changelog, troubleshooting:
      • timetracker/readme.txt
    • chmod 777 WEB-INF/templates_c
    • Configure Timetracker:
      • cd /var/www/timetracker/WEB-INF/; cp config.php.dist config.php
      • /var/www/timetracker/WEB-INF/config.php
        • define("DSN",'mysql://tt_user:tt_password@localhost/timetracker');
        • define("APP_NAME",'timetracker');
        • define('MAIL_SMTP_HOST', 'smtp.your_server.com');
    • Configure Apache (may not be needed for Ubuntu):
      • /etc/httpd/conf/webapps.d/timetracker.conf
        • Alias /timetracker /var/www/timetracker
          <Directory "/var/www/timetracker">
            Order allow,deny
            Allow from All
          </Directory>
      • /etc/httpd/conf/httpd.conf
        • <Directory "/var/www/timetracker">
              Options -Indexes FollowSymLinks MultiViews
              AllowOverride None
              Order allow,deny
              Allow from all
          </Directory>

    • For a first time installation:
      • mysql -u root -p
        • CREATE DATABASE timetracker;
        • GRANT ALL ON timetracker.* TO 'tt_user'@'localhost' IDENTIFIED BY 'tt_password';
        • FLUSH PRIVILEGES;
        • exit;
      • mysql -u root -p -D timetracker < mysql.sql
      • Check that database is working
        • mysql -u tt_user -p
          • > password: tt_password
          • > use timetracker;
          • > show tables;
      • http://localhost/timetracker/dbinstall.php
        • Create
    • For an upgrade (and restore from backup):
      • mysql -u root -p
        • GRANT ALL ON timetracker.* TO 'tt_user'@'localhost' IDENTIFIED BY 'tt_password';
        • FLUSH PRIVILEGES;
        • exit;
      • mysql -v -v -v -u root -p < backup_timetracker.sql
      • Check that database is working
        • mysql -u tt_user -p
          • > password: tt_password
          • > use timetracker;
          • > show tables;
      • http://localhost/timetracker/dbinstall.php
        • Update:
          • sequentially click all Update buttons, from your_old_version up to 1.3.3
          • if you are not sure about what your_old_version is, click on ALL Update buttons, starting from the very first Update button
  • Upgrade
  • Timeout
    • /etc/php.ini
      • session.gc_maxlifetime=28800
    • /usr/lib/php/maxlifetime (used in /etc/cron.d/php)
      • max=28800
  • Problems
    • Activate PHP display errors
    • Check readme.txt: BLANK PAGES IN ANUKO TIME TRACKER
    • "The server encountered an internal error and was unable to complete your request. Error message:
      The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script."

Kimai

  • Install
    • urpmi php-pdo_mysql
    • mysql -u root -p
      • CREATE DATABASE kimaidb;
    • /etc/httpd/conf/webapps.d/kimai.conf
      • Alias /kimai /var/www/kimai_0.9.0.1082
        <Directory "/var/www/kimai_0.9.0.1082">
          Order allow,deny
          Allow from All
        </Directory>
  • chown apache.apache -R /var/www/kimai_0.9.0.1082/compile
  • chown apache.apache -R /var/www/kimai_0.9.0.1082/extensions
  • chown apache.apache -R /var/www/kimai_0.9.0.1082/temporary
  • open browser:
    • http://localhost/kimai
  • default user: admin/changeme

Weblate

  • Descàrrega / Download
    • git
  • Quick setup guide
    • Serving static files
    • Weblate with GitLab as OAuth provider
    • Django
    • Dependències / Dependencies
      • Mageia
        • urpmi ...
      • CentOS
        • sudo yum install gcc libxml2-devel libxslt-devel libjpeg-devel
      • Pip
        • virtualenv env
        • source env/bin/activate
        • pip install psycopg2 uwsgi
        • pip install python-social-auth
          • to avoid error "No module named social.apps.django_apps"
        • pip install -r requirements.txt
        • pip install --upgrade pip
        • pip install -r requirements-optional.txt
          • Additional dependencies:
            • for tesserocr
              • CentOS
                • sudo yum install tesserocr-devel
    • Download
      • git clone https://github.com/nijel/weblate.git
    • Setup
      • cd weblate
      • cp weblate/settings_example.py weblate/settings.py
      • settings.py
        • ...
      • ./manage.py migrate
      • ./manage.py createsuperuser
      • ./scripts/generate-locales
        • Problemes / Problems
          • *** Git <https://git-scm.com/> is too old! ***
            Installed version 1.8.3.1, required 1.8.5
            • Solució / Solution
              • Install a newer version of git (CentOS)
      • ./manage.py runserver 0.0.0.0:8000
  • Problemes / Problems
    • Git conflicts
      • ssh ...
      • cd /var/lib/weblate/data/vcs/<my_project>/<my_component>/
      • sudo su django
      • git status
      • Web GUI:
        • (?) Rebase
    • Fresh installation: ERROR: accounts.VerifiedEmail.social: (fields.E300) #1405
      • accounts.VerifiedEmail.social: (fields.E300) Field defines a relation with model 'UserSocialAuth', which is either not installed, or is abstract.
    • Error 500
    • When creating a component:
      • admin:
        • fatal: There is no merge to abort (MERGE_HEAD missing). (128)
      • /var/log/messages
        • ERROR my_project/my_component: failed merge on repo: fatal: ambiguous argument '@': unknown revision or path not in the working tree.
          Use '--' to separate paths from revisions, like this:
          'git <command> [<revision>...] -- [<file>...]' (128)
          • Produced by:
            • cd my_project/my_component
            • git log -n 1 --format=format:%H @
            • e.g. with CentOS and git 1.8.3.1
            • working fine with git 2.7.4 (Mageia)
          • Solution. One of the following
            • upgrade git
            • sed -i "s/'log', '-n', '1', '--format=format:%H', '@'/'log', '-n', '1', '--format=format:%H', 'HEAD'/" weblate/weblate/trans/vcs.py
    • (when debugging from Eclipse) OperationalError: no such table: trans_project
      • Solution
        • Do not use sqlite3
    • "Android String Resource" not present in File Format list
    • Hierachical JSON files are flattened
      • Weblate and i18next json files
        • Solució / Solution
          • cd /var/lib/weblate/scripts/
          • wget https://gist.githubusercontent.com/saily/f8a9f72c6b064d51f09040d66e981240/raw/5bcb059b5ff0339584745b7bfc707d6adc79e2a8/json_restore_hierarchy
          • chmod +x json_restore_hierarchy
          • settings.py
            • PRE_COMMIT_SCRIPTS = (
              '/var/lib/weblate/scripts/json_restore_hierarchy',
              )
          • sudo systemctl restart emperor.uwsgi.service
          • Admin -> Components -> MyComponent
            • Pre-commit script: json_restore_hierarchy
  • Usage
    • admin
      • SSH (http://<weblate>/admin/ssh/)
        • Public SSH key
          • stored in .../weblate/data/ssh/
            • id_rsa
            • id_rsa.pub
          • this is the id that will be used in git transactions; you need to add id_rsa.pub as a valid public key (identity) associated to your account in your git origin (e.g. GitLab)
        • Server key
          • stored in .../weblate/data/ssh/known-hosts
          • Add server key: gitlab.com
      • Project (http://<weblate>/admin/trans/)
        • Component
          • Repository URL: git@gitlab.com:my_group/my_project.git
          • Push repository URL: git@gitlab.com:my_group/my_project.git


          • Django
            AngularJS 2
            Android
            Source code repository:
            git@gitlab.com:my_group/my_project.git


            Repository push URL:
            git@gitlab.com:my_group/my_project.git


            Repository branch:
            master



            File mask:

            locale/*/LC_MESSAGES/django.po
            src/locale/messages.*.xlf
            app/src/main/res/values-*/strings.xml
            Monolingual base language file:


            src/messages.xlf app/src/main/res/values/strings.xml
            File format:

            Gettext PO file
            XLIFF translation file
            Android String Resource
            New translation:





  • Weblate and GitLab

Snowmix

  • Snowmix - Live Video Mixer
  • Instal·lació / Installation
    • Dependencies
      • CentOS
        • yum install nmap-ncat bc dejavu-lgc-sans-fonts
        • all other dependencies are automatically managed by bootstrap
      • Mageia
        • urpmi lib64SDL-devel lib64png-devel lib64cairo-devel lib64pango1.0-devel lib64tcl-devel bc
        • urpmi xterm bwidget
        • urpmi netcat-traditional
    • Get source
      • curl -o Snowmix-0.5.1.tar.gz -L "http://downloads.sourceforge.net/project/snowmix/Snowmix-0.5.1.tar.gz?r=&use_mirror=netix"
      • tar xzf Snowmix-0.5.1.tar.gz
      • Mageia (to avoid non-closing connection for nc)