{"id":195,"date":"2020-08-03T00:07:56","date_gmt":"2020-08-03T00:07:56","guid":{"rendered":"https:\/\/www.codemakeshare.com\/?page_id=195"},"modified":"2020-08-03T00:07:56","modified_gmt":"2020-08-03T00:07:56","slug":"raspberry-pi-quick-notes","status":"publish","type":"page","link":"https:\/\/www.codemakeshare.com\/?page_id=195","title":{"rendered":"Raspberry Pi quick notes"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Network configuration tricks<\/h2>\n\n\n\n<p><strong>Setting up wifi config<\/strong>:    \/etc\/wpa_supplicant\/wpa_supplicant.conf <\/p>\n\n\n\n<p>Example to set up multiple wifi credentials:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>country=&lt;country code>\nctrl_interface=DIR=\/var\/run\/wpa_supplicant GROUP=netdev \nupdate_config=1\n\nnetwork={\n       ssid=\"SSID-wifi-1\"\n       psk=\"password-wifi-1\"\n       key_mgmt=WPA-PSK\n    }\n\nnetwork={\n       ssid=\"SSID-wifi-2\"\n       psk=\"password-wifi-2\"\n       key_mgmt=WPA-PSK\n    }\n<\/code><\/pre>\n\n\n\n<p><strong>Configuring static IP address<\/strong>:    \/etc\/dhcpcd.conf<\/p>\n\n\n\n<p>Example to configure multiple static IP addresses for different WiFi&#8217;s (https:\/\/raspberrypi.stackexchange.com\/a\/101175)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>interface wlan0\nssid SSID-wifi-1\nstatic ip_address=192.168.42.42\nstatic routers=192.168.42.1\n\nssid SSID-wifi-2\nstatic ip_address=192.168.0.100\nstatic routers=192.168.0.1\n\nstatic domain_name_servers=8.8.8.8<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Run scripts\/programs automatically at startup<\/h2>\n\n\n\n<p>Use raspi-config to set boot option to &#8220;console auto login&#8221;.  Add your script to the end of ~\/.bashrc<\/p>\n\n\n\n<p>Advantages of this method: The script\/program runs in the foreground. It is therefore easy to kill it by plugging in a keyboard and hitting Ctrl-C. This is particularly important for scripts launching raspivid, which hides the console when it previews the live video in the framebuffer (would make it difficult to enter commands blindly to terminate it). Caution, however, as the script is also launched for each SSH session. Similarly though, Ctrl-C will terminate it and drop the user into bash.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">SSL certificate problems<\/h2>\n\n\n\n<p>Sometimes there are errors complaining about invalid SSL certificates, e.g. when running wget, or also python pip. This is a red herring most of the time &#8211; the cause for the problem is often that the time\/date is not set correctly. For some reason, NTP doesn&#8217;t work any more on RPi3 with stock Raspian. Until this is fixed, here&#8217;s a handy script, that can be added to .bashrc and auto-launched:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo date -s \"$(wget -qSO- --max-redirect=0 google.com 2>&amp;1 | grep Date: | cut -d' ' -f5-8)Z\"<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Network configuration tricks Setting up wifi config: \/etc\/wpa_supplicant\/wpa_supplicant.conf Example to set up multiple wifi credentials: Configuring static IP address: \/etc\/dhcpcd.conf Example to configure multiple static IP addresses for different WiFi&#8217;s (https:\/\/raspberrypi.stackexchange.com\/a\/101175) Run scripts\/programs automatically at startup Use raspi-config to set boot option to &#8220;console auto login&#8221;. Add your script to the end of ~\/.bashrc Advantages &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.codemakeshare.com\/?page_id=195\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Raspberry Pi quick notes&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"parent":31,"menu_order":1,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-195","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.codemakeshare.com\/index.php?rest_route=\/wp\/v2\/pages\/195","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemakeshare.com\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.codemakeshare.com\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemakeshare.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemakeshare.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=195"}],"version-history":[{"count":1,"href":"https:\/\/www.codemakeshare.com\/index.php?rest_route=\/wp\/v2\/pages\/195\/revisions"}],"predecessor-version":[{"id":196,"href":"https:\/\/www.codemakeshare.com\/index.php?rest_route=\/wp\/v2\/pages\/195\/revisions\/196"}],"up":[{"embeddable":true,"href":"https:\/\/www.codemakeshare.com\/index.php?rest_route=\/wp\/v2\/pages\/31"}],"wp:attachment":[{"href":"https:\/\/www.codemakeshare.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}