Skip to content

2020

Install and connect to a Raspberry Pi without monitor

The purpose of this post is to briefly show how to install the Raspberry Pi OS into a new microSD card using a laptop or desktop. Then boot the Raspberry Pi with this microSD card.

The Raspberry Pi will automatically connect to your wifi and the ssh tcp/22 service should be running, which will allow you to connect via ssh.

No need for a monitor to be connected to the Raspberry Pi.

Using the laptop or desktop, in the command line, the dd command will copy the Raspberry Pi OS into the microSD card.

After the dd command, 2 files need to be added to the /boot folder in the microSD card.

- One empty file named `ssh`

- One file named `wpa_supplicant.conf` with your wireless configuration

example for the wpa_supplicant.conf file

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB

network={
scan_ssid=1
ssid="MY_WIFI_NAME"
psk="MY_WIFI_PASSWORD"
}

Note

If you have multiple wlan interfaces, you can use one file per interface, for example wpa_supplicant-wlan1.conf


Step-by-step detail

Step 1 - Download

Step 2 - Unzip

Step 3 - Copy

  • Copy the Raspberry Pi OS into the microSD card.

  • Make sure there are no mount folders.

unmount micro sd card to install raspberry pi

IMPORTANT - the dd command will delete everything in the microSD card - make sure you know what you are doing! Otherwise, stop here or follow the official guidance here.

I am using the dd command.

sudo dd bs=1m if=path_of_your_image.img of=/dev/rdiskN; sync

  • Example of my dd command running
dd bs=1m if=2020-08-20-raspios-buster-armhf-lite.img of=/dev/rdisk2; sync
1760+0 records in
1760+0 records out
1845493760 bytes transferred in xxxxxxx secs (xxxxxxx bytes/sec)

Step 4 - add files into the boot folder

After the copy, the first partition in the microSD card is usually automatically mounted /boot.

Now, all I need to do is to copy the files that I already have on my laptop into this /boot folder.

I just have to drag-and-drop (or copy and paste) then into the /boot folder.

  • One empty file named ssh

    ssh

  • One file named wpa_supplicant.conf with your wireless configuration

country=GB
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
scan_ssid=1
ssid="MY_WIFI_NAME"
psk="MY_WIFI_PASSWORD"
}

if you cannot copy the files, why not use the command line?

cd /Volumes/boot

touch ssh

vim wpa_supplicant.conf << and add the content in here

Power on Raspberry PI Conclusion

And that's it :)

Now, eject the microSD card from your laptop, put it in the Raspberry Pi and on boot the Raspberry Pi, it should connect to your wifi.

To connect via ssh you need to find the ip address that was allocated to the Raspberry Pi.

Usually, you can easily find the ip address in your home router connected devices.

Alternativelly, if you have nmap installed your your laptop (or on another Raspberry Pi), you can scan your network for devices with tcp/ssh port 22 open.

example for the nmap command


{% highlight bash %}

searching for new device on local network

nmap -sT -p22 --open 192.168.1.0/24 # ( CHANGE FOR YOUR OWN SUBNET)

(...) Nmap scan report for raspberrypi.home.local (192.168.1.238)
Host is up (0.042s latency). (...)

Connect to raspberrypi.home.local

ssh [email protected]

default username pi default password rasbperry

Change pi default password

pi@raspberrypi:~ $ sudo passwd pi New password: Retype new password: passwd: password updated successfully

Update and configure for your needs

pi@raspberrypi:~ $ sudo raspi-config

{% endhighlight %}

sudo-raspi-config.png

For example, change hostname, update config for your needs, check my other post on category raspberry-pi



Happy learning,

Antonio.Cloud

How to reinstall MacOS with an external bootable disk

  • Update 2022-10 > Apple now has a page with download to all versions in here https://support.apple.com/en-gb/HT211683 > "Apple recommends using the latest (newest) macOS that is compatible with your Mac"

How to reinstall MacOS with an external bootable disk installer for Mac operating system. macOS Catalina, macOS Mojave, or macOS High Sierra. You can use an external drive or secondary volume as a startup disk from which to install the Mac operating system.

This article was inspired after I helped a friend recover their Mac operating system and documents. Having an external drive with macOS help and did a quick install. external-disk-with-various-macOS-versions

