Thursday, 21 November 2013

Instalar Linux "fortune" con textos bíblicos

Hoy quiero compartir como instalar y configurar su entorno Linux para hacer funcionar "fortune" con textos bíblicos (KJV es la única versión que encontré)

Descargar los textos bíblicos del siguiente link
http://util.iglesialatina.de/fortunes-kjv.zip
Descomprimir y mover los archivos
unzip fortunes-kjv.zip
sudo mv kjv* /usr/share/games/fortunes/
Para utilizarlos en la consola de una forma bonita, pueden instalar "cowsay"
sudo apt-get install cowsay
luego editar el archivo ".bashrc"
nano ~/.bashrc
y agregar esta línea al final del archivo
fortune kjv | cowsay
Eso es todo, para cualquier consulta estoy a su disposición.

Thursday, 10 October 2013

How to disable the apt proxy for some repositories

Just edit the /etc/apt/apt.conf file and write in something like this:

Acquire::http::Proxy {
        "http://proxy_user:proxy_password@my.proxy.host:8080"; 
        your.local.first.repository.net DIRECT;
        your.second.first.repository.com DIRECT;
};
 
DIRECT tells apt to use a direct connection (without proxy).

Friday, 27 September 2013

Small Mercurial how-to

How to create/override the "release" branch

hg update defaulthg branch -f releasehg push -f

How to see all branches

hg branches

How to jump to the "default" branch

hg update default

How to see the last push info

hg tip

How to save your password

The insecure way

Edit your ".hg/hgrc" file and write in:

[paths]
project1 = http://hg.my-own-domain.com/hg/PROJECT_1
project2 = http://hg.my-own-domain.com/hg/PROJECT_2
...


[auth]
project1.schemes = http https
project1.prefix = hg.my-own-domain.com/hg
project1.username = MY_USER_NAME
project1.password = MY_PASSWORD
...

The secure way


http://mercurial.selenic.com/wiki/KeyringExtension

Tuesday, 23 July 2013

How to run "Internet Explorer" in Ubuntu 13.04

Add "Wine" repository into your source list file

sudo apt-add-repository ppa:ubuntu-wine/ppa

Install Wine

sudo apt-get update
sudo apt-get install wine

Run IE8

winetricks ie8

Tuesday, 2 July 2013

How to install Splunk log analyser in Debian

Splunk indexer

Installation

  1. Get the Debian package from
    http://www.splunk.com/download?ac=get_splunk_download
  2. Install it with a root user
    dpkg -i splunk_package_name.deb
  3. Start the server
    /opt/splunk/bin/splunk start --accept-license

Launch the web application

In an internet browser, access the Splunk web-application at http://<hostname>:<port>
  • <hostname> is the host server name or IP.
  • <port> is the port you specified during the installation (the default port is 8000)
The web prompts you the login page (default username "admin" and password "changeme"), after that you need to change the admin password.

Configuration

Add local data

  1. Go to "Manager » Data inputs » Files & directories"
  2. Click on "New" button
  3. Choose the log file and follow the wizard

Receive data

  1. Go to "Manager » Forwarding and receiving » Receive data"
  2. Click on "New" button
  3. Choose the server port (where the indexer will receive the logs from the forwarders)
  4. Restart Splunk server
Note: contact HelpDesk to open the ports between the indexer and forwarders.

Splunk forwarder

Installation

  1. Get the Debian package from
    http://www.splunk.com/download/universalforwarder
  2. Install it with a root user
    dpkg -i splunk_package_name.deb
  3. Start it
    /opt/splunkforwarder/bin/splunk start --accept-license

Configuration

  1. Configure universal forwarder to auto-start
    /opt/splunkforwarder/bin/splunk enable boot-start
  2. Configure the universal forwarder to forward the log files to a specific receiver indexer
    /opt/splunkforwarder/bin/splunk add forward-server <host>:<port> -auth <username>:<local-password>
    Where:
    • <host> is the receiving indexer's hostname or IP address and <port> is the port it's listening on. By convention, the receiver listens for forwarders on port 9997, but it can be set to listen on any port, so you'll need to check with the receiver's administrator to obtain the port number. For information on setting up a receiver, see "Enable a receiver".
    • <username>:<password> is the username and password for logging into the Splunk forwarder. By default, these are "admin:changeme" (To set a different password than the default , issue the following command "splunk edit user admin -password <new password> -role admin -auth admin:changeme").
  3. Add the data to be forwarder
    • Edit "inputs.conf"
      cd /opt/splunkforwarder/etc/system/local/
      nano inputs.conf
    • Include the content below
      [monitor:///opt/hybris/log/tomcat/console-*.log]
      disabled = false
      ignoreOlderThan = 3d
      sourcetype = <project-name>
      Where:
      ignoreOlderThan: the input monitor stop checking files for updates if the time passed the 3 days.
    • Restart the Splunk forwarder
      /opt/splunkforwarder/bin/splunk restart
    • Check the Splunk log file
      less /opt/splunkforwarder/var/log/splunk/splunkd.log
 Note: to see more configuration options, check it here -> http://docs.splunk.com/Documentation/Splunk/5.0.3/Data/Editinputs.conf

Expresiones regulares en Java

Me encontré con el problema de validar con expresiones regulares (RegExp) los nombres en alemán, es decir que acepte "öüäÜÖÄ" y espacios, aquí la solución:

@Pattern(regexp = "^[\\p{L}\\s]+$")
No olvidarse de importar:

import javax.validation.constraints.Pattern;

Para validar números telefónicos con signos "+", te puede servir:

@Pattern(regexp = "^[\\d\\s\\+]+$")