Monthly Archives: July 2022

See where is the space used in your Android phone from Ubuntu Terminal

So, you may have your Android phone full and you don’t know where the space is.

You may have tried Apps for Android but none shows the information in the detail you would like. Linux to the rescue.

First of all you need a cable able to transfer Data. It is a cable that will be connected to your computer, normally with an USB 3.0 cable and to your smartphone, normally with USB-C.

Sometimes phone’s connectors are dirty and don’t allow a stable connection. Your connections should allow a stable connection, otherwise the connection will be interrupted in the middle.

Once you connect the Android smartphone to the computer, unlock the phone and authorize the data connection.

You’ll see that your computer recognizes the phone:

Open the terminal and enter this directory:

cd /run/user/1000/gvfs/

Here you will see your device and the name is very evident.

The usual is to have just one device listed, but if you had several Android devices attached you may want to query first, in order to identify it.

The Android devices use a protocol named Media Transfer Protocol (MTP) when connecting to the USB port, and that’s different on the typical way to access the USB port.

usb-devices  | grep "Manufacturer=" -B 3

Run this command to see all the devices connected to the USB.

You may see Manufacturer=SAMSUNG or Manufacturer=OnePlus etc…

The information returned will allow you to identify your device in /run/user/1000/gvfs/

You may get different type of outputs, but if you get:

T:  Bus=02 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 13 Spd=480 MxCh= 0

your device can be accessed inside:

cd mtp\:host\=%5Busb%3A002%2C013%5D/

There you’ll see Card and Phone.

You can enter the Phone internal storage or the SD Card storage directory:

cd Phone

To see how the space is distributed nicely I recommend you to use the program ncdu if you don’t have you can install it with:

sudo apt install ncdu

Then run ncdu:

ncdu

It will calculate the space…

… and let you know, sorted from more to less, and will allow you to browse the sub-directories with the keyboard arrow keys and enter to get major clarity.

For example, in my case I saw 8.5 GB in the folder Movies on the phone, where I didn’t download any movie, so I checked.

I entered inside by pressing Enter:

So Instagram App was keeping a copy all the videos I uploaded, in total 8.5 GB of my Phone’s space and never releasing them!.

Example for the SD card, where the usage was as expected:

RAB El nou món digital, edició d’estiu / Summer Edition 2022 [CA|EN]

Aquest és el guió per al proper programa El nou món digital a Ràdio Amèrica Barcelona, que s’emet els Dilluns a les 14:30 Ireland Time / 15:30 Zona horària Catalunya / 06:30 Pacific Time.

Disclaimer: Treballo per a Activision Blizzard. Totes les opinions són meves i no representen cap companyia.


This is the excerpt of my radio program at Radio America Barcelona that airs on Mondays 14:30 Irish Time / 15:30 Catalonia Time / 06:30 Pacific Time.

Disclaimer: I work for Activision Blizzard. Opinions are my own. My opinions do not represent any company.

El programa de ràdio a RAB fa vacances durant el mes d’Agost, i tornarà a emetres el 5 de Setembre.

Nogensmenys continuaré pujant notícies per a que estigueu informats durant l’estiu. :)

Program en Català
Program in English

Darrera actualització / Last Update: 2022-08-01

The RAB radio program will be on holidays during August, coming back the 5th of September. However I’ll keep posting news.

Entreteniment

  • Més anuncis en Català: Dragon Ball Super Heroi s’estrenarà als cinemes el 2 de Setembre
  • Han anunciat el trailer de la nova de Black Panther
  • The new Black Panther movie has been announced
  • I el 3 d’Agost a Disney Plus arriba Lightyear!
  • Un company de feina va ser al Comic Con i m’ha passat una foto de totes les estrenes super xules que vén el 2022 i 2023. Gràcies Mason!
  • A work colleague was at Comic Con and has sent me a picture of the new super cool movies coming in 2022 and 2023. Thanks Mason!