After installing from an offline version, do run the Apple software update to get the latest updates and versions. You can also run from the command line sudo softwareupdate -ai.

The purpose of this post is to share the links from support.apple.com for the installation of the various Mac operating system versions.


How to create a bootable installer for macOS


How to upgrade to macOS Catalina


How to upgrade to macOS High Sierra


How to upgrade to macOS Mojave

  • https://support.apple.com/en-gb/HT210190

How to upgrade to OS X El Capitan

https://support.apple.com/en-gb/HT206886


How to reinstall macOS from macOS Recovery


Always have a backup of your data. Use at your own responsibility and happy learning,


Happy learning

Antonio Feijao UK

AWS EC2 userdata sample script to build an Webpage

Sample of an AWS EC2 userdata script that installs apache and automatically creates an index.html file as a landing webpage with information about the instance - instanceId, availabilityZone, instanceType and region. This could also be used with launch configuration on an Auto Scaling Group (ASG) to use as multiple instances on Elastic Load Balancing load balancer (ALB) to easy show the usage of multiple instances behind the load balancer.

At your own risk, always review what you are running.

To run this userdata script, add the below into the EC2 userdata

#!/bin/bash
curl https://raw.githubusercontent.com/AntonioFeijaoUK/aws-ec2-userdata-samples/master/sample01-hello-world-region-az.sh | bash

Repository is here https://github.com/AntonioFeijaoUK/aws-ec2-userdata-samples

Direct link is here https://raw.githubusercontent.com/AntonioFeijaoUK/aws-ec2-userdata-samples/master/sample01-hello-world-region-az.sh

Other samples on AWS

If you tried it and helped you understand better how it works, please leave a comment.


Happy learning

Antonio Feijao UK

Level of IQ of the smartest people on Earth

See this list of the smartest people ever on Earth, listed by their level of IQ! With links to Wikipedia to read more about these genius. The purpose of this list is to inspire others and myself. Smartness will be determined by IQ number. IQ does not calculate intelligence. Someone who does badly at IQ tests can be brilliant at other things, like arts, playing music, and dancing.


Stephen Hawking

  • Stephen Hawking - possible - IQ of 160, but probably closer to IQ of 180

Stephen Hawking

  • https://en.wikipedia.org/wiki/Stephen_Hawking

  • Born 8 January 1942, Oxford, England, United Kingdom

  • Died 14 March 2018 (aged 76), Cambridge, England, United Kingdom

  • 1 in 10.000 people have his IQ

  • Discovered many things about black holes, like black holes could die by leaking energy
  • Working with other scientists, we invented important theories about the Big Bang

Albert Einstein

  • Albert Einstein - estimated - IQ from 160 to 190, so the middle would be IQ of 175, but probably he had more

Albert Einstein

  • https://en.wikipedia.org/wiki/Albert_Einstein

  • Born 14 March 1879, Ulm, Kingdom of Württemberg, German Empire

  • Died 18 April 1955 (aged 76), Princeton, New Jersey, United States

  • 1 in 700.000 people have his IQ

  • Probably the most famous scientist ever
  • Known for this Theory of Relativity
  • The equation E = mc^2 - (Energy = mass multiplied by square of speed-of-light)
  • Jewish, escape from Germany
  • When nazis came in to power, Germany was in the process of making a nuclear weapon. He wrote a letter to the US recommending to make a nuke.
  • Later, Einstein regretted working on the Bomb (Nuclear Bomb)

Bobby Fischer

  • Bobby Fischer - possible - IQ of 180

Bobby Fischer

  • https://en.wikipedia.org/wiki/Bobby_Fischer

  • Born March 9, 1943, Chicago, Illinois, US

  • Died January 17, 2008 (aged 64), Reykjavík, Iceland

  • 1 in 3.500.000 people have his IQ

  • The most known chess players of all time
  • During Cold War, Soviets and USA organised a chess match between Boris Spassky (best Soviet Player) and Bobby Fischer. A battle to show which country was superior
  • Bobby won
  • After this match, Bobby stopped playing public chess for decades

Galileo Galilei

  • Galileo Galilei - estimated - IQ close to 185

Galileo Galilei

