vcgencmd from a docker container

It took me quite a lot of time to figure this out, but to be able to run the vcgencmd command from a container you just need to add the following options to your docker run command:

--device=/dev/vchiq -e LD_LIBRARY_PATH=/opt/vc/lib -v /opt/vc:/opt/vc:ro

1) docker run example:

$ docker run -d --name my_container --device=/dev/vchiq -e LD_LIBRARY_PATH=/opt/vc/lib -v /opt/vc:/opt/vc:ro influxdb:1.8.9
f7c847bea90edc7d56aed666ac9f6c8264d4cc0f8817862e669aac06d750e977

$ docker exec -it my_container bash
root@f7c847bea90e:/# /opt/vc/bin/vcgencmd measure_temp
temp=42.2'C
root@f7c847bea90e:/# exit
$

2) docker-compose example:

version: "3.5"
  services:
    telegraf:
      image: influxdb:1.8.9
      restart: always
      volumes:
        - /opt/vc:/opt/vc:ro
      devices:
        - "/dev/vchiq:/dev/vchiq"
      environment:
        - LD_LIBRARY_PATH=/opt/vc/lib

That’s it! As easy as that.

Find the post where I found this solution and its original author here: https://github.com/fchauveau/rpi-domoticz-docker#pro-tips

Publicado en raspberry | Etiquetado , | Deja un comentario

Overwrite facter core facts

Quick post today, more like a reminder for my future self than anything else 🙃

If you want to quickly change the value of a facter fact you can use ENV variables[*].

# show the operating system we are running (retrieved from facter)
$ puppet apply -e 'notify { "We are running on ${::operatingsystem}": }'
notice: We are running on Fedora

# override $operatingsystem for testing purposes
$ FACTER_operatingsystem=Debian puppet apply -e 'notify { "We are running on ${::operatingsystem}": }'
notice: We are running on Debian

This works just fine but sometimes you cannot rely on environment variables and you need something consistent system-wide.

The solution™️

Create a new JSON file (YAML is also possible) under /opt/puppetlabs/facter/facts.d/ with the facts and the new values.

{"fact_name": "new_value"}

Changing kernel fact

[root@puppet ~]# facter kernel
Linux
[root@puppet ~]# cat /opt/puppetlabs/facter/facts.d/overwrite_kernel.json
{
  "kernel": "Hurd"
}
[root@puppet ~]# facter kernel
Hurd
[root@puppet ~]#

Cool, what about structured facts

For structured facts you should to provide the whole JSON, otherwise you will lose those facts you don’t specify.

Example (note how release number was changed from v7.8 to v1.3):

[root@puppet ~]# cat /opt/puppetlabs/facter/facts.d/overwrite_os.json
{
  "os": {
    "architecture": "x86_64",
    "distro": {
      "codename": "Maipo",
      "description": "Red Hat Enterprise Linux Server release 7.8 (Maipo)",
      "id": "RedHatEnterpriseServer",
      "release": {
        "full": "1.3",
        "major": "1",
        "minor": "3"
      },
      "specification": ":core-4.1-amd64:core-4.1-noarch"
    },
    "family": "RedHat",
    "hardware": "x86_64",
    "name": "RedHat",
    "release": {
      "full": "1.3",
      "major": "1",
      "minor": "3"
    },
    "selinux": {
      "config_mode": "enforcing",
      "current_mode": "enforcing",
      "enabled": "true",
      "enforced": "false",
      "policy_version": "31"
    }
  }
}

And that’s it, simple and effective 😀

[*] Updated example from: https://www.puppetcookbook.com/posts/override-a-facter-fact.html

Publicado en Uncategorized | Deja un comentario

How to configure GitHub Pages with a custom IONOS (old 1&1) domain

NOTE: This tutorial assumes you have a GitHub page already created.
If this is not your case please follow https://guides.github.com/features/pages/

Github configuration

Go to ‘https://github.com/<GITHUB_USERNAME>/<YOUR_GITHUB_REPO>/settings&#8217;

Scroll down until you reach GitHub Pages section and add your domain/subdomain there.

gpagesClick on Save and you are good to go. Github will create a new CNAME file with the specified custom domain as its content in your repository.

IONOS configuration

Login into your IONOS account and select the domain you want to use for your Github Page https://my.ionos.com/domains

Then go to your domain DNS configuration panel:

dns

You need to delete all existing «A» and «AAAA» records for the «@» host and replace them with the IP addresses for GitHub Pages «A» records.

185.199.108.153
185.199.109.153
185.199.110.153
185.199.111.153

NOTE: Please verify if the IPs haven’t changed: https://help.github.com/en/github/working-with-github-pages/managing-a-custom-domain-for-your-github-pages-site#configuring-an-apex-domain

After they are all deleted, you need to click on Add registry to create the new A records pointing to the Github Pages IPs.

  • Type: A
  • Hostname: @
  • Points to: 185.199.109.153
  • TTL: 1 hour (default value)
  • Add a DNS registry for www: disabled

dns_1

NOTE: It’s VERY important that «Add a DNS registry for www» option is disabled (see picture below)

After creating the new 4 «A» records you need to add a new one. This time a «CNAME» record pointing to your <GITHUB_USERNAME>.github.io

  • Type: CNAME
  • Hostname: www
  • Points to: <GITHUB_USERNAME>.github.io.
  • TTL: 1 hour (default value)

cname

After all the steps this is how your IONOS domain DNS configuration should look like:

final

Annnd that’s all, give the new DNS configuration a few minutes so it can be propagated and your Github Page should be accessible via your IONOS domain 🙂

