Skip to content

Home

Raspberry Pi 4 testing USB Wireless

Raspberry Pi 4 USB Wireless dongles that work out-of-the-box

Tested on Raspberry Pi 4 with Linux version 5.10.59-v7l+

dmesg | grep "Machine model"
[    0.000000] OF: fdt: Machine model: Raspberry Pi 4 Model B Rev 1.1


cat /proc/version
Linux version 5.10.59-v7l+ (dom@buildbot) (arm-linux-gnueabihf-gcc-8 (Ubuntu/Linaro 8.4.0-3ubuntu1) 8.4.0, GNU ld (GNU Binutils for Ubuntu) 2.34) #1447 SMP Thu Aug 19 12:25:41 BST 2021

Hercules USB dongle - DID worked out-of-the-box

usb 1-1.3: new high-speed USB device number 3 using xhci_hcd
usb 1-1.3: New USB device found, idVendor=06f8, idProduct=e033, bcdDevice= 2.00
usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.3: Product: 802.11n WLAN Adapter
usb 1-1.3: Manufacturer: Realtek
usb 1-1.3: SerialNumber: 00e04c000001
rtl8192cu: Chip version 0x10
rtl8192cu: Board Type 0
rtl_usb: rx_max_size 15360, rx_urb_num 8, in_ep 1
rtl8192cu: Loading firmware rtlwifi/rtl8192cufw_TMSC.bin
ieee80211 phy1: Selected rate control algorithm 'rtl_rc'
usbcore: registered new interface driver rtl8192cu
rtl8192cu: MAC auto ON okay!
rtl8192cu: Tx queue select: 0x05



lsusb  | grep Realtek
Bus 001 Device 003: ID 06f8:e033 Guillemot Corp. Hercules HWNUp-150 802.11n Wireless N Pico [Realtek RTL8188CUS]


lsusb -t

/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 480M
        |__ Port 3: Dev 3, If 0, Class=Vendor Specific Class, Driver=rtl8192cu, 480M


iwconfig wlan1
wlan1     IEEE 802.11  ESSID:off/any
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm
          Retry short limit:7   RTS thr=2347 B   Fragment thr:off
          Encryption key:off
          Power Management:off
usb 1-1.2: new high-speed USB device number 4 using xhci_hcd
usb 1-1.2: New USB device found, idVendor=2357, idProduct=012d, bcdDevice= 2.10
usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.2: Product: 802.11ac NIC
usb 1-1.2: Manufacturer: Realtek
usb 1-1.2: SerialNumber: 123456


lsusb | grep TP
Bus 001 Device 004: ID 2357:012d TP-Link

lsusb -t

 Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=, 480M


iwconfig
# show no new interface as it does not have drivers for it...

Wifi AC - did NOT work out-of-the-box

usb 1-1.1: USB disconnect, device number 5
usb 1-1.3: new high-speed USB device number 6 using xhci_hcd
usb 1-1.3: New USB device found, idVendor=0bda, idProduct=c811, bcdDevice= 2.00
usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1.3: Product: 802.11ac NIC
usb 1-1.3: Manufacturer: Realtek
usb 1-1.3: SerialNumber: 123456


lsusb
Bus 001 Device 006: ID 0bda:c811 Realtek Semiconductor Corp.

lsusb -t
 Port 3: Dev 6, If 0, Class=Vendor Specific Class, Driver=, 480M

 iwconfig
# show no new interface as it does not have drivers for it...

testing drivers - https://github.com/cilynx/rtl88x2bu

or follow these instructions https://thepihut.com/blogs/raspberry-pi-tutorials/how-to-setup-a-rtl881cu-usb-wifi-adapter-with-the-raspberry-pi-4

this didn't work for me...

sudo apt install git bc dkms

mkdir usb-wifi-drivers

cd usb-wifi-drivers

git clone https://github.com/whitebatman2/rtl8821CU

cd rtl8821CU


## edit Makefil and update/change for your Raspberry Pi

vim Makefile

look for section 

###################### Platform Related #######################

## update for your "Platform", example below for Raspberry Pi 4