https://en.wikipedia.org/wiki/Galileo_Galilei

  • Born 15 February 1564, Pisa, Duchy of Florence
  • Died 8 January 1642 (aged 77), Arcetri, Grand Duchy of Tuscany

  • 1 in 18.000.000 people have his IQ

  • Galileo lived many years ago, the IQ level is based on the age in which he started walking, talking, reading and performing various tasks
  • Galileo is know as the "Father of modern astronomy"
  • Made a Telescope (however, he did not invented it)
  • Zoom 30 times with the telescope and observed the skies doing many discoveries
  • Religious inquisition almost killed him for claiming that Earth goes around the Sun

Garry Kasparov

  • Garry Kasparov - estimated - IQ of about 187

Garry Kasparov

https://en.wikipedia.org/wiki/Garry_Kasparov

  • Born 13 April 1963 (age 56), Baku, Azerbaijan SSR, Soviet Union (now Baku, Azerbaijan)

  • 1 in 37.000.000 people have his IQ

  • Garry Kasparov is one of the best chess players of all time
  • Ranked world number 1 chess player for 225 out of 228 months
  • Scientists created a chess computer name Deep Blue
  • Deep Blue computer was capable of evaluating 200.000.000 chess positions per second
  • Garry Kasparov still managed to win a few rounds
  • Youngest ever undisputed world chess champion in 1985 at age of 22

Isaac Newton

  • Isaac Newton - estimated - IQ at 190

Isaac Newton

  • Isaac Newton

  • Born 4 January 1643 [O.S. 25 December 1642], Woolsthorpe-by-Colsterworth, Lincolnshire, England

  • Died 31 March 1727 (aged 84) [O.S. 20 March 1726], Kensington, Middlesex, England

  • 1 in 107.000.000 people have his IQ

  • Most influential scientist ever
  • Isaac Newton three laws of motion still remain excellent approximations at the scales and speeds of everyday life
  • He made those laws 200 years ago
  • Gravity is less enigmatic thanks to him
  • Back in the day people believed that everything falls on earth, Isaac Newton believed that all object attracted each other
  • Isaac Newton proved that all the planets were held in place by the sun's gravity

Christopher Langan

  • Christopher Langan - estimated - IQ of 202

https://upload.wikimedia.org/wikipedia/commons/7/71/ChrisLanganP.png

  • https://en.wikipedia.org/wiki/Christopher_Langan

  • Born March 25, 1952, San Francisco, California, U.S.

  • 1 in 10.000.000.000 people have his IQ

  • In 1999, as part of an interview, langan did an IQ test which was provided by neuropsychologist
  • Works as a Horse Rancher
  • Develop a "Theory of the relationship between mind and reality"
  • Proven the existence of God after defining what God really is.

Following people are so smart that they make IQ scoring obsolete


Johann Wolfgang Von Goethe

  • Johann Wolfgang Von Goethe - estimated - IQ of 205

Johann Wolfgang Von Goethe

  • https://en.wikipedia.org/wiki/Johann_Wolfgang_von_Goethe

  • Born 28 August 1749, Free Imperial City of Frankfurt, Holy Roman Empire

  • Died 22 March 1832 (aged 82), Weimar, Grand Duchy of Saxe-Weimar-Eisenach, German Confederation

  • Johann is one of the best writers in history

  • The course of his works, he uses 90.000 words, almost three times Shakespeare's total
  • He was also very quick, could do a poem in a matter of minutes
  • Studied Natural Science
  • Wrote several works on morphology and colour theory
  • He was everywhere and what he did, he did it almost perfectly

Leonardo da Vinci

  • Leonardo da Vinci - estimated - IQ of 220

Leonardo da Vinci

  • https://en.wikipedia.org/wiki/Leonardo_da_Vinci

  • Born 14/15 April 1452, Vinci, Republic of Florence (present-day Italy)

  • Died 2 May 1519 (aged 67), Clos Lucé, Amboise, Kingdom of France

  • There are sceptics with reasonable reasons to disagree with this IQ level

  • People you can paint as good as Leonardo, shows high intellect, attention to details and good visualisation
  • Leonardo also is renowned in the fields of Civil Engineering, Chemistry, Geology, Geometry, Hydrodynamics, Mathematics, Mechanical Engineering, Optics, Physics, Pyrotechnics and Zoology
  • Leonardo conceived ideas vastly ahead of his own time, like parachute, helicopter, armoured fighting vehicle (tank) and many more numerous ideas

Marilyn Vos Savant

  • Marilyn Vos Savant IQ of 228

