Categorías
hoy aprendí ...

… por quincuagésima vez a establecer el password para el usuario root en mysql :(

Como lo estoy haciendo en una máquina virtual que solamente tengo acceso yo lo hago de la manera menos recomendada desde el punto de vista de seguridad, así que amiguitos no hagan esto en sus servidores de producción:

— inicio del texto copiado y pegado tal cual —

How to set MySQL password for the first time

Do note, I will refer to MySQL with the idea that everything will work for both MySQL and MariaDB.

Typically, during the installation of MySQL and MariaDB, you are asked to set an initial password. If, for whatever reason that didn’t happen, you will need to set a password for the first time. To do that, open up a terminal window and issue the following command:

mysqladmin -u root password NEWPASSWORD

Where NEWPASSWORD is the password to be used. Now, when you log into MySQL, with the command mysql -u root -p, you will be prompted to enter the newly configured password.

— fin del texto copiado y pegado tal cual —

Hay otros métodos nombrados en el artículo más recomendados para evitar comprometer la seguridad del sistema donde se tenga que realizar este procedimiento.

Gracias https://www.techrepublic.com/article/how-to-set-change-and-recover-a-mysql-root-password/

Y chau!

Categorías
hoy aprendí ...

…a agregar más de un autor a una obra en Calibre

Retomé el trabajo de catalogar la biblioteca de casa y cuando empecé a agregar las historietas me encontré con la dificultad de agregar más de un autor por obra en Calibre.

Gracias a los foros de la vieja internet (porque en el manual oficial no lo encontré) aprendí que se usa el ampersand (&) como encadenador (¡obviamente!).

Y chau.


Nota: dado que Calibre utiliza un sistema de carpetas basado en AUTOR / OBRAS, la carpeta va a ser creada solamente con el nombre del primer autor de la lista.

Categorías
hoy aprendí ...

… a recordar como montar un cdrom en linux

https://linuxconfig.org/how-to-mount-cdrom-in-linux

How to mount cdrom in Linux

15 October 2021 by Luke Reynolds

These days, CDs and DVDs are becoming less popular, in favor of flash drives and other convenient, portable media. However, you still may come across them every once in a while, and if your computer has a CD drive, you should be able to insert a disc and mount it on Linux.

In this tutorial, you’ll see the Linux commands necessary to mount a CDROM.

In this tutorial you will learn:

  • How to mount cdrom in Linux
CategoryRequirements, Conventions or Software Version Used
SystemAny Linux distro
SoftwareN/A
OtherPrivileged access to your Linux system as root or via the sudo command.
Conventions# – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Follow along with the steps below to mount a CD or DVD in Linux. Start off by inserting the disc into your computer, then run through these steps:

  1. First, try using the blkid command to see what device file your CD is using. Usually, this is going to be /dev/sr0, but it’s possible that yours is something different. You’ll know it’s the right one because it should say ISO9660Viewing device file path of cdrom in Linux
  2. Next, create a mount point for where you’d like to mount the CD to. Or, just pick an empty directory somewhere on your computer, if you already have a place in mind.$ sudo mkdir /mnt/cdrom
  3. Now we can use the mount command to map the device file to the directory we’ve just created.$ sudo mount /dev/sr0 /mnt/cdrom mount: /mnt/cdrom: WARNING: device write-protected, mounted read-only.
  4. Your CD or DVD should now be accessible in the directory which it was mounted to.$ cd /mnt/cdrom You can also verify that the mount was successful by using the mount command without further options.$ mount | grep cdrom Accessing a mounted cdrom in Linux
  5. When you are done, just unmount the CD and eject it from the disc tray.
    $ sudo umount /mnt/cdrom

Closing Thoughts

In this tutorial, we saw how to mount a CD or DVD rom on Linux systems. As you can see, the process is quite simple, and you will probably be able to do it in the future without a problem, now that you have done it once. Mounting and accessing a CDROM is pretty similar to mounting any other type of media.

Categorías
hoy aprendí ...

… a realizar chapucerías con caracteres y fórmulas en hojas de cálculo

Resulta que una tabla con nombres debía prepararla para ser procesada por PHP para generar contenido repetitivo. El nombre de la persona escrito de manera normal debia luego usarlo como nombre de archivo en el servidor web para cargar la foto, dejando todo en minúscula y reemplazando espacios con guión bajo, y acentos.

Ej:

Juan Pérez -> juan_perez

Resulta que en LibreOffice Calc (y asumo que en Excel también) hay una funciones para trabajar con strings (cadenas de caracteres).

=MINUSC(SUSTITUIR(B10;" ";"_"))

Básicamente logra pasar a minúscula y reemplazar los espacios.

Juan Pérez -> juan_pérez

La última parte de reemplazar los caracteres especiales de acentos, ñ, y apóstrofes lo terminé realizando en PHP con la ayuda de https://codigosdeprogramacion.com/2019/07/11/quitar-acentos-y-tildes-en-php/

function eliminar_acentos($cadena){

    //Reemplazamos la A y a
    $cadena = str_replace(
    array('Á', 'À', 'Â', 'Ä', 'á', 'à', 'ä', 'â', 'ª'),
    array('A', 'A', 'A', 'A', 'a', 'a', 'a', 'a', 'a'),
    $cadena
    );

    //Reemplazamos la E y e
    $cadena = str_replace(
    array('É', 'È', 'Ê', 'Ë', 'é', 'è', 'ë', 'ê'),
    array('E', 'E', 'E', 'E', 'e', 'e', 'e', 'e'),
    $cadena );

    //Reemplazamos la I y i
    $cadena = str_replace(
    array('Í', 'Ì', 'Ï', 'Î', 'í', 'ì', 'ï', 'î'),
    array('I', 'I', 'I', 'I', 'i', 'i', 'i', 'i'),
    $cadena );

    //Reemplazamos la O y o
    $cadena = str_replace(
    array('Ó', 'Ò', 'Ö', 'Ô', 'ó', 'ò', 'ö', 'ô'),
    array('O', 'O', 'O', 'O', 'o', 'o', 'o', 'o'),
    $cadena );

    //Reemplazamos la U y u
    $cadena = str_replace(
    array('Ú', 'Ù', 'Û', 'Ü', 'ú', 'ù', 'ü', 'û'),
    array('U', 'U', 'U', 'U', 'u', 'u', 'u', 'u'),
    $cadena );

    //Reemplazamos la N, n, C y c
    $cadena = str_replace(
    array('Ñ', 'ñ', 'Ç', 'ç'),
    array('N', 'n', 'C', 'c'),
    $cadena
    );

    //Reemplazamos apróstrofes ' ’ ` ´
    $cadena = str_replace(
    array("'", '’', '`', '´'),
    array('', '', '', ''),
    $cadena
    );

    return $cadena;
}

Y chau

Categorías
hoy aprendí ...

… a decirle a git que deje de darle bola al cambio de modo de los archivos

git config core.fileMode false

Encontrado en https://stackoverflow.com/a/1580644

Con una explicación muy buena:

Try:

git config core.fileMode false

From git-config(1):

core.fileMode
    Tells Git if the executable bit of files in the working tree
    is to be honored.

    Some filesystems lose the executable bit when a file that is
    marked as executable is checked out, or checks out a
    non-executable file with executable bit on. git-clone(1)
    or git-init(1) probe the filesystem to see if it handles the 
    executable bit correctly and this variable is automatically
    set as necessary.

    A repository, however, may be on a filesystem that handles
    the filemode correctly, and this variable is set to true when
    created, but later may be made accessible from another
    environment that loses the filemode (e.g. exporting ext4
    via CIFS mount, visiting a Cygwin created repository with Git
    for Windows or Eclipse). In such a case it may be necessary
    to set this variable to false. See git-update-index(1).

    The default is true (when core.filemode is not specified
    in the config file).

The -c flag can be used to set this option for one-off commands:

git -c core.fileMode=false diff

Typing the -c core.fileMode=false can be bothersome and so you can set this flag for all git repos or just for one git repo:

# this will set your the flag for your user for all git repos (modifies `$HOME/.gitconfig`)
git config --global core.fileMode false

# this will set the flag for one git repo (modifies `$current_git_repo/.git/config`)
git config core.fileMode false

Additionally, git clone and git init explicitly set core.fileMode to true in the repo config as discussed in Git global core.fileMode false overridden locally on clone

Warning

core.fileMode is not the best practice and should be used carefully. This setting only covers the executable bit of mode and never the read/write bits. In many cases you think you need this setting because you did something like chmod -R 777, making all your files executable. But in most projects most files don’t need and should not be executable for security reasons.

The proper way to solve this kind of situation is to handle folder and file permission separately, with something like:

find . -type d -exec chmod a+rwx {} \; # Make folders traversable and read/write
find . -type f -exec chmod a+rw {} \;  # Make files read/write

If you do that, you’ll never need to use core.fileMode, except in very rare environment.