Last active
September 3, 2023 20:47
-
-
Save AymaneHrouch/ecdb1bbde8f2c22a677f4f9266010b1d to your computer and use it in GitHub Desktop.
Bash script to run on the first time working with a raspberrypi, (installs nodejs, npm, chromium-browser, noip, and sets a static ip)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
RED="\e[31m" | |
ENDCOLOR="\e[0m" | |
echo -e "${RED}Updating packages list${ENDCOLOR}\n\n" | |
sudo apt update | |
echo -e "${RED}Installing Node.js${ENDCOLOR}\n\n" | |
sudo apt --assume-yes install nodejs | |
echo -e "${RED}Installing npm${ENDCOLOR}\n\n" | |
sudo apt --assume-yes install npm | |
echo -e "${RED}Installing live-server${ENDCOLOR}\n\n" | |
sudo npm i -g live-server | |
echo -e "${RED}Installing chromium-browser and chromium-codecs-ffmpeg${ENDCOLOR}\n\n" | |
sudo apt --assume-yes install chromium-browser chromium-codecs-ffmpeg | |
echo -e "${RED}Installing noip${ENDCOLOR}\n\n" | |
sudo apt --assume-yes install wget | |
cd /usr/local/src | |
sudo wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz | |
sudo tar xzf noip-duc-linux.tar.gz | |
cd noip-2.1.9-1 | |
sudo make | |
sudo make install | |
echo -e "${RED}If you want to configure the client please run: sudo /usr/local/bin/noip2 -C${ENDCOLOR}\n\n" | |
echo -e "${RED}The script will now run in the background${ENDCOLOR}\n\n" | |
sudo /usr/local/bin/noip2 | |
CRON_JOB="@reboot sleep 10 && sudo /usr/local/bin/noip2" | |
crontab -l | grep -q "$CRON_JOB" | |
if [ $? -eq 0 ] | |
then | |
echo "Cron job already exists in this machine" | |
else | |
(crontab -l 2>/dev/null || true; echo $CRON_JOB) | crontab - | |
echo "Cron job added, noip will run on startup" | |
fi | |
echo -e "${RED}Setting a static IP${ENDCOLOR}\n\n" | |
tail -n 2 /etc/resolv.conf | |
read -p "Copy and paste the DNS IP above: " DNS_IP | |
read -p "Enter STATIC IP [192.168.1.66]: " STATIC_IP | |
STATIC_IP=${STATIC_IP:-192.168.1.66} | |
echo interface wlan0 >> /etc/dhcpcd.conf | |
echo static ip_address=$STATIC_IP/24 >> /etc/dhcpcd.conf | |
echo static routers=$DNS_IP >> /etc/dhcpcd.conf | |
echo static domain_name_servers=$DNS_IP >> /etc/dhcpcd.conf | |
echo -e "${RED}All done :) please reboot so the changes take effect!${ENDCOLOR}" | |
echo "Happy Coding!" |
sudo apt-get install chromium-chromedriver
from selenium.webdriver.chrome.service import Service
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
options = Options()
options.add_argument("--headless")
service = Service('/home/pi/Desktop/chromedriver')
driver = webdriver.Chrome(service=service, options=options)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: Install screen