Marilyn Vos Savant

Photo credits

  • https://en.wikipedia.org/wiki/Marilyn_vos_Savant

  • Born August 11, 1946, St. Louis, Missouri, U.S.

  • Arguable the smartest woman

  • Listed in the Guinness Book of records for having the highest IQ of 228
  • American magazine columnist, author, lecturer and playwright
  • Solved some science problems like Monty Hall problem
  • Held a membership in a secret hight intelligence society called Mega Society
  • only 1 in 1.000.000 people can pass the test and become a member

Terence Tao

  • Terence Tao IQ of 230

Terence Tao

  • https://en.wikipedia.org/wiki/Terence_Tao

  • Born 17 July 1975, Adelaide, South Australia

  • Today, the person with highest IQ of 230 is Terence Tao

  • Extraordinary mathematical abilities from an early age
  • Attended university-level mathematics courses at the age of 9
  • Won Mathematics Olympiad gold medal at age of 12
  • Become University Professor at the age of 24 at UCLA
  • Remains the youngest person ever appointed to that rank by the institution
  • Accomplished many things in mathematics

Nikola Tesla

  • Nikola Tesla - estimated - IQ of 235

Nikola Tesla

  • https://en.wikipedia.org/wiki/Nikola_Tesla

  • Born 10 July 1856, Smiljan, Austrian Empire (modern-day Croatia)

  • Died 7 January 1943 (aged 86), New York City, United States

  • The myth, the legend, the icon

  • True or not true story, someone asked Albert Einstein "How it felt to be the smartest man on Earth", and Einstein answered "I would not know. Ask Nikola Tesla"
  • Tesla was ahead of time, some of his ideas and solutions are still a mystery
  • Discovered the Alternating current, which is cheaper to transport than direct current
  • Constructed the first Hydro-electric Power Plant
  • Discovered X-rays, later implemented in the medical field
  • Concept of making wireless transmission of electricity
  • Unfortunately, he did not have limitless funding
  • Alva Edison were minding their own business

"If you want to find the secrets fo the Universe, think in terms of energy, frequency and vibration." - Nikola Tesla


Carl Gauss

  • Carl Gauss - believed to be - IQ from 250 to 300

Carl Gauss

  • https://en.wikipedia.org/wiki/Carl_Friedrich_Gauss

  • Born 30 April 1777, Brunswick, Principality of Brunswick-Wolfenbüttel

  • Died 23 February 1855 (aged 77), Göttingen, Kingdom of Hanover, German Confederation

  • One of the greatest mathematicians of all time is Carl Gauss

  • When he was 3 years old, he told his father that he had incorrectly measured something on his complicated payroll and he was right
  • Taught himself to read
  • Made numerous contributions with Number Theory, Geometry, Probability Theory, Planetary Astronomy, The THeory of Functions and Potential Theory.
  • Solved many mathematical problems, one of the problems stymied mathematicians for 2.000 years, Carl Gauss solved it in few months

William James Sidis

  • William James Sidis IQ of 275

William James Sidis

  • https://en.wikipedia.org/wiki/William_James_Sidis

  • Born April 1, 1898, Manhattan, New York City, New York, United States

  • Died July 17, 1944 (aged 46), South Boston, Boston, Massachusetts, United States

  • When someone says "Child Prodigy", this is the man that should come to your mind

  • Entered Harvard at age 11
  • Able to speak in about 25 languages and dialects
  • By age 8 he even constructed his own languange
  • At young age he lectured Harvard Mathematical Club on 4-Dimensional Bodies
  • It looked like he would become a famous scientist but later he went to seclusion
  • He hated the attention
  • It makes sense, people that smart feel alone in the society
  • In his book "The animate and the inanimate" he kind predicted Black Holes
  • Book link https://en.wikipedia.org/wiki/The_Animate_and_the_Inanimate

Millenniums Problems

If you think you are smart, if you solve 1 millennium problem, you will get 1.000.000 $(not by me, though!)

Currently, there are 7 problems

  • P vs. NP Problem
  • Riemann Hypothesis
  • Yang-Mills and Mass Gap
  • Navier-Stokes Equation
  • Hodge Conjecture
  • Poincaré Conjecture
  • Birch and Swinnerton-Dyer Conjecture

Grigori Perelman

Grigori Perelman

  • Born 13 June 1966, Leningrad, Soviet Union