CONFIG_PLATFORM_I386_PC = n
CONFIG_PLATFORM_ARM_RPI = y
CONFIG_PLATFORM_ARM_RPI3 = n

Happy learning

Antonio Feijao UK

Micro-SD cards write speed test

While copy the Raspberry Pi image into a couple of micro-sd cards using the method "setting up a headless raspberry pi" (link below),

source https://www.raspberrypi.org/documentation/computers/configuration.html#setting-up-a-headless-raspberry-pi

I noticed the different speeds writes betweek micro-sd cards, therefore, create this post to list their writing speed.


diskutil list

diskutil unmountDisk /dev/disk4


sudo dd bs=1m if=2021-05-07-raspios-buster-armhf-lite.img of=/dev/rdisk4 ; sync


touch /Volumes/boot/ssh

touch /Volumes/boot/wpa_supplicant.conf

#vim /Volumes/boot/wpa_supplicant.conf

cat <<EOF > /Volumes/boot/wpa_supplicant.conf
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"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

EOF

cat /Volumes/boot/wpa_supplicant.conf

diskutil list

sudo diskutil eject /dev/rdisk4

micro-sd card write speed results

sd-card - Sandisk Extreme 32 GB, V30, [3] A1
1874853888 bytes transferred in 26.577356 secs (70543281 bytes/sec) - 70.54 MB/sec

sd-card - Lexar 1000x, 32 GB [3]
1874853888 bytes transferred in 40.834400 secs (45913590 bytes/sec) - 45.91 MB/sec

sd-card - Lexar 633x, 32 GB [1]
1874853888 bytes transferred in 105.653969 secs (17745229 bytes/sec) - 17.74 MB/sec

sd-card - ScanDisk Ultra, 16 GB, A1 (10)
1874853888 bytes transferred in 138.986259 secs (13489491 bytes/sec) - 13.48 MB/sec

sd-card - Sandisk Ultra, 64 GB, (10)
1874853888 bytes transferred in 258.922797 secs (7240976 bytes/sec) - 7.24 MB/sec


Happy learning

Antonio Feijao UK

Project Raspbery Pi running Router DHCP NAT Access Point DNS Block advertising VPN

Project-raspberry-pi-router-dhcp-nat-access-point-dns-block-ads-vpn.md

Please note:

This post is still in "WORK IN PROGRESS" mode..

USE AT YOUR OWN RESPONSABILITY


Download latest Raspeberry Pi OS version


Copy Raspberry Pi OS into micro-sd card

diskutil list

(...)
/dev/disk4 (external, physical):  <<<<------- THAT IS MY EXTERNAL MICRO-SD CARD
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *31.9 GB    disk4
   1:             Windows_FAT_32 boot                    46.0 MB    disk4s1
   2:                      Linux                         31.9 GB    disk4s2

````

Unmount the disk