Publicado en Uncategorized | Deja un comentario

Configurar Raspberry Pi como dispositivo Spotify Connect

Si en la anterior entrada explicamos cómo instalar yaourt en Archlinux sin apenas despeinarnos, en ésta veremos como convertir nuestra Raspberry Pi en un dispositivo compatible con Spotify Connect en el que poder escuchar nuestra música de forma remota.

El siguiente vídeo muestra la funcionalidad que se pretende conseguir:

Mola, eh!? ¡Pues vamos a ello! Seguir leyendo

Publicado en Uncategorized | 4 comentarios

Instalar yaourt en ArchLinux en cerocoma

Una de las mejoras cosas de utilizar Archlinux en sus distintos sabores y formas es la facilidad para encontrar la mayoría las aplicaciones disponibles sin necesidad de añadir repositorios externos o complicaciones.

En caso de que el paquete no este disponible en ninguno de los repositorios habilitados por defecto en el sistema, siempre te quedará la posibilidad de instalarlo desde AUR. Arch User Repository (AUR) es un repositorio software mantenido por y para los usuarios de Arch.

Instalar un paquete desde AUR no resulta demasiado complicado aunque puede convertirse en algo pesado si nos encontramos con dependencias o incluso dependencias de dependencias… Para ayudarnos con esto, existe una herramienta llamada yaourt que nos facilitara enormemente la tarea.

En esta entrada veremos los pasos necesarios para instalar yaourt desde AUR en nuestro equipo.

Seguir leyendo

Publicado en Uncategorized | 2 comentarios

Emparejar Garmin Forerunner con Android

Recientemente me he pillado un Garmin Forerunner y aunque parezca mentira, me ha costado más de lo que debería poder emparejarlo con mi #Nexus5 con Android 6 Marshmallow. Y por lo que parece, no he sido el único

IMG_20160619_131518

Garmin Forerunner 235

Sea culpa del nuevo gestor de permisos introducidos en Android 6 o de la propia incapacidad de Garmin de hacer una app como Dios manda, en esta entrada veremos los pasos para solucionarlo.

Seguir leyendo

Publicado en Miscelánea, Uncategorized | Deja un comentario

Instalar Sistema Operativo en el SSD de un HP Envy Ultrabook

Hace casi tres cuatro (!) años que me compré  el que a día de hoy sigue siendo mi portátil personal, un HP Envy Ultrabook™ 4-1020e (características técnicas).

Por aquel entonces me decanté por este modelo por su hardware, diseño, batería, peso y como no, por su precio (unos 750€). Entre sus principales características destacaba el hecho de que junto con un HDD tradicional, incluía un SSD de 32GB a modo de caché. Nada mal para el año 2012, teniendo en cuenta el precio mencionado anteriormente.

Ya por aquel entonces pregunté en los foros de soporte de HP si podía utilizar ese disco adicional de 32Gb para instalar el sistema operativo y dejar el HDD para datos. Seguir leyendo

Publicado en Uncategorized | Deja un comentario

Special characters and accents on Archlinux terminal (á, é, i, ó, ú, ñ …)

Edit /etc/locale.gen using your favourite editor.

$ vim /etc/locale.gen

Comment out the following line:

xx_XX ISO-8859-1

*  where xx and XX are your languaje and region (e.g es_ES ISO-8859-1 for spanish from Spain)

Save the file and execute locale-gen to regenerate the locales with the lastest changes.

$ locale-gen

Reboot. You are done 😀

Thanks!

Publicado en Uncategorized | Deja un comentario

Setting a static IP for Arch Linux on Raspberry PI

This is something that has been bothering me for the last months. I tried it in several different ways but none of them solved my problem. No matter the changes I made, after rebooting the Pi it always got both and static and dynamic IPs…

After all these months I finally found the solution, yay! 😀

This magic was hidden in the comments section of this blog. (kudos to Tchelovek)

Seguir leyendo

Publicado en Uncategorized | Deja un comentario

Eliminar diccionarios no usados en Firefox [Ubuntu 12.10]

Con la última actualización de Firefox (v18) me he dado cuenta de que en mi Ubuntu 12.10, por omisión están instalados más diccionarios de los que realmente necesito.

Por ejemplo, para el idioma «español» tenemos instalados diccionarios para cada uno de los países hispanohablantes del mundo, cosa que acaba confundiendo más que otra cosa.

Imagen

Eliminar todos aquellos que no necesitamos es muy sencillo.

Abrimos la Terminal y escribimos lo siguiente:

cd /usr/share/hunspell

En esta ubicación es dónde se almacenan los diccionarios. por lo que debemos eliminar los que no utilicemos. En mi caso eliminaré todos excepto es_ES y en_US.

Para no tener que ir eliminándolos uno a uno, verificamos que las expresiones regulares estén activas (en mi caso sí que lo estaban, pero supongo que no en todas las distribuciones Linux lo estén por omisión):

shopt extglob

En el caso de que no lo estén las activamos:

shopt -s extglob

Y ejecutamos el comando (eliminará todos excepto es_ES y en_US):

sudo rm !(es_ES*|en_US*)

Listo. Reiniciar Firefox y sólo tendremos los diccionarios español (España) e inglés (US).

Parte de la información e imagen de la entrada obtenida de: http://www.glatelier.org/2011/08/tip-elimina-los-diccionarios-que-no-ocupas-en-firefox-5-0/

Publicado en Uncategorized | Etiquetado , , , , | 2 comentarios