Last active
May 20, 2023 14:58
-
-
Save psiborg/437b316d10f5555472e78e8ac529dd12 to your computer and use it in GitHub Desktop.
Revisions
-
psiborg revised this gist
Jan 10, 2021 . 1 changed file with 13 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -64,6 +64,19 @@ Adjust the following: start_motion_daemon=yes ``` ## Disable Camera LED ```sh sudo nano /boot/config.txt ``` Adjust the following: ``` disable_camera_led=1 ``` ## Restart ```sh #sudo chmod 777 /var/lib/motion -
psiborg revised this gist
Jan 9, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -42,6 +42,8 @@ text_event %Y%m%d-%H%M%S #target_dir /var/lib/motion target_dir {your_path}/motion snapshot_interval 60 # lastsnap.jpg symlink snapshot_filename %Y%m%d/%Y%m%d-%H%M%S-snapshot picture_filename %Y%m%d/%Y%m%d-%H%M%S-%q movie_filename %Y%m%d/%Y%m%d-%H%M%S -
psiborg revised this gist
Jan 7, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -57,7 +57,7 @@ sudo mkdir /opt/node-exporter cd /opt/node-exporter sudo wget -O node-exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-armv7.tar.gz sudo tar -xvf node-exporter.tar.gz --strip-components=1 ./node_exporter sudo nano /etc/systemd/system/nodeexporter.service ``` -
psiborg renamed this gist
Jan 6, 2021 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,9 +1,19 @@ ```sh crontab -e 0 0 * * * /home/pi/cleanup.sh >> /home/pi/cleanup.log ``` ```sh #!/bin/bash dt=$(date '+%Y-%m-%d %H:%M:%S') base_path='/home/pi/{your_path}' days_old='+90' echo "$dt:" find "$base_path" -type f -mtime $days_old -delete find "$base_path" -mindepth 1 -type d -mtime $days_old -delete # touch -mt 202001010000 ./{filename} ``` -
psiborg revised this gist
Jan 6, 2021 . 2 changed files with 28 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,13 @@ ```sh sudo apt-get install -y mc sudo nano /etc/mc/mc.ext ``` ``` ### Images ### shell/.jpg Open=fbi %f View=fbi %f ALL_FORMATS ``` 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 charactersOriginal file line number Diff line number Diff line change @@ -89,6 +89,24 @@ sudo nano /etc/apache2/apache2.conf AllowOverride None Require all granted </Directory> <Directory {your_path}/data/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> <Directory {your_path}/logs/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> <Directory {your_path}/snapshot/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> ``` ```sh -
psiborg revised this gist
Jan 6, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ #!/bin/bash base_path='/home/pi/{your_path}' days_old='+90' find "$base_path" -type f -mtime $days_old -delete -
psiborg revised this gist
Jan 6, 2021 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ #!/bin/bash base_path='/home/pi/Share/motion' days_old='+90' find "$base_path" -type f -mtime $days_old -delete find "$base_path" -mindepth 1 -type d -mtime $days_old -delete # touch -mt 202001010000 ./{filename} -
psiborg revised this gist
Jan 4, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -30,8 +30,8 @@ minimum_motion_frames [1-5] #post_capture 1 max_movie_time 300 output_pictures on ffmpeg_video_codec mp4 timelapse_codec mpeg4 locate_motion_mode on locate_motion_style [box|redbox|cross|redcross] -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,3 +4,5 @@ https://www.raspberrypi-spy.co.uk/2017/02/how-to-display-images-on-raspbian-comm sudo apt-get install -y fbi fbi -a *.jpg ``` Press 'h' for help -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ https://www.raspberrypi-spy.co.uk/2017/02/how-to-display-images-on-raspbian-command-line-with-fbi/ ```sh sudo apt-get install -y fbi fbi -a *.jpg ``` -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ width 640 height 480 #framerate 10 threshold 30720 # = 640 * 480 * 0.1 [1 - 2147483647] minimum_motion_frames [1-5] #pre_capture 1 #post_capture 1 -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ width 640 height 480 #framerate 10 threshold 30720 # = 640 * 480 * 0.1 minimum_motion_frames [1-5] #pre_capture 1 #post_capture 1 -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,7 +24,7 @@ width 640 height 480 #framerate 10 threshold 61440 # = 640 * 480 * 0.2 minimum_motion_frames [1-5] #pre_capture 1 #post_capture 1 -
psiborg revised this gist
Jan 3, 2021 . 2 changed files with 4 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ ```sh sudo apt-get install -y mc ``` 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 charactersOriginal file line number Diff line number Diff line change @@ -78,7 +78,7 @@ curl -s -o /dev/null http://{hostname}:8081/0/action/snapshot https://pimylifeup.com/raspberry-pi-apache/ ```sh sudo apt-get install -y apache2 cd /etc/apache2/ sudo nano /etc/apache2/apache2.conf ``` -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -95,7 +95,7 @@ sudo nano /etc/apache2/apache2.conf sudo systemctl reload apache2 cd /var/www/html sudo ln -s {your_path}/motion motion ``` http://{ip_addr}/motion/ -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ ## Set up Motion https://scottontechnology.com/raspberry-pi-webcam-server-using-motion/ https://motion-project.github.io/index.html http://www.lavrsen.dk/foswiki/bin/view/Motion/RemoteControlHttp ```sh sudo apt-get install -y motion @@ -75,6 +75,8 @@ curl -s -o /dev/null http://{hostname}:8081/0/action/snapshot ## Set up Apache https://pimylifeup.com/raspberry-pi-apache/ ```sh sudo apt install apache2 -y cd /etc/apache2/ -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 30 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,6 +2,10 @@ https://scottontechnology.com/raspberry-pi-webcam-server-using-motion/ https://motion-project.github.io/index.html http://www.lavrsen.dk/foswiki/bin/view/Motion/RemoteControlHttp ## Set up Motion ```sh sudo apt-get install -y motion @@ -36,6 +40,7 @@ text_event %Y%m%d-%H%M%S #exif_text %i%J/%K%L #target_dir /var/lib/motion target_dir {your_path}/motion snapshot_filename %Y%m%d/%Y%m%d-%H%M%S-snapshot picture_filename %Y%m%d/%Y%m%d-%H%M%S-%q @@ -58,7 +63,7 @@ start_motion_daemon=yes ``` ```sh #sudo chmod 777 /var/lib/motion sudo service motion start sudo service motion stop @@ -68,4 +73,27 @@ http://{hostname}:8081 curl -s -o /dev/null http://{hostname}:8081/0/action/snapshot ## Set up Apache ```sh sudo apt install apache2 -y cd /etc/apache2/ sudo nano /etc/apache2/apache2.conf ``` ``` <Directory {your_path}/motion/> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> ``` ```sh sudo systemctl reload apache2 cd /var/www/html sudo ln -s /home/pi/Share/motion motion ``` http://{ip_addr}/motion/ -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 95 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,95 @@ # Prometheus https://pimylifeup.com/raspberry-pi-prometheus/ https://github.com/prometheus/prometheus ## Set up Prometheus service ```sh sudo apt update sudo apt full-upgrade ``` Check latest stable version at https://prometheus.io/download/ ```sh cd ~/Downloads wget https://github.com/prometheus/prometheus/releases/download/v2.23.0/prometheus-2.23.0.linux-armv7.tar.gz tar xfz prometheus-2.23.0.linux-armv7.tar.gz mv prometheus-2.23.0.linux-armv7 ~/prometheus sudo nano /etc/systemd/system/prometheus.service ``` ``` [Unit] Description=Prometheus Server Documentation=https://prometheus.io/docs/introduction/overview/ After=network-online.target [Service] User=pi Restart=on-failure ExecStart=/home/pi/prometheus/prometheus \ --config.file=/home/pi/prometheus/prometheus.yml \ --storage.tsdb.path=/home/pi/prometheus/data [Install] WantedBy=multi-user.target ``` ```sh sudo systemctl enable prometheus sudo systemctl start prometheus sudo systemctl status prometheus hostname -I ``` http://{ip_addr}:9090 ## Set up device as a node ```sh sudo mkdir /opt/node-exporter cd /opt/node-exporter sudo wget -O node-exporter.tar.gz https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-armv7.tar.gz sudo tar -xvf node-exporter.tar.gz --strip-components=1 ./node-exporter sudo nano /etc/systemd/system/nodeexporter.service ``` ``` [Unit] Description=Prometheus Node Exporter Documentation=https://prometheus.io/docs/guides/node-exporter/ After=network-online.target [Service] User=pi Restart=on-failure ExecStart=/opt/node-exporter/node_exporter [Install] WantedBy=multi-user.target ``` ```sh sudo systemctl enable nodeexporter sudo systemctl start nodeexporter sudo systemctl status nodeexporter ``` http://{ip_addr}:9100 ## Add node(s) to Prometheus nano /home/pi/prometheus/prometheus.yml - job_name: 'node-01' static_configs: - targets: ['node-01:9100'] -
psiborg revised this gist
Jan 3, 2021 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -44,6 +44,7 @@ movie_filename %Y%m%d/%Y%m%d-%H%M%S stream_localhost off stream_auth_method 1 stream_authentication {username}:{password} webcontrol_localhost off webcontrol_authentication {username}:{password} ``` -
psiborg revised this gist
Dec 30, 2020 . 1 changed file with 13 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -72,39 +72,43 @@ function welcome() { "" "" "" "" ) local out local i for i in "${!logo[@]}"; do #out+=" ${logo[$i]} " case "$i" in 0) out+="${fgred}$(date +"%A, %e %B %Y, %X")" ;; 1) out+="${fgred}$(uname -srmo)" ;; 3) out+="${fgcyn}${df_out[0]}" ;; 4) out+="${fgwht}${df_out[1]}" ;; 5) out+="${fgcyn}Uptime...........: ${fgwht}${UPTIME}" ;; 6) out+="${fgcyn}Memory...........: ${fgwht}$(grep MemFree /proc/meminfo | awk {'print $2'})kB (Free) / $(grep MemTotal /proc/meminfo | awk {'print $2'})kB (Total)" ;; 7) out+="${fgcyn}Running Processes: ${fgwht}$(ps ax | wc -l | tr -d " ")" ;; 8) out+="${fgcyn}IP Address.......: ${fgwht}$(getIPAddress)" ;; 9) out+="${fgcyn}Temperature......: ${fgwht}CPU: ${cpuTempC}°C/${cpuTempF}°F GPU: ${gpuTempC}°C/${gpuTempF}°F" ;; 10) out+="${fgcyn}Shells...........: ${fgwht}emulationstation | kodi" ;; esac out+="${rst}\n" -
psiborg revised this gist
Dec 27, 2020 . 1 changed file with 526 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,526 @@ #!/bin/bash : <<'DISCLAIMER' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. This script is licensed under the terms of the MIT license. Unless otherwise noted, code reproduced herein was written for this script. - The Pimoroni Crew - DISCLAIMER # script control variables productname="na" # the name of the product to install scriptname="audio" # the name of this script spacereq=1 # minimum size required on root partition in MB debugmode="no" # whether the script should use debug routines debuguser="none" # optional test git user to use in debug mode debugpoint="none" # optional git repo branch or tag to checkout forcesudo="no" # whether the script requires to be ran with root privileges promptreboot="no" # whether the script should always prompt user to reboot mininstall="no" # whether the script enforces minimum install routine customcmd="yes" # whether to execute commands specified before exit gpioreq="no" # whether low-level gpio access is required i2creq="no" # whether the i2c interface is required i2sreq="no" # whether the i2s interface is required spireq="no" # whether the spi interface is required uartreq="no" # whether uart communication is required armhfonly="yes" # whether the script is allowed to run on other arch armv6="yes" # whether armv6 processors are supported armv7="yes" # whether armv7 processors are supported armv8="yes" # whether armv8 processors are supported raspbianonly="no" # whether the script is allowed to run on other OSes osreleases=( "Raspbian" "Kano" "Mate" "PiTop" "RetroPie" ) # list os-releases supported oswarning=( "Debian" "Ubuntu" ) # list experimental os-releases osdeny=( "Darwin" "Kali" "Linaro" "Volumio" ) # list os-releases specifically disallowed FORCE=$1 ASK_TO_REBOOT=false CURRENT_SETTING=false MIN_INSTALL=false FAILED_PKG=false REMOVE_PKG=false UPDATE_DB=false AUTOSTART=~/.config/lxsession/LXDE-pi/autostart BOOTCMD=/boot/cmdline.txt CONFIG=/boot/config.txt APTSRC=/etc/apt/sources.list INITABCONF=/etc/inittab BLACKLIST=/etc/modprobe.d/raspi-blacklist.conf LOADMOD=/etc/modules RASPOOL="http://mirrordirector.raspbian.org/raspbian/pool" RPIPOOL="http://archive.raspberrypi.org/debian/pool" DEBPOOL="http://ftp.debian.org/debian/pool" GETPOOL="https://get.pimoroni.com" # function define confirm() { if [ "$FORCE" == '-y' ]; then true else read -r -p "$1 [y/N] " response < /dev/tty if [[ $response =~ ^(yes|y|Y)$ ]]; then true else false fi fi } prompt() { read -r -p "$1 [y/N] " response < /dev/tty if [[ $response =~ ^(yes|y|Y)$ ]]; then true else false fi } success() { echo -e "$(tput setaf 2)$1$(tput sgr0)" } inform() { echo -e "$(tput setaf 6)$1$(tput sgr0)" } warning() { echo -e "$(tput setaf 1)$1$(tput sgr0)" } newline() { echo "" } progress() { count=0 until [ $count -eq 7 ]; do echo -n "..." && sleep 1 ((count++)) done; if ps -C $1 > /dev/null; then echo -en "\r\e[K" && progress $1 fi } sudocheck() { if [ $(id -u) -ne 0 ]; then echo -e "Install must be run as root. Try 'sudo ./$scriptname'\n" exit 1 fi } sysclean() { sudo apt-get clean && sudo apt-get autoclean sudo apt-get -y autoremove &> /dev/null } sysupdate() { if ! $UPDATE_DB; then echo "Updating apt indexes..." && progress apt-get & sudo apt-get update 1> /dev/null || { warning "Apt failed to update indexes!" && exit 1; } sleep 3 && UPDATE_DB=true fi } sysupgrade() { sudo apt-get upgrade sudo apt-get clean && sudo apt-get autoclean sudo apt-get -y autoremove &> /dev/null } sysreboot() { warning "Some changes made to your system require" warning "your computer to reboot to take effect." echo if prompt "Would you like to reboot now?"; then sync && sudo reboot fi } arch_check() { IS_ARMHF=false IS_ARMv6=false if uname -m | grep -q "armv.l"; then IS_ARMHF=true if uname -m | grep -q "armv6l"; then IS_ARMv6=true fi fi } os_check() { IS_MACOSX=false IS_RASPBIAN=false IS_SUPPORTED=false IS_EXPERIMENTAL=false OS_NAME="Unknown" if uname -s | grep -q "Darwin"; then OS_NAME="Darwin" && IS_MACOSX=true elif cat /etc/os-release | grep -q "Kali"; then OS_NAME="Kali" elif [ -d ~/.kano-settings ] || [ -d ~/.kanoprofile ]; then OS_NAME="Kano" elif whoami | grep -q "linaro"; then OS_NAME="Linaro" elif [ -d ~/.config/ubuntu-mate ];then OS_NAME="Mate" elif [ -d ~/.pt-os-dashboard ] || [ -d ~/.pt-dashboard ] || [ -f ~/.pt-dashboard-config ]; then OS_NAME="PiTop" elif command -v emulationstation > /dev/null; then OS_NAME="RetroPie" elif cat /etc/os-release | grep -q "volumio"; then OS_NAME="Volumio" elif cat /etc/os-release | grep -q "Raspbian"; then OS_NAME="Raspbian" && IS_RASPBIAN=true elif cat /etc/os-release | grep -q "Debian"; then OS_NAME="Debian" elif cat /etc/os-release | grep -q "Ubuntu"; then OS_NAME="Ubuntu" fi if [[ " ${osreleases[@]} " =~ " ${OS_NAME} " ]]; then IS_SUPPORTED=true fi if [[ " ${oswarning[@]} " =~ " ${OS_NAME} " ]]; then IS_EXPERIMENTAL=true fi } raspbian_check() { IS_SUPPORTED=false IS_EXPERIMENTAL=false if [ -f /etc/os-release ]; then if cat /etc/os-release | grep -q "/sid"; then IS_SUPPORTED=false && IS_EXPERIMENTAL=true elif cat /etc/os-release | grep -q "stretch"; then IS_SUPPORTED=true && IS_EXPERIMENTAL=false elif cat /etc/os-release | grep -q "jessie"; then IS_SUPPORTED=true && IS_EXPERIMENTAL=false elif cat /etc/os-release | grep -q "wheezy"; then IS_SUPPORTED=true && IS_EXPERIMENTAL=false else IS_SUPPORTED=false && IS_EXPERIMENTAL=false fi fi } home_dir() { if [ $EUID -ne 0 ]; then if $IS_MACOSX; then USER_HOME=$(dscl . -read /Users/$USER NFSHomeDirectory | cut -d: -f2) else USER_HOME=$(getent passwd $USER | cut -d: -f6) fi else warning "Running as root, please log in as a regular user with sudo rights!" echo && exit 1 fi } space_chk() { if command -v stat > /dev/null && ! $IS_MACOSX; then if [ $spacereq -gt $(($(stat -f -c "%a*%S" /)/10**6)) ];then echo warning "There is not enough space left to proceed with installation" if confirm "Would you like to attempt to expand your filesystem?"; then curl -sS $GETPOOL/expandfs | sudo bash && exit 1 else echo && exit 1 fi fi fi } timestamp() { date +%Y%m%d-%H%M } check_network() { sudo ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3 | head -n 1` &> /dev/null && return 0 || return 1 } force_hdmi() { if [ -e $CONFIG ] && ! grep -q "^hdmi_force_hotplug=1$" $CONFIG; then if grep -q "^#hdmi_force_hotplug=1$" $CONFIG; then sudo sed -i "s|^#hdmi_force_hotplug=1|hdmi_force_hotplug=1|" $CONFIG &> /dev/null else echo "hdmi_force_hotplug=1" | sudo tee -a $CONFIG &> /dev/null fi fi } hotplug_hdmi() { if [ -e $CONFIG ] && grep -q "^hdmi_force_hotplug=1$" $CONFIG; then sudo sed -i "s|^hdmi_force_hotplug=1|#hdmi_force_hotplug=1|" $CONFIG &> /dev/null fi } add_dtoverlay() { if grep -q "^dtoverlay=$1" $CONFIG; then echo -e "\n$1 overlay already active" elif grep -q "^#dtoverlay=$1" $CONFIG; then sudo sed -i "/^#dtoverlay=$1$/ s|#||" $CONFIG echo -e "\nAdding $1 overlay to $CONFIG" ASK_TO_REBOOT=true else echo "dtoverlay=$1" | sudo tee -a $CONFIG &> /dev/null echo -e "\nAdding $1 overlay to $CONFIG" ASK_TO_REBOOT=true fi } remove_dtoverlay() { sudo sed -i "/^dtoverlay=$1$/ s|^|#|" $CONFIG ASK_TO_REBOOT=true } enable_pi_audio() { if grep -q "#dtparam=audio=on" $CONFIG; then sudo sed -i "/^#dtparam=audio=on$/ s|#||" $CONFIG echo -e "\nsnd_bcm2835 loaded (on-board audio enabled)" ASK_TO_REBOOT=true fi } disable_pi_audio() { if grep -q "^dtparam=audio=on" $CONFIG; then sudo sed -i "/^dtparam=audio=on$/ s|^|#|" $CONFIG echo -e "\nsnd_bcm2835 unloaded (on-board audio disabled)" ASK_TO_REBOOT=true fi } test_audio() { newline if confirm "Do you wish to test your system now?"; then echo -e "\nTesting..." speaker-test -l5 -c2 -t wav fi } disable_pulseaudio() { sudo mv /etc/xdg/autostart/pulseaudio.desktop /etc/xdg/autostart/pulseaudio.disabled &> /dev/null pulseaudio -k &> /dev/null } kill_volumealsa() { sed -i "s|type=volumealsa|type=space|" $HOME/.config/lxpanel/LXDE/panels/panel &> /dev/null sed -i "s|type=volumealsa|type=space|" $HOME/.config/lxpanel/LXDE-pi/panels/panel &> /dev/null } basic_asound() { sudo echo -e "pcm.\041default {\n type hw\n card 1\n}" > $HOME/.asoundrc sudo echo -e "ctl.\041default {\n type hw\n card 1\n}" >> $HOME/.asoundrc sudo mv $HOME/.asoundrc /etc/asound.conf } route_audio() { if [ $debugmode == "yes" ]; then warning "passed parameter is $FORCE" fi if [ "$FORCE" == '1' ]; then amixer cset numid=3 1 > /dev/null success "Audio output mode changed to Analog!" hotplug_hdmi elif [ "$FORCE" == '2' ]; then amixer cset numid=3 2 > /dev/null success "Audio output mode changed to HDMI!" hotplug_hdmi elif [ "$FORCE" == '3' ]; then amixer cset numid=3 2 > /dev/null success "Audio signal will be forcefully sent to HDMI!" force_hdmi else newline echo "Please choose an audio output mode:" && newline echo "0 : Automatic signal detection" echo "1 : Output to analogue (headphone/speaker jack)" echo "2 : Output to digital (HDMI port)" echo "3 : Force route to digital (HDMI hotplug disabled)" newline read -r -p "Enter an option [0-3]:" choice < /dev/tty if [ $debugmode == "yes" ]; then echo "User chose option $choice" fi if [[ $choice =~ ^(0|1|2)$ ]]; then amixer cset numid=3 $choice > /dev/null success "Audio output mode changed!" hotplug_hdmi elif [[ $choice =~ ^(3)$ ]]; then amixer cset numid=3 $choice > /dev/null success "Audio signal will be forcefully sent to HDMI!" force_hdmi else warning "Invalid option!" route_audio fi fi } : <<'MAINSTART' Perform all global variables declarations as well as function definition above this section for clarity, thanks! MAINSTART # intro message if [ $debugmode != "no" ]; then if [ $debuguser != "none" ]; then gitusername="$debuguser" fi if [ $debugpoint != "none" ]; then gitrepobranch="$debugpoint" fi inform "\nDEBUG MODE ENABLED" echo -e "git user $gitusername and $gitrepobranch branch/tag will be used\n" else echo -e "\nThis script will configure your Pi audio output!" if [ "$FORCE" != '-y' ]; then inform "\nAlways be careful when running scripts and commands copied" inform "from the internet. Ensure they are from a trusted source.\n" echo -e "If you want to see what this script does before running it," echo -e "you should run: 'curl $GETPOOL/$scriptname'\n" fi fi # checks and init arch_check os_check space_chk home_dir if [ $debugmode != "no" ]; then echo "USER_HOME is $USER_HOME" echo "OS_NAME is $OS_NAME" echo "IS_SUPPORTED is $IS_SUPPORTED" echo "IS_EXPERIMENTAL is $IS_EXPERIMENTAL" echo fi if ! $IS_ARMHF; then warning "This hardware is not supported, sorry!" warning "Config files have been left untouched\n" exit 1 fi if $IS_ARMv8 && [ $armv8 == "no" ]; then warning "Sorry, your CPU is not supported by this installer\n" exit 1 elif $IS_ARMv7 && [ $armv7 == "no" ]; then warning "Sorry, your CPU is not supported by this installer\n" exit 1 elif $IS_ARMv6 && [ $armv6 == "no" ]; then warning "Sorry, your CPU is not supported by this installer\n" exit 1 fi if [ $raspbianonly == "yes" ] && ! $IS_RASPBIAN;then warning "This script is intended for Raspbian on a Raspberry Pi!\n" exit 1 fi if $IS_RASPBIAN; then raspbian_check if ! $IS_SUPPORTED && ! $IS_EXPERIMENTAL; then warning "\n--- Warning ---\n" echo "The $productname installer" echo "does not work on this version of Raspbian." echo "Check https://github.com/$gitusername/$gitreponame" echo "for additional information and support" && echo exit 1 fi fi if ! $IS_SUPPORTED && ! $IS_EXPERIMENTAL; then warning "Your operating system is not supported, sorry!\n" exit 1 fi if $IS_EXPERIMENTAL; then warning "Support for your operating system is experimental. Please visit" warning "forums.pimoroni.com if you experience issues with this product.\n" fi if [ $forcesudo == "yes" ]; then sudocheck fi if [ $uartreq == "yes" ]; then echo "Note: $productname requires UART communication" warning "The serial console will be disabled if you proceed!" fi if [ $spireq == "yes" ]; then echo -e "Note: $productname requires SPI communication" fi if [ $i2creq == "yes" ]; then echo -e "Note: $productname requires I2C communication" fi if [ $i2sreq == "yes" ]; then echo -e "Note: $productname uses the I2S interface" warning "The on-board audio chip will be disabled if you proceed!" fi newline if confirm "Do you wish to continue?"; then # environment preparation if [ -e $CONFIG ] && grep -q -E "^dtparam=audio=on$" $CONFIG; then bcm2835off="no" elif [ -e $LOADMOD ] && grep -q "^snd-bcm2835" $LOADMOD; then bcm2835off="no" else bcm2835off="yes" fi if [ $bcm2835off == "no" ]; then newline route_audio if [ "$FORCE" != '-y' ] && [ "$FORCE" != '3' ]; then test_audio fi newline else newline warning "Default sound driver currently not loaded!" if confirm "Do you wish to re-enable the on-board audio?"; then enable_pi_audio remove_dtoverlay i2s-mmap remove_dtoverlay hifiberry-dac sudo rm /etc/asound.conf &> /dev/null sudo rm ~/.asound.rc &> /dev/null newline else exit 1 fi fi if [ $promptreboot == "yes" ] || $ASK_TO_REBOOT; then sysreboot && newline fi else newline && echo "Aborting..." && newline fi exit 0 -
psiborg revised this gist
Dec 26, 2020 . 1 changed file with 6 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -24,3 +24,9 @@ Configuration / tools > samba ```sh emulationstation ``` MAME High Score locations ``` /opt/retropie/configs/mame-mame4all/hi /home/pi/RetroPie/roms/arcade/mame2003/hi ``` -
psiborg revised this gist
Dec 24, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -17,6 +17,8 @@ Basic install Manage packages > Manage optional packages > kodi > Install from pre-compiled binary Manage packages > Manage optional packages > vice > Install from pre-compiled binary Configuration / tools > samba ```sh -
psiborg revised this gist
Dec 16, 2020 . 1 changed file with 18 additions and 9 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -21,6 +21,24 @@ directory mask = 0771 public = yes guest ok = yes [music] comment = music path = "/home/pi/Music" writeable = yes guest ok = yes create mask = 0644 directory mask = 0755 force user = pi [videos] comment = videos path = "/home/pi/Videos" writeable = yes guest ok = yes create mask = 0644 directory mask = 0755 force user = pi # for RetroPie [roms] @@ -58,15 +76,6 @@ guest ok = yes create mask = 0644 directory mask = 0755 force user = pi ``` ```sh -
psiborg revised this gist
Dec 16, 2020 . 1 changed file with 32 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -41,11 +41,37 @@ watch -n 1 vcgencmd measure_clock arm ``` frequency(45)=600000000 ```sh for src in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi ; do \ echo -e "$src:\t$(vcgencmd measure_clock $src)" ; \ done ``` ```sh cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq ``` ```sh vcgencmd measure_volts core ``` volt=1.2000V ```sh for id in core sdram_c sdram_i sdram_p ; do \ echo -e "$id:\t$(vcgencmd measure_volts $id)" ; \ done ``` Setting GPU memory: Total RAM | gpu_mem (recommended maximum) ---------------|------------------------------ 256MB | 128 512MB | 384 1GB or greater | 512 (256 on the Pi4) ```sh vcgencmd get_mem arm ``` @@ -60,3 +86,9 @@ gpu=76M vcgencmd codec_enabled H264 ``` H264=enabled ```sh for codec in H264 MPG2 WVC1 MPG4 MJPG WMV9 ; do \ echo -e "$codec:\t$(vcgencmd codec_enabled $codec)" ; \ done ``` -
psiborg revised this gist
Dec 15, 2020 . 1 changed file with 47 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -20,6 +20,53 @@ create mask = 0660 directory mask = 0771 public = yes guest ok = yes # for RetroPie [roms] comment = roms path = "/home/pi/RetroPie/roms" writeable = yes guest ok = yes create mask = 0644 directory mask = 0755 force user = pi [bios] comment = bios path = "/home/pi/RetroPie/BIOS" writeable = yes guest ok = yes create mask = 0644 directory mask = 0755 force user = pi [configs] comment = configs path = "/opt/retropie/configs" writeable = yes guest ok = yes create mask = 0644 directory mask = 0755 force user = pi [splashscreens] comment = splashscreens path = "/home/pi/RetroPie/splashscreens" writeable = yes guest ok = yes create mask = 0644 directory mask = 0755 force user = pi [videos] comment = videos path = "/home/pi/Videos" writeable = yes guest ok = yes create mask = 0644 directory mask = 0755 force user = pi ``` ```sh -
psiborg revised this gist
Dec 12, 2020 . 1 changed file with 9 additions and 7 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -21,24 +21,26 @@ height 480 #framerate 10 #threshold 1500 minimum_motion_frames [1-5] #pre_capture 1 #post_capture 1 max_movie_time 300 output_pictures on #ffmpeg_video_codec mp4 #timelapse_codec mpeg4 locate_motion_mode on locate_motion_style [box|redbox|cross|redcross] text_event %Y%m%d-%H%M%S #exif_text %i%J/%K%L #target_dir /var/lib/motion snapshot_filename %Y%m%d/%Y%m%d-%H%M%S-snapshot picture_filename %Y%m%d/%Y%m%d-%H%M%S-%q movie_filename %Y%m%d/%Y%m%d-%H%M%S stream_localhost off stream_auth_method 1 stream_authentication {username}:{password} -
psiborg revised this gist
Dec 12, 2020 . 4 changed files with 12 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,11 @@ chmod +x retropie_setup.sh sudo ./retropie_setup.sh ``` Basic install Manage packages > Manage optional packages > kodi > Install from pre-compiled binary Configuration / tools > samba ```sh emulationstation 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 charactersOriginal file line number Diff line number Diff line change @@ -5,9 +5,7 @@ cd ~/RetroPie-Setup sudo ./retropie_setup.sh ``` Configuration / tools > raspiantools > Install Pixel desktop environment ```sh startx 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ #!/bin/bash while read HOST ; do ssh -n $HOST "hostname && sudo apt-get update && sudo apt-get upgrade -y" ; done < $1 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ #!/bin/bash while read HOST ; do ssh -n $HOST "boinccmd --project http://einstein.phys.uwm.edu update" ; done < $1 -
psiborg revised this gist
Dec 11, 2020 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -2,7 +2,11 @@ dt=$(date '+%Y-%m-%d %H:%M:%S') hn=$(hostname) ps=$(boinccmd --get_project_status) tc=$(echo "$ps" | grep host_total_credit | cut -d ':' -f 2 | xargs) ac=$(echo "$ps" | grep host_expavg_credit | cut -d ':' -f 2 | xargs) pn=$(echo "$ps" | grep -i "name: .*@Home" | cut -d ':' -f 2 | xargs) echo "$hn": ["$dt"] total="$tc", average="$ac" [$pn] -
psiborg revised this gist
Dec 6, 2020 . 3 changed files with 10 additions and 10 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -10,5 +10,5 @@ Reboot ```sh sudo usermod -aG docker pi docker run hello-world ``` 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 charactersOriginal file line number Diff line number Diff line change @@ -3,16 +3,16 @@ https://github.com/heldersepu/gmapcatcher ```sh git clone https://github.com/heldersepu/GMapCatcher.git #sudo apt-get install -y python # Python 2.7 #sudo apt-get install -y python-dev #sudo apt-get install -y python-gtk2 #sudo apt-get build-dep python-imaging #sudo apt-get install -y libjpeg62 libjpeg62-dev # -OR- #pip install Pillow ./maps.py ``` 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ https://github.com/nodesource/distributions#debinstall ```sh sudo -s # Node.js v15.x curl -sL https://deb.nodesource.com/setup_15.x | bash -
NewerOlder