```bash

diskutil unmountDisk /dev/disk4
  Unmount of all volumes on disk4 was successful

After extracting the image file from the Raspberry Pi OS zip file,
copy it using dd command into the SD-card disk.

Note the /dev/rdisk4/, rdisk is the "raw disk", this speeds up the copying.

You can check my other post about micro-sd writing speed test in here https://antonio.cloud/linux/raspberry-pi/micro-sd-card-write-speed-test/.

sudo dd bs=1m if=2021-05-07-raspios-buster-armhf-lite.img of=/dev/rdisk4; sync

1788+0 records in
1788+0 records out
1874853888 bytes transferred in 27.184011 secs (68968994 bytes/sec)

Enable SSH and Wifi without monitor on Raspberry Pi

While I have the micro-sd card in the laptop, I want the Raspberry Pi to have SSH Server enabled and conncet to a wifi (wireless) network.

enable ssh and add wpa_supplicant.conf config file

Remeber to update for your settings, update for your wifi name, password and country.

In priority, then highest wins.

touch /Volumes/boot/ssh

touch /Volumes/boot/wpa_supplicant.conf

#vim /Volumes/boot/wpa_supplicant.conf

cat <<EOF > /Volumes/boot/wpa_supplicant.conf
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=GB

network={
        scan_ssid=1
        priority=5
        ssid="MY_WIFI_NAME"
        psk="MY_WIFI_PASSWORD"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

network={
        scan_ssid=1
        priority=0
        ssid="MY_OTHER_WIFI_NAME"
        psk="MY_OTHER_WIFI_PASSWORD"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        auth_alg=OPEN
}

EOF

additional extra Bonus step

disable IPv6

While in here, you can disable IPv6 for the Raspberry Pi.

add ipv6.disable=1 at the almost end of the file cmdline.txt , add it just before the ini=/.... script that will run on first boot.

vim /Volumes/boot/cmdline.txt

console=serial0,115200 console=tty1 root=PARTUUID=xxxxaxxxa-xx rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet ipv6.disable=1 init=/usr/lib/raspi-config/init_resize.sh
disable Bluetooth

and to disable Bluetooth, add the below to the end of config.txt file

vim /Volumes/boot/config.txt

# Disable Bluetooth
dtoverlay=disable-bt
unmountDisk

Then eject the "disk", the micro-sd card

diskutil eject /dev/disk4
  Disk /dev/disk4 ejected

Turn on your Raspberry PI connect via SSH and start the configurations

Insert the micro-sd card in the Raspberry Pi, turn the Raspberry Pi on and "look" for it on your router or look for a new device on your wifi (wireless) network.

Them, SSH into the Raspberry Pi and let the fun stuff (configurations) beggin!

I my case, I used nmap to find the new device on the network.

nmap -sT -p 22 --open 192.168.1.0/24

when you find your new device

ssh [email protected] <<--- IP of the new device, Raspberry Pi

Raspberry Pi default password if raspberry

1) As soon as you connect to the Raspberry Pi, change the default with sudo passwd pi command

sudo passwd pi

  New password:
  Retype new password:
  passwd: password updated successfully

2) Make sure your Raspberry Pi is up-to-date

sudo apt-get update
  (...)


sudo apt-get upgrade
  (...)

or shorter version if some extras

sudo su
#set +x

apt clean

apt update -y

apt full-upgrade -y

apt autoremove -y

apt install vim -y

add your favourite alias is you have some

 echo "alias ll='ls -alhF --group-directories-first --color=always'" >> /etc/bash.bashrc

 ```

Reboot and reconnect

3) Update the Raspberry Pi firmware (optional)

Update the Raspberry Pi firmware is option