Grigori_Perelman solved one of the problems, the Poincaré Conjecture

It took years for many mathematicians to understand his solutions

He was offered 1 million dollars and fields medal for it but he said no thanks

He just went back to live with his mother in St Peterburg


Additional notes

I hope you find this post inspirational.

Other areas to explore could be STEAM_fields, which are defined science, and technology, interpreted through engineering, and the (liberal) arts, and based in mathematics.


Credits

Build this list with inspiration from the video https://youtu.be/Drzz7Ayzij0 by MR SLAV.

Images from wikipedia.org


Happy learning

Antonio Feijao UK

linux-command-tee-examples-how-it-works

tee command in Linux command line, how tee works, simple explanations.

The tee command has an input on the and one or more exists or outputs.

Output to a file or more, or another command AND output to the screen.

cat SAMPLE_FILE | tee > this_file.log

INPUT >>> ----|-----  >>> output_file1 output_file2 output_file3 OR/AND | output_to_another_command
              |
              |
              |
              |
              |

              also >>>> output_to_screen (unless you `2>/dev/null` (TBC?!) )

Happy learning

Antonio Feijao UK

linux-command-xargs-for-parallel-execution

xargs command can be used to "speed up" Linux commands by running the same command multiple times in parallel.

WORK IN PROGRESS

cat FILE_WITH_COMAMND_OR_WHATEVER | xargs -n1 -P10

-n1 reads one line at a time

-P10 runs up to 10 parallel commands


Happy learning

Antonio Feijao UK

practice-python-3-with-the-fibonacci-sequence

Learn Python with a simple "do it yourself" challenges. I went to bed thinking "how could I do the Fibonacci sequence without looking on the internet. Next day, getting python skills into practice, I came up with the below basic python code:

In mathematics, the Fibonacci numbers form a sequence called the Fibonacci sequence. Each number is the sum of the two preceding ones, starting from 0 and 1.

Thought I would share this challenge in case there is someone out there looking to practice Python 3 as weel. This is a simple and fun challenge. Try not to copy this code, create your own version, start simple, maybe just add numbers, then add the conditions while loop.

python fibonacci sequence

No matter how we present these numbers, it always seems to be impressive. Maybe that is why they are also known as the "gold ratio".

Learn more about the Fibonacci numbers and sequence in this wikipedia page.

Let me know if this was useful.


Happy learning

Antonio Feijao UK

yum-provide-which-package-contains-the-command

See how to find the package you will need to install for the command you are looking for. Example, I was looking for the tshark command, but a simple yum search tshark was not returning any results. See how I found the linux command.

I ran this on a EC2 instances Amazon Linux v2, I wanted to run the command tshark but this was not available.

So, I searched for it with yum search tshark and package was not found.

A did quick research online and found in here a command that almost got forgotten!

yum whatprovides {COMMAND}

I decided to write this article to remind me of this command and it might be useful for you too.

yum whatprovides tshark

Try with other commands. Was this useful to you?


Happy learning

Antonio Feijao UK

docker-images-and-containers-start-with-basic-and-bonus-advanced-security

Docker images and containers start with basic and bonus advanced security Docker logo

Sample basic command for Docker containers and images

docker --help - list the help options for docker command

docker run --help - list the help option for docker run command

docker images - list your local docker images

docker ps - list local running docker containers

docker ps -a - list local running OR stopped docker containers

docker rm f66ae9b25d96 - remove docker container with ID f66ae9b25d96

docker run --rm centos:7 tail -f /dev/null - runs a docker container from image centos:7, keeps container running with tail -f /dev/null command

docker exec -it 513ee56fde09 /bin/sh - interactive shell on the container that is running

docker exec -it -u root 8891619cbcf0 /bin/sh - interactive shell with sudo privileges (NOT RECOMMENDED, security risk)

docker kill 513ee56fde09 - kill (stops) the docker container that was running

docker run ubuntu - runs a docker container with version ubuntu. It will download the docker image ubuntu:latest from docker-hub if it does not find it locally in the machine.

docker pull amazonlinux - updates the local docker images named `

docker commit 3808b8454239 centos-suresh:v01 - save current container with a image, which you can run more containers after

(...)


Bonus advanced security with Docker containers and images

chroot

unshared

....


Happy learning

Antonio Feijao UK