Notícies d’estiu / Summer News

  • Rosalia va cantar al Juliol en Català a València. Ja que els esforços d’espanya per a erradicar la llengua catalana, sempre celebrem que la nostra llengua brilli arreu.
  • Rosalia sang in July in Catalan in Valencia. As the efforts from Spain to eradicate the Catalan language are huge, we always celebrate our language shining anywhere.
  • Una estudiant de belles arts d’UK va protestar duent a la graduació que volia un reemborsament, doncs durant el covid la formació que han rebut està molt per sota de la formació presencial de la resta dels anys, i el preu és el mateix

  • Una companyia de telecomunicacions al Canadà, Rogers, va tenir un error en els seus processos i va deixar sense telefonia milions de clients, fins i tot el servei d’emergències va estar inaccessible durant un dia. La notícia parla de que va ser un error de codi però llegint la notícia sembla clar que la companyia no va invertir suficient en garantitzar la qualitat dels seus processos. Culpar a un error de codi és com culpar el gat de tot, quan els executius han sigut incompetents en posar els mitjans a IT: prou temps i personal per a que els enginyers dissenyessin una solució segura per a la posada en producció dels canvis. Per a mi és un altre exemple de no tenir cura dels clients.
  • A communications company in Canada, Rogers, had an error in their processes and let down without phone service millions of clients. Even emergencies was not accessible for a day. The new on the article linked says that it was an error in the code but reading the article it seems clear that the company did no invest in assuring the quality of their processes. Blaming an error in the code is like blaming the cat for everything, when the executives were incompetent in providing the means to IT: enough time and staff so the engineers could design a safe solution to release the changes to production. For me is another example of not caring about the customers.
  • Amazon ha pujat el preu de la subscripció d’Amazon Prime
  • Amazon has increased the price of the Prime subscription

Seguretat

  • La meva amiga Esther m’envia una captura del seu mòbil d’una estafa en que li envien un SMS on s’intenten fer passar per caixabanc. El més divertit és que ella no te compte en aquell banc.
  • My friend Esther sends me an screenshot from a fraud attempt via SMS where they try to impersonate caixabanc (a bank). The most funny is that she doesn’t have account in that bank.
  • Security flaws in a popular GPS module could allow hackers to track vehicles and to stop the vehicle by cutting the fuel reserves. This Chinese GPS costs $20 USD
    • And I think about how important is to have professional Software Developers which good salaries, with good managers, working in a democratic country with transparent and fair laws. Buying products sold by company that mistreat employees, or pay they few, or in dictatorship countries poses a security risk for all the customers

Internet / Societat

  • M’agrada CoffeeZilla perque desenmascara estafadors, i ha fet que més d’un vagi a presó
  • I like CoffeeZilla because he discovers scammers, and has made go to prison more than one

Notícies

  • Uber se segueix cobrint de glòria. Ha estat discriminant passetgers amb discapacitats

Gadgets

  • Canon i Nikon abandonen la tecnologia DSLRS per a centrar-se en les càmeres mirrorless

Humor

Programes anteriors / Previous Programs

Programa anterior: RAB El nou món digital 2022-07-25 [CA|EN]

Tots els programes: RAB

RAB El nou món digital 2022-07-25 [CA|EN]

Aquest és el guió per al proper programa El nou món digital a Ràdio Amèrica Barcelona, que s’emet els Dilluns a les 14:30 Ireland Time / 15:30 Zona horària Catalunya / 06:30 Pacific Time.

Disclaimer: Treballo per a Activision Blizzard. Totes les opinions són meves i no representen cap companyia.


This is the excerpt of my radio program at Radio America Barcelona that airs on Mondays 14:30 Irish Time / 15:30 Catalonia Time / 06:30 Pacific Time.

Disclaimer: I work for Activision Blizzard. Opinions are my own. My opinions do not represent any company.

Aquesta és la pàgina del programa del proper 25 de Juliol de 2022.

El nou món digital a RAB – en Català (Catalan language video)

El programa a RAB fa vacances durant el mes d’Agost, i tornarà a emetres el 5 de Setembre, però jo continuaré penjant notícies al blog.

This is the page for today’s program, July 25th 2022. A video in English will be uploaded after. The program in RAB will be on holidays during August, coming back the 5th of September, but I’ll continue uploading messages in the blog.

Darrer programa de la temporada d’estiu

Avui farem un programa fresc i curt, ja que és el darrer i tenim poc temps.

Video jocs i entreteniment

Videojocs

Commander Turtle

  • Parlaré d’un video joc que he fet per a que els nens puguin aprendre a programar dibuixant i puguin compartir les seves creacions passant el codi a altres amics/pares.

Elden Ring

Sèries

  • El 10 d’Agost arriba a Disney+ I am Groot, la sèrie d’animació d’aquest simpàtic heroi de Guardians de la Galàxia.

Trucs

  • Per seguretat, usar una tapeta per a la càmera del portàtil, o tapar la camara web externa
  • Quan necessites posar accents a un email, i uses el teclat d’un ordinador que no en te, com a bon/a expat
    • Teclat virtual per a Linux, Mac, Windows
    • També et pots comprar un teclat físic o un d’enrotllable

Actualitat

Programes anteriors

Programa anterior: RAB El nou món digital 2022-07-18 [CA|EN]

Tots els programes: RAB

News from the blog 2022-07-22

Carles in the News

For all my friends and followers, I started to translate my radio space “El nou món digital” (in Catalan) to English “The New Digital World”. I cover Science, Technology, Entertainment and Video games.

You can see the first programs I translated here:

Catalan and English programs RAB

And the script and links mentioned here:

https://blog.carlesmateo.com/2022/06/20/rab-el-nou-mon-digital-2022-06-27-ca/

Social

I’ve created an Instagram fan page for me / for the blog.

It is open for everybody.

https://www.instagram.com/blog_carlesmateo/

Videos for learning how to code

Learning How to code Python Unit Tests with pytest from the scratch, for beginners:

I added it to my series of videos:

https://blog.carlesmateo.com/learn-python-3-unit-testing/

Video for learning how to use RabbitMQ with Python in a Docker Container

https://blog.carlesmateo.com/2022/07/20/creating-a-rabbitmq-docker-container-accessed-with-python-and-pika/

Site carlesmateo.com

I use mostly this site https://blog.carlesmateo.com to centralize everything, so I’ve kept http://carlesmateo.com as a simple landing page made with my old (from 2013) ultra fast PHP Framework Catalonia Framework.

I decided to create a Jenkins Pipeline to deploy any updates to this pages and I updated it a bit at least to provide the most common information searched.

Don’t expect anything fancy at Front End level. :)

Cloud

I created a video about how to provision a Ubuntu Droplet in Digital Ocean.

It’s just for beginners, or if you used other CSP’s and you wonder how Digital Ocean user interface is.

It is really easy, to be honest. Amazon AWS should learn from them.

I also created another about how to provision using User Data Cloud Init feature:

https://blog.carlesmateo.com/2022/06/25/how-to-deploy-a-digitalocean-droplet-instance-and-use-userdata/

Books

My Books

I have updated Docker Combat Guide to show how to work with different users in the Dockerfile and accessing an interactive terminal.

I have also added how to create a Jenkins containerized.

Books I bought > CI/CD

I recommend you these books:

I’ve created a video about how to deploy jenkins in Docker, following the official documentation, in 4 minutes.

Install jenkins on Docker in ubuntu in 4 minutes

And posted an article about solving the error load key invalid format when provisioning from Jenkins with your SSH .pem Key in a variable.

https://blog.carlesmateo.com/2022/07/05/solving-linux-load-key-ssh_yourserver-invalid-format-when-provisioning-from-jenkins/

Open Source from Carles

CTOP.py

I have released a new version of CTOP, ctop.py version 0.8.9.

This version fixes few bugs, and adds better Unit Testing Code Coverage, and is integrated with jenkins (provides Jenkinsfile and a Dockerfile ready to automate the testing pipeline)

Sudo ku solver, Sudoku solver in Python, and Engineering solving problem approach

I’ve created this video explaining my experience writing a program to solve two impossible, very annoying Sudokus. :)

https://blog.carlesmateo.com/2022/04/26/working-on-a-sudoku-solver-in-python-source-code/

Commander Turtle: a small program in Python so children can learn to code by drawing

Children can learn to code and share their scripts, which are comma separated, easily.

Commander Turtle

My life at Activision Blizzard

We have released World of Warcraft Dragonflight Alpha.

In the sync meetings I lead with Wow SRE and product Team I was informed that streaming would be open. Myself I was granted to stream over twitch, but so far I didn’t want to stream video games in my engineering channels. It’s different kind of audiences IMO. Let me know if you would like to get video game streams in my streaming channels.

Lich King

Humor

If you have been in a madness of Servers of a Cluster getting irresponsible and having to cold reboot them from remote hands iDracs or similar, you know why my friends sent me this image :D

Creating a RabbitMQ Docker Container accessed with Python and pika

In this video, that I streamed on Twitch, I demonstrate the code showed here.

I launch the Docker Container and operated it a bit, so you can get to learn few tricks.

I created the RabbitMQ Docker installation based on the official RabbitMQ installation instructions for Ubuntu/Debian:

https://www.rabbitmq.com/install-debian.html#apt-cloudsmith

One interesting aspect is that I cover how the messages are delivered as byte sequence. I show this by sending Unicode characters

Files in the project

Dockerfile

FROM ubuntu:20.04

MAINTAINER Carles Mateo

ARG DEBIAN_FRONTEND=noninteractive

# This will make sure printing in the Screen when running in dettached mode
ENV PYTHONUNBUFFERED=1

ARG PATH_RABBIT_INSTALL=/tmp/rabbit_install/

ARG PATH_RABBIT_APP_PYTHON=/opt/rabbit_python/

RUN mkdir $PATH_RABBIT_INSTALL

COPY cloudsmith.sh $PATH_RABBIT_INSTALL

RUN chmod +x ${PATH_RABBIT_INSTALL}cloudsmith.sh

RUN apt-get update -y && apt install -y sudo python3 python3-pip mc htop less strace zip gzip lynx && apt-get clean

RUN ${PATH_RABBIT_INSTALL}cloudsmith.sh

RUN service rabbitmq-server start

RUN mkdir $PATH_RABBIT_APP_PYTHON

COPY requirements.txt $PATH_RABBIT_APP_PYTHON

WORKDIR $PATH_RABBIT_APP_PYTHON

RUN pwd

RUN pip install -r requirements.txt

COPY *.py $PATH_RABBIT_APP_PYTHON

COPY loop_send_get_messages.sh $PATH_RABBIT_APP_PYTHON

RUN chmod +x loop_send_get_messages.sh

CMD ./loop_send_get_messages.sh

cloudsmith.sh

#!/usr/bin/sh
# From: https://www.rabbitmq.com/install-debian.html#apt-cloudsmith

sudo apt-get update -y && apt-get install curl gnupg apt-transport-https -y

## Team RabbitMQ's main signing key
curl -1sLf "https://keys.openpgp.org/vks/v1/by-fingerprint/0A9AF2115F4687BD29803A206B73A36E6026DFCA" | sudo gpg --dearmor | sudo tee /usr/share/keyrings/com.rabbitmq.team.gpg > /dev/null
## Cloudsmith: modern Erlang repository
curl -1sLf https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg > /dev/null
## Cloudsmith: RabbitMQ repository
curl -1sLf https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key | sudo gpg --dearmor | sudo tee /usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg > /dev/null

## Add apt repositories maintained by Team RabbitMQ
sudo tee /etc/apt/sources.list.d/rabbitmq.list <<EOF
## Provides modern Erlang/OTP releases
##
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/ubuntu bionic main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.E495BB49CC4BBE5B.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/ubuntu bionic main

## Provides RabbitMQ
##
deb [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/ubuntu bionic main
deb-src [signed-by=/usr/share/keyrings/io.cloudsmith.rabbitmq.9F4587F226208342.gpg] https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/ubuntu bionic main
EOF

## Update package indices
sudo apt-get update -y

## Install Erlang packages
sudo apt-get install -y erlang-base \
                        erlang-asn1 erlang-crypto erlang-eldap erlang-ftp erlang-inets \
                        erlang-mnesia erlang-os-mon erlang-parsetools erlang-public-key \
                        erlang-runtime-tools erlang-snmp erlang-ssl \
                        erlang-syntax-tools erlang-tftp erlang-tools erlang-xmerl

## Install rabbitmq-server and its dependencies
sudo apt-get install rabbitmq-server -y --fix-missing

build_docker.sh

#!/bin/bash

s_DOCKER_IMAGE_NAME="rabbitmq"

echo "We will build the Docker Image and name it: ${s_DOCKER_IMAGE_NAME}"
echo "After, we will be able to run a Docker Container based on it."

printf "Removing old image %s\n" "${s_DOCKER_IMAGE_NAME}"
sudo docker rm "${s_DOCKER_IMAGE_NAME}"

printf "Creating Docker Image %s\n" "${s_DOCKER_IMAGE_NAME}"
sudo docker build -t ${s_DOCKER_IMAGE_NAME} . --no-cache

i_EXIT_CODE=$?
if [ $i_EXIT_CODE -ne 0 ]; then
    printf "Error. Exit code %s\n" ${i_EXIT_CODE}
    exit
fi

echo "Ready to run ${s_DOCKER_IMAGE_NAME} Docker Container"
echo "To run in type: sudo docker run -it --name ${s_DOCKER_IMAGE_NAME} ${s_DOCKER_IMAGE_NAME}"
echo "or just use run_in_docker.sh"

requirements.txt

pika

loop_send_get_messages.sh

#!/bin/bash

echo "Starting RabbitMQ"
service rabbitmq-server start

echo "Launching consumer in background which will be listening and executing the callback function"
python3 rabbitmq_getfrom.py &

while true; do

    i_MESSAGES=$(( RANDOM % 10 ))

    echo "Sending $i_MESSAGES messages"
    for i_MESSAGE in $(seq 1 $i_MESSAGES); do
        python3 rabbitmq_sendto.py
    done

    echo "Sleeping 5 seconds"
    sleep 5

done

echo "Exiting loop"

rabbitmq_sendto.py

#!/usr/bin/env python3
import pika
import time

connection = pika.BlockingConnection(pika.ConnectionParameters(host="localhost"))

channel = connection.channel()

channel.queue_declare(queue="hello")

s_now = str(time.time())

s_message = "Hello World! " + s_now + " Testing Unicode: çÇ àá😀"
channel.basic_publish(exchange="", routing_key="hello", body=s_message)
print(" [x] Sent '" + s_message + "'")
connection.close()

rabbitmq_getfrom.py

#!/usr/bin/env python3
import pika


def callback(ch, method, properties, body):
    # print(f" [x] Received in channel: {ch} method: {method} properties: {properties} body: {body}")
    print(f" [x] Received body: {body}")


connection = pika.BlockingConnection(pika.ConnectionParameters(host="localhost"))

channel = connection.channel()

channel.queue_declare(queue="hello")

print(" [*] Waiting for messages. To exit press Ctrl+C")

# This will loop
channel.basic_consume(queue="hello", on_message_callback=callback)
channel.start_consuming()

print("Finishing consumer")

Video: Parse the Tables from a Website with Python pandas

A quick video, of 3 minutes, that shows you how it works.

If you don’t have pandas installed you’ll have to install it and lxml, otherwise you’ll get an error:

  File "/home/carles/Desktop/code/carles/blog.carlesmateo.com-source-code/venv/lib/python3.8/site-packages/pandas/io/html.py", line 872, in _parser_dispatch
    raise ImportError("lxml not found, please install it")
ImportError: lxml not found, please install it

You can install both from PyCharm or from command line with:

pip install pandas
pip install lxml

And here the source code:

import pandas as pd


if __name__ == "__main__":

    # Do not truncate the data when printing
    pd.set_option('display.max_colwidth', None)
    # Do not truncate due to length of all the columns
    pd.set_option('display.max_columns', None)
    pd.set_option('display.max_rows', None)
    pd.set_option('display.width', 2000)
    # pd.set_option('display.float_format', '{:20,.2f}'.format)

    o_pd_my_movies = pd.read_html("https://blog.carlesmateo.com/movies-i-saw/")
    print(len(o_pd_my_movies))

    print(o_pd_my_movies[0])

RAB El nou món digital 2022-07-18 [CA|EN]

Aquest és el guió per al proper programa El nou món digital a Ràdio Amèrica Barcelona, que s’emet els Dilluns a les 14:30 Ireland Time / 15:30 Zona horària Catalunya / 06:30 Pacific Time.

Disclaimer: Treballo per a Activision Blizzard. Totes les opinions són meves i no representen cap companyia.


This is the excerpt of my radio program at Radio America Barcelona that airs on Mondays 14:30 Irish Time / 15:30 Catalonia Time / 06:30 Pacific Time.

Disclaimer: I work for Activision Blizzard. Opinions are my own. My opinions do not represent any company.

Aquesta és la pàgina del programa del Dilluns 18 de Juliol de 2022 amb la grabació en vídeo, en directe, i una secció extesa.

This is the page for today’s program, July 18th 2022. A video in English will be uploaded ASAP.

Avui duia una samarreta dels Catarres, que me la van signar a un concert a Irlanda, a Dublin. Us deixo una cançó que m’agrada d’ells.

Today I was wearing a t-shirt from “els Catarres”, a Catalan band. They signed it for me in a concert in Dublin, Ireland. I share one of their songs, which I like.

Seguretat

  • Parlem una mica, debatent, sobre problemes de seguretat i com els oients poden protegir-se:
  • Estafadors que truquen i es fan passar pel servei de salut per a capturar dades o per a fer-te baixar un programa.
  • La Mariel comentava la setmana passada sobre la notícia de la vanguardia que diu que l’estat espanyol lidera les posicions (de víctimes) de robatori d’informació.
    • Vull comentar que no m’agrada la vanguardia perque és hispanocèntrica i sempre dóna les notícies en el marc mental de l’estat espanyol, i a mi m’interessen les notícies en el marc mental dels països catalans:
      • Què passa a Girona? I a Perpinyà? I a Xàtiva? I a l’Alguer? Què passa a Andorra?
      • Aquest és el marc mental de notícies que m’interessa.
      • Bandes que han desactivat a Barcelona i que aprofitant ho apretats que està la gent passaven lectors RFID per a aprovar vendes de menys de 30 €.
      • Contra això hi ha unes fundes que jo he regalat a la meva família i amics.
    • I per robatori d’informació vol dir número de tarja de crèdit, credencials per a accedir a la banca electrònica.
    • Cal matitzar que el 60% dels atacs provenen de Rússia.
    • I en molts casos, no ho diu la notícia però jo ho sé, de la Xina.
    • Bàsicament indrets on és molt difícil perseguir als delinqüients.
    • Sobretot ataquen per correu electrònic i SMS fingint ser missatges del banc
    • De nou us recordo els perills d’emprar software pirata, i us recomano que tingueu sempre la càmera del portàtil coberta amb una pestanyeta.
    • Veiem què passa a Catalunya, segons informa Vilaweb:
      • Un grup d’estafadors informàtics ha robat 8 milions d’euros a entitats públiques catalanes com ara ajuntaments, consells comarcals i hospitals: la banda es va apropiar de més de mig milió d’euros del Servei Català de Trànsit (SCT), 544.320 de l’Ajuntament de Viladecans, 498.620 de l’Hospital de Sant Pau i 481.403 euros del Consell Comarcal del Baix Ebre
      • Van fer servir enginyeria social (es van fer passar per un proveïdor)
      • https://www.vilaweb.cat/noticies/estafadors-roben-vuit-milions-institucions-catalanes/
  • Una nova estafa que he rebut al meu mòbil via SMS
    • Explota el fet que Anglaterra està cobrant aleatòriament custom taxes (frontera)
    • Fixeu-vos que la url intenta enganyar fent creure que és anpost.ie però en realitat el domini és ie-postage-pay-fee.com
    • Podeu fer una cerca del domini a whois i veureu que el domini s’ha create fa quatre dies i que el propietari no és correu d’Irlanda AnPost, si no una persona individual amb un email de gmail.
  • Un típic email d’estafa dels clàssics, de tota la vida que també vaig rebre a l’email:
Scam

Nous Gadgets i Nerd Culture

Entreteniment i videojocs

  • Ja és aquí! Resident Evil!
  • Està previst que a final d’anys surti Return to Monkey Island’s. Pels nostàlgics.
    • Al site es pot veure al creador a la presó, i a través d’uns diàlegs explica que l’han posat a presó per una estafa relacionada amb NFTs.

Trucs sobre idiomes

  • L’anglès: llanceu-vos. Tinc companys que porten més de 10 anys a Irlanda, i segueixen tenint accent. Que no us aturi això. Hi ha varietats d’accents al món. I a Irlanda parlem l’Hiberno English.
  • Traductor gratuït: Google Translate

Preus / Ofertes

Actualitat

  • Amazon començarà a probar l’entrega amb drones (Amazone Air Prime) a Texas
    • Els temps d’entrega són uns 30 minuts.
    • A molts indrets d’USA i Irlanda la gent viu en cases amb jardí, i aquest sistema és ideal.
https://www.youtube.com/watch?v=98BIu9dpwHU

Programes anteriors

Programa anterior: RAB El nou món digital 2022-07-11 [CA|EN]

Tots els programes: RAB

Video: How to create a Docker Container for LAMPP step by step

How to create a Docker Container for Linux Apache MySQL PHP and Python for beginners.

Note: Containers are not persistent. Use this for tests only. If you want to keep persistent information use Volumes.

Sources: https://gitlab.com/carles.mateo/blog.carlesmateo.com-source-code/-/tree/master/twitch/live_20220708_dockerfile_lamp

File: Dockerfile

FROM ubuntu:20.04

MAINTAINER Carles Mateo

ARG DEBIAN_FRONTEND=noninteractive

RUN apt update && \
    apt install -y vim python3-pip &&  \
    apt install -y net-tools mc vim htop less strace zip gzip lynx && \
    apt install -y apache2 mysql-server ntpdate libapache2-mod-php7.4 mysql-server php7.4-mysql php-dev libmcrypt-dev php-pear && \
    apt install -y git && apt autoremove && apt clean && \
    pip3 install pytest

RUN a2enmod rewrite

RUN echo "Europe/Ireland" | tee /etc/timezone

ENV APACHE_RUN_USER  www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR   /var/log/apache2
ENV APACHE_PID_FILE  /var/run/apache2/apache2.pid
ENV APACHE_RUN_DIR   /var/run/apache2
ENV APACHE_LOCK_DIR  /var/lock/apache2
ENV APACHE_LOG_DIR   /var/log/apache2

COPY phpinfo.php /var/www/html/

RUN service apache2 restart

EXPOSE 80

CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]

File: phpinfo.php

<html>
<?php

// Show all information, defaults to INFO_ALL
phpinfo();

// Show just the module information.
// phpinfo(8) yields identical results.
phpinfo(INFO_MODULES);
?>
</html>

File: build_docker.sh

#!/bin/bash

s_DOCKER_IMAGE_NAME="lampp"

echo "We will build the Docker Image and name it: ${s_DOCKER_IMAGE_NAME}"
echo "After, we will be able to run a Docker Container based on it."

printf "Removing old image %s\n" "${s_DOCKER_IMAGE_NAME}"
sudo docker rm "${s_DOCKER_IMAGE_NAME}"

printf "Creating Docker Image %s\n" "${s_DOCKER_IMAGE_NAME}"
# sudo docker build -t ${s_DOCKER_IMAGE_NAME} . --no-cache
sudo docker build -t ${s_DOCKER_IMAGE_NAME} .

i_EXIT_CODE=$?
if [ $i_EXIT_CODE -ne 0 ]; then
    printf "Error. Exit code %s\n" ${i_EXIT_CODE}
    exit
fi

echo "Ready to run ${s_DOCKER_IMAGE_NAME} Docker Container"
echo "To run in type: sudo docker run -p 80:80 --name ${s_DOCKER_IMAGE_NAME} ${s_DOCKER_IMAGE_NAME}"
echo "or just use run_in_docker.sh"

echo
echo "If you want to debug do:"
echo "docker exec -i -t ${s_DOCKER_IMAGE_NAME} /bin/bash"

Solving Linux Load key “ssh_yourserver”: invalid format when provisioning from Jenkins

If you are getting an error like this when you try to provision using rsync or running commands from SSH from a Docker Instance from a worker node in Jenkins, having your SSH Key as a variable in Jenkins, here is a way to solve it.

These are the kind of errors that you’ll be receiving:

Load key "ssh_yourserver": invalid format

web@myserver.carlesmateo.com: Permission denied (publickey).

rsync: connection unexpectedly closed (0 bytes received so far) [sender]

rsync error: unexplained error (code 255) at io.c(235) [sender=3.1.3]

script returned exit code 255

So this applies if you copied your .pem file as text and pasted in a variable in Jenkins.

You’ll find yourself with the load key invalid format error.

I would suggest to use tokens and Vault or Consul instead of pasting a SSH Key, but if you need to just solve this ASAP that’s the trick that you need.

First encode your key with base64 without any wrapping. This is done with this command:

cat keys/key_azure_myserver_carlesmateo_com.pem | base64 --wrap=0

In your Jenkins steps you’ll add this code:

#!/bin/bash
echo "Creating credentials"
echo $SSH_YOURSERVER | base64 --decode > ssh_yourserver
echo "Setting permissions"
chmod 600 ssh_yourserver

Having a certificate then you can define new steps that will deploy to Production by rsyncing:

#!/bin/bash
echo "Deploying www..."
rsync -e "ssh -i ssh_carlesmateo -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" -av --progress --exclude={} --stats --human-readable -z www/ web@myserver.carlesmateo.com:/var/www/myawesomeproject/www/

Note that in this case I’m ignoring Strict Host Key Checking, which is not the preferred option for security, but you may want to use it depending on your strategy and characteristics of your Cloud Deployments.

Note also that I’m indicating as User Known Hosts File /dev/null. That is something you may want to have is you provision using Docker Containers that immediately destroyed after and Jenkins has not created the user properly and it is unable to write to ~home/.ssh/known_hosts

I mention the typical errors where engineers go crazy and spend more time fixing.