```bash

sudo rpi-update

4) Use own Raspberry Pi config command

Review configurations and change what is meanful for you.

I recommend to give a name to the Raspberry Pi to meaninful.

sudo raspi-config

Reboot


Disable IPV6

(you can skip this steps if you did this on the "additional bonus step" mentioned above.)

https://www.raspberrypi.org/forums/viewtopic.php?t=256349

Add ipv6.disable=1 to the end of /boot/cmdline.txt file

Reboot


Disable Bluetooth

If you don't need Bluetooth, you can disable it and remove unnecessary files

config file

Edit the file /boot/config.txt and to the end the following

sudo vim /boot/config.txt

# Disable Bluetooth
dtoverlay=disable-bt

save and exit file

disable on systemctl

sudo systemctl disable hciuart.service
sudo systemctl disable bluealsa.service
sudo systemctl disable bluetooth.service

remove bluez files

apt purge bluez

Reboot


Install a second wifi devive

Just physically connect the additional external USB

additional drivers if required

Important

This is not the same for all the devices. You migh need to research the correct drivers for your specific device.

I followed these instructions - https://github.com/aircrack-ng/rtl8812au>

sudo apt-get install raspberrypi-kernel-headers

sudo apt install make gcc git

sudo apt install dkms

clone repository for driver rtl8812au

git clone -b v5.6.4.2 https://github.com/aircrack-ng/rtl8812au.git
cd rtl*

(....)

remaining instructions here - https://github.com/aircrack-ng/rtl8812au>


Setup one of the wireless devices as access Wireless Access Point

In this project I used the Raspberri Pi 4 onboard wireless as Access Point, device wlan0

  • wlan1 and eth0 will connect to the internet, eth0 gets priority

  • wlan0 will be the access point

for this, I used (and adopted to my setup) this guide https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md

sudo apt install hostapd

sudo systemctl unmask hostapd
sudo systemctl enable hostapd

sudo apt install dnsmasq

sudo apt install -y netfilter-persistent iptables-persistent

# sudo DEBIAN_FRONTEND=noninteractive apt install -y netfilter-persistent iptables-persistent

Wireless static IP for wlan0

Define the wireless interface IP configuration

sudo vim /etc/dhcpcd.conf

interface wlan0
    static ip_address=192.168.4.1/24
    nohook wpa_supplicant

Raspberry Pi with multiple wireless devices

Use one wpa_supplicant.conf file per device wlan0 and wlan1

ll /etc/wpa_supplicant/

-rwxr-xr-x  1 root root  937 Apr 16 14:07 action_wpa.sh*
-rw-r--r--  1 root root  25K Apr 16 14:07 functions.sh
-rwxr-xr-x  1 root root 4.6K Apr 16 14:07 ifupdown.sh*
-rw-------  1 root root  506 Aug 20 16:38 wpa_supplicant.conf
-rw-------  1 root root  496 Aug 20 16:37 wpa_supplicant-wlan0.conf
-rw-------  1 root root  477 Aug 20 16:35 wpa_supplicant-wlan1.conf

Enable wpa_supplicant service per device wlan0 and wlan1

systemctl enable [email protected]  
systemctl enable [email protected]  
systemctl disable wpa_supplicant.service  

systemctl start [email protected]  
systemctl start [email protected]  
systemctl stop wpa_supplicant.service  

systemctl status [email protected]  
systemctl status [email protected]  
systemctl status wpa_supplicant.service  


systemctl | grep wpa
[email protected]        loaded active running   WPA supplicant daemon (interface-specific version)
[email protected]        loaded active running   WPA supplicant daemon (interface-specific version)
system-wpa_supplicant.slice         loaded active active    system-wpa_supplicant.slice

Persistent wifi wireless device

Raspberry Pi, randomly the onboard wireles device wlan0 becomed wlan1, below was a solution to keep the Raspberry Pi wlan0 and wlan1 persistent across reboots.

source and thank you to https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=198946

cat /etc/udev/rules.d/72-wlan-geo-dependent.rules

# source
#      https://www.raspberrypi.org/forums/viewtopic.php?f=36&t=198946
#
##
#           +-----------------+
#           | 1-1.1.2 | 1-1.3 |
# +------+  +---------+-------+
# | eth0 |  | 1-1.1.3 | 1-1.2 |
# +------+  +-----------------+ (RPI USB ports with position dependent device names for up to 4 optional wifi dongles)
#
#
# | wlan0 | (onboard wifi)
#
ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="sdio", KERNELS=="mmc1:0001:1", NAME="wlan0"
ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb",  KERNELS=="1-1.1.2",     NAME="wlan1"
ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb",  KERNELS=="1-1.1.3",     NAME="wlan1"
ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb",  KERNELS=="1-1.3",       NAME="wlan1"
ACTION=="add", SUBSYSTEM=="net", SUBSYSTEMS=="usb",  KERNELS=="1-1.2",       NAME="wlan1"

# when using the lines below, only one WiFi device type can be used at a time
#ACTION=="add", SUBSYSTEM=="net", DRIVERS=="brcmfmac", NAME="wlan0"
#ACTION=="add", SUBSYSTEM=="net", DRIVERS=="rtl8192cu", NAME="wlan1"

Enable routing and IP masquerading

sudo vim /etc/sysctl.d/routed-ap.conf

# https://www.raspberrypi.org/documentation/configuration/wireless/access-point-routed.md
# Enable IPv4 routing
net.ipv4.ip_forward=1

"Mask" your Access point clients leaving your network.

Meaninig, mask the eth0 or wlan0 or whatever interface your Raspberry PI is connect to the internet side.

sudo iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

sudo netfilter-persistent save


sudo cat /etc/iptables/rules.v4

Filtering rules are saved to the directory /etc/iptables/.

If in the future you change the configuration of your firewall, make sure to save the configuration before rebooting.


Configure the DHCP and DNS services for the wireless network

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig

sudo vim /etc/dnsmasq.conf


interface=wlan1
# Listening interface

dhcp-range=192.168.3.101,192.168.3.199,255.255.255.0,12h
# Pool of IP addresses served via DHCP

domain=wlan03
# Local wireless DNS domain

address=/gw.wlan03/192.168.3.1
# Alias for this router

To ensure WiFi radio is not blocked on your Raspberry Pi, execute the following command:

sudo rfkill unblock wlan

Configure the access point software

Create the hostapd configuration file, located at /etc/hostapd/hostapd.conf,
to add the various parameters for your new wireless network.

sudo vim /etc/hostapd/hostapd.conf

Add the information below to the configuration file.

country_code=GB

interface=wlan1
ssid=MYWIFI_AP_NAME

## for 2.4Ghz
#hw_mode=g
#channel=7

## for 5GHz
hw_mode=a
channel=36

macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0

wpa=2
wpa_passphrase=MY_WIFI_AP_PASSWORD
wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP
rsn_pairwise=CCMP

Note the line country_code=GB:

it configures the computer to use the correct wireless frequencies in the United Kingdom.

Adapt this line and specify the two-letter ISO code of your country. See Wikipedia for a list of two-letter ISO 3166-1 country codes.

To use the 5 GHz band, you can change the operations mode from hw_mode=g to hw_mode=a.

Possible values for hw_mode are:

a = IEEE 802.11a (5 GHz) (Raspberry Pi 3B+ onwards)
b = IEEE 802.11b (2.4 GHz)
g = IEEE 802.11g (2.4 GHz)

Note that when changing the hw_mode, you may need to also change the channel - see Wikipedia for a list of allowed combinations.

Setup up hostapd.conf for a specific interface

To avoid conflits with wlan0 and wlan1, I want the hostapd service to run only on the wlan0

cd /etc/hostapd/

sudo mv hostapd.conf wlan0.conf

systemctl | grep hostapd

sudo systemctl | grep wpa

sudo systemctl disable  [email protected]

sudo systemctl status  hostapd.service
sudo systemctl disable  hostapd.service

sudo systemctl stop hostapd.service

## here enable hostapd just on interface wlan0
sudo systemctl enable  [email protected]

ifconfig

sudo reboot

Run your new wireless access point

Now restart your Raspberry Pi and verify that the wireless access point becomes automatically available.

sudo systemctl reboot

Once your Raspberry Pi has restarted, search for wireless networks with your wireless client.

The network SSID you specified in file /etc/hostapd/hostapd.conf should now be present, and it should be accessible with the specified password.


set up DHCP local WIFI for primary WLAN

https://raspberrypi.stackexchange.com/questions/37920/how-do-i-set-up-networking-wifi-static-ip-address-on-raspbian-raspberry-pi-os/37921#use-different-wpa_supplicant-files

wlan0 <--- Is the onboard wireless device to be as Wireless Access Point

wlan1 <--- Is the additional USB wireless device that connects to the local wireless for internet access

eth0 ← if connected to local network, will also provide internet for the wireless users connects to the wireless access point on wlan1

ls -alhF /etc/wpa_supplicant/

  total 52K
  drwxr-xr-x  2 root root 4.0K Aug  2 09:19 ./
  drwxr-xr-x 82 root root 4.0K Aug  2 09:18 ../
  -rwxr-xr-x  1 root root  937 Apr 16 14:07 action_wpa.sh*
  -rw-r--r--  1 root root  25K Apr 16 14:07 functions.sh
  -rwxr-xr-x  1 root root 4.6K Apr 16 14:07 ifupdown.sh*
  -rw-r--r--  1 root root    0 Aug  2 09:19 wpa_supplicant.conf  <---- default wireless setup for all interfaces (I left this file empty)
  -rw-r--r--  1 root root  237 Aug  2 09:19 wpa_supplicant-wlan1.conf <------ this is the interface that I want the Raspberry Pi to use to connect to the wireless internet.

WORK-IN-PROGRESS

next to do


Happy learning

Antonio Feijao UK

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