Raspberry Pi Fresh Install Must-Dos, Must-Haves, and Nice-to-Haves #raspberrypi

BIG SUCCESS, BIG FAILURE, BUT NO ORDINARY

Magna Victoria, Magnum Defectum, Non Ordinarius

RPI INITIAL SETUP

#Add user XNAME, delete pi (source)
sudo adduser XNAME
sudo adduser XNAME sudo
sudo adduser XNAME adm
sudo adduser XNAME video
sudo deluser pi sudo sudo deluser pi adm sudo mv /etc/sudoers.d/010_pi-passwd /etc/sudoers.d/010_pi-passwd.org sudo deluser pi
# Run sudo without password (source)
# sudo visudo and add the following line
XNAME ALL=(ALL) NOPASSWD: ALL

Update and upgrade all

sudo apt update
sudo apt upgrade
sudo apt dist-upgrade
sudo apt autoremove

Useful Tools

# EXFAT filesystem
sudo apt install -y exfat-utils
# Install Midori
sudo apt install -y midori
# correct raspiberry camera awb
# append to /boot/config.txt
awb_auto_is_greyworld=1
# mouse wireless floating fix
sudo vi /boot/cmdline.txt
usbhid.mousepoll=0 (append at the end)
# mouse wireless floating fix on LibreElec
sudo vi /media/pi/System/cmdline.txt
usbhid.mousepoll=0 (append at the end)
# find temperature in C
cat /sys/class/thermal/thermal_zone0/temp
# adjust audio volume for AV Jack (source)
alsamixer > F6 > select AV > up, up, up
# Xterm (full screen)
sudo apt install xterm
xterm -fullscreen
# Clock in a Terminal
sudo apt install tty-clock
tty-clock -SBtr 
# -S: screen saver t: 12h format -r: rebound -B: flashing colon
# conky
sudo apt install -y conky
wget -O /home/pi/.conkyrc https://raw.githubusercontent.com/novaspirit/rpi_conky/master/rpi3_conkyrc
sudo cp ./conky.sh /usr/bin/.
sudo cp ./conky.desktop /etc/xdg/autostart/.
# remove spaces in file names
for f in */* ; do mv "$f" "${f// /_}"; done
# headless RPI VNC resolution settings (source here)
sudo vi /boot/config.txt
comment out: #dtoverlay=vc4-fkms-v3d
set framebuufer w: framebuffer_width = 1920 set framebuufer h: framebuffer_height = 1080
# setup static ip address (source here)
# on the RPI side: 
sudo vi /etc/dhcpcd.conf
# find the eth0 and ensure
static ip_address=192.168..../24
domain... = 192.168.0.1
dns... = 192.168.0.1
# then restart
# --------^-v-------------------------------
# on the Windows 10 side
# find the connecting ethernet device properties
> Edit > Manual IP address > IP4
> IP = 192.168.0....
> Prefix Length = 24
> Gateway = 192.168.0.1
> DNS = 192.168.0.1
# save and try it now
# firefox
sudo apt install firefox-esr
# install Sys V banner and figlet
sudo apt install sysvbanner # then run "banner test"
sudo apt install figlet
# fortune command
sudo apt install fortune-mod # run "fortune"
# to create your own
vi myfortune # fill with quotes separated by a line with %
strfile -c % myfortune myfortune.dat
# test it by fortunte myfortune
# to be permanently included: 
sudo cp myfortune* /usr/share/games/fortunes/ #two files only
# to be automatically invoked in a new terminal
add "fortune" to the end of ./.bashrc file
# YT-DL (source)
sudo wget https://yt-dl.org/downloads/latest/youtube-dl -O /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl
youtube-dl -U
# OpenVPN (source)
sudo apt install openvpn
# copy ovpn file over to /etc/openvpn
sudo openvpn (file.ovpn)

For Home VPN Server client file, to access local LAN

# add the following line to the client ovpn file before signature
route 192.168.xxx.1 255.255.255.0 192.168.xxx.1
# then re-import (or directly edit the ovpn file in Openvpn GUI)
#
# * however not sure if this is the right way to do it...
# 
# =========== HAVE SOME FUN ================ #
# rig - random identiy/name generator
sudo apt install rig
rig
# asciiview - seeing jpg in ascii format
sudo apt install aview
sudo apt install imagemagick
asciiview abc.jpg
# Text to Speech TTS setup (source)
sudo apt install espeak
espeak "Hello World" 2>/dev/null
# additional there are python modules too
# check out the source info
# mypaint
sudo apt install mypaint
# kodi on raspi OS
sudo apt install kodi
sudo kodi # must sudo; otherwise mouse/kbd don't work
# UTube DL (source)
sudo apt install snapd
sudo reboot
sudo snap install youtube-dl
youtube-dl (weblink)
# change window manager (source)
sudo aptitude install x-window-system xfce4 xfce4-themes icewm fluxbox gnome
sudo update-alternatives --config x-window-manager
# add a system start up script
crontab -e
@reboot (script)
# install full xscreensaver (source)
sudo apt-get install xscreensaver xscreensaver-data-extra xscreensaver-gl-extra
# a good screensaver = Polytopes 
# install Freenove project code (no source)
# first enable I2C in raspi-config > Interace Options > I2C (enable)
sudo apt install wiringpi
git clone --depth 1 https://github.com/freenove/Freenove_RFID_Starter_Kit_for_Raspberry_Pi
mv Freenove_RFID_Starter_Kit_for_Raspberry_Pi/ Freenove_Kit/
wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v
gpio readall
pinout
# install OpenMediaVault and Share (Better source) or (source)
# this way (verified working)
wget -O - https://raw.githubusercontent.com/OpenMediaVault-Plugin-Developers/installScript/master/install | sudo bash
# install Brother print driver (specifically Brother HL-L2300D) (source)
sudo apt install printer-driver-brlaser
sudo service cups restart
# grant admin permission 
sudo usermod -a -G lpadmin XNAME
http://localhost:631 (and login with linux credential)
# add a printer (seelct USB connect printer, set names and share)
# for Brother HL-L2300D, select DCP-1510 series, using brlaser v4 (grayscale)
# note: dont select HL-L2300D driver; sometimes it does not work
# run a test page 

Pi Zero Wifi Setup(source.20201112)

#
# edit wpa_supplicant.conf and add the followings:
#
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=

network={
 ssid=""
 psk=""
}

Timelapse (source)

raspistill -t 10000 -tl 2000 -o pic%04d.jpg
# use Kdenlive to build video (source - 20201109)


# FFMPEG - Better way to handle videos # (source)

sudo apt update
sudo apt install snapd
sudo reboot
sudo snap install core
sudo snap install ffmpeg

SAMBA (source)

sudo apt install -y samba samba-common-bin
mkdir ~/xtmp
chmod 777 ~/xtmp
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.org
sudo vi /etc/samba/smb.conf
# add the followings at the end of samba.conf file
[global]
netbios name = XNAME
server string = My File Center
workgroup = WORKGROUP

[xtmp]
path = /home/XNAME/xtmp
comment = No comment
writeable=Yes
create mask=0777
directory mask=0777
public=no
# add samba user and restart server
sudo smbpasswd -a "XNAME"
sudo service smbd restart

Mount Windows Samab Share (source - 20201109)

sudo mount -t cifs -o username= ///folder /mnt/folder

Apache

#setup Apache (source here)

sudo apt install apache2 -y 
#setup Apache login secure website (source here)
# install util file 
sudo apt install apache2-utils
# create user(s) 
sudo htpasswd -c /etc/apache2/.htpasswd USER1 # enter USER1 passwd x 2, passwd file created  
cat /etc/apache2/.htpasswd #check the users are created 
# config apache2 security feature
sudo vi /etc/apache2/sites-enabled/000-default.conf 
# add the following lines literally, before </VirtualhHost> tag 
    <Directory "/var/www/html">
        AuthType Basic
        AuthName "Restricted Content"
        AuthUserFile /etc/apache2/.htpasswd
        Require valid-user
    </Directory>
# save and retart apache2 and check the login 
sudo service apache2 restart

Wordpress (source)(php-gd source)

# copy and paste into command line 
# between # XXXXXXXXXXXXXXXX
# install apache2
sudo apt install apache2 -y
# install php
sudo apt install php -y
sudo apt install php-gd -y
# install MariaDB
sudo apt-get install mariadb-server php-mysql -y
sudo service apache2 restart 
# download WordPress
sudo rm /var/www/html/* 
sudo wget http://wordpress.org/latest.tar.gz
sudo tar xzf latest.tar.gz
sudo mv /var/www/html/wordpress/* /var/www/html/.
sudo rm -rf /var/www/html/wordpress /var/www/html/latest.tar.gz
sudo chown -R www-data: /var/www/html/.
pwd
# XXXXXXXXXXXXXXXXXXXXXXXXX
# setup WordPress DB
sudo mysql_secure_installation

	Enter - no root password yet

	Y = remove anonymous users
	Y = disallow root login remotely 
	Y = remove test database and access to it 
	Y = reload privilege tables now 

sudo mysql -uroot -p
	create database wordpress;
	GRANT ALL PRIVILEGES ON wordpress.* TO 'root'@'localhost' IDENTIFIED BY 'YOURPASSWORD';
	FLUSH PRIVILEGES;
	(ctrl-D)
(open a browser) -> http://localhost 
	English (US)
	wordpress 
	root 
	(your root passwd)
	(host IP address)
	wp_
	[Submit]
	[Run the install]
(open another browser) -> http://localhost/wp-admin 
	fill out the blanks
	* go to Settings / General -> wordpress URL = 192.168.??.??
	* go to Settings / General -> site URL = 192.168.??.??
	* go to Settings / Permalinks -> "Post name" 
(back to OS)
sudo a2enmod rewrite
sudo vi /etc/apache2/sites-available/000-default.conf
# add the following 3 lines after line 1:
	<Directory "/var/www/html">
	AllowOverride All
	</Directory>
sudo service apache2 restart
# Install RapidWP or GridMe Theme (look good)

Enable CGI-BIN on Apache2 (source)

sudo a2enconf serve-cgi-bin
sudo a2enmod cgi
sudo service apache2 restart
# put your python scripts in /usr/lib/cgi-bin
# all programs: www-data:www-data, 755

run BASH scripts in CGI-BIN on Apache2 (source)

# do the above enabling things first
sudo vi /usr/lib/cgi-bin/test.cgi
# add the following script content: 
-------------------------------
#!/bin/bash
echo -e "Content-type: text/html\n\n"
echo "Hello World"
-------------------------------
# Then 
sudo chmod +x /usr/lib/cgi-bin/test.cgi
# and try it...
http://(address)/cgi-bin/test.cgi

run python scripts in CGI-BIN on Apache2(source) and (source) and (source) and (source for cgi/bash scripts)

# READ UP ON the above articles
# SAMPLE.py script: 
#
#!/usr/bin/python
# to enable debugging, uncomment: 
# import cgitb
# cgitb.enable()
print "Content-Type: text/plain\r\n\r\n"
print "Hello World!"
print "now today's work"
import os
print os.popen("echo hello hello hello").read()
print os.popen("ls -l | grep txt").read()
# 
# END OF SAMPLE SCRIPT 
# Run http://localhost/cgi-bin/SAMPLE.py

Sample Shell Script in CGI-BIN

#!/bin/bash
echo "Content-type: text/html"
        echo ""
        echo ''
        echo ''
        echo ''
        echo 'Hello World'
        echo ''
        echo ''
        echo "
" echo "Today is " date echo "
" echo "TODAY's WORK
" grep "2W1 #" test.txt | sed '/2W1/a
' echo '' echo '' exit 0

Python3 and tkinter(source)

# Install library
sudo apt install python3-tk
# If you work from a remote ssh then set DISPLAY
export DISPLAY=:0
# run python3 and test
python3
>>> import tkinter as tk
>>> window = tk.Tk()
>>> hello = tk.Label(text="Hello there!")
>>> hello.pack()

Direct Eithernet with Windows 10 (source)

# Connect directly with an ethernet cable.
# If both IP addresses are on the same subnet,
# you are good to go and ssh it
# to copy files to windows
pscp -P 22 USERNAME@IP_ADDRESS:/DIRECTORY_PATH/FILENAME .

Syncthing

# install syncthing (source)
sudo apt install syncthing
vi ~/.config/syncthing/config.xml
# change 127.0.0.1 to 0.0.0.0
syncthing (then ctrl-c to end)
# Making it a service
# sudo service syncthing start
crontab -e (and add the following line)
@reboot /usr/bin/syncthing


Allow Headless RPi VNC Server (source)

sudo raspi-config
-> Advanced Options -> Resolution
Select anything but the default (e.g. 1920 x 1080) -> Ok
and reboot

Add a second virtual remote realVNC desktop (source)

sudo vi /etc/systemd/system/vncvirtualdesktop.service
# and insert the followings:
[Unit]
Description=Start VNC Server Virtual Desktop

[Service]
Type=oneshot
ExecStart=/bin/su pi -c '/usr/bin/vncserver -randr=1280x1024'
ExecStop=/usr/bin/vncserver -kill :1
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
# and save, exit, and enable the service
sudo systemctl enable vncvirtualdesktop.service
# and reboot and VNC to x.x.x.x:1 (the :1 display)


Octopi Setup

# obtain (Octopi image)
# write to SD card and edit wifi file at /boot folder

# notepad++ /boot/octopi-wpa-supplicant.txt
# uncomment Network = {...} and uncomment Country = US
# also add scan_ssid=1 inside {...} if wifi ssid is hidden (source)
# after installed on rpi, boot, login: pi/raspberry
# change password by "passwd" command
# then you can login remotely via the web interface http://ip_address


3.5" Screen Driver (NOTE: use 2019-09-26 Buster Full Image + MHS35B-show script) (source)

# must update first; otherwise install will crash
sudo apt update
sudo rm -rf LCD-show
git clone https://github.com/goodtft/LCD-show.git
chmod -R 755 LCD-show
cd LCD-show/
sudo ./MHS35B-show
# rotate screen e.g. 270 degrees
sudo ./rotate.sh 270
# switch to HDMI
sudo ./LCD-hdmi


Timelapse and Zips

#!/bin/bash
#
# Timelapse first
#
tlhome="/tmp/tl"
mark=`date +%F-%H`
mkdir $tlhome/$mark
chmod 777 $tlhome/$mark
raspistill -t 5000 -tl 1000 -o $tlhome/$mark/$mark-%04d.jpg
sleep 60
#
# Zip at the end
# 
zipfile=/var/www/html/xtmp/zips/$mark.zip
zip -r $zipfile $tlhome/$mark
if test -f "$zipfile"; then
	rm -r $tlhome/$mark
fi


Hidden SSID Wifi Connection

# create an empty file ssh at the root folder # edit wpa_supplicant file and mod/add below

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US
 
network={
        ssid="your hidden SSID"
        scan_ssid=1
        psk="your password"
        key_mgmt=WPA-PSK
	}

Minimal Raspberry Pi Lite + Pixel Desktop (source)

# install Raspi OS Lite 
sudo apt install raspberrypi-ui-mods
# configure everything (locale, keyboard, passwd,...)

PIR Sensor Test Program

import RPi.GPIO as GPIO
import time
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
PIN = 4
X = 0
GPIO.setup(PIN, GPIO.IN)         #Read output from PIR motion sensor
try: 
	print "starting"
	while True:
		i=GPIO.input(PIN)
		if i==0:                 #When output from motion sensor is LOW
			X += 1
			print "No motion",X, "sec"
			time.sleep(1)
		else:               #When output from motion sensor is HIGH
			print "something moving",i
			X = 0
			time.sleep(1)
except KeyboardInterrupt: 
	print "out"
	GPIO.cleanup()

MMM Config File

/* Magic Mirror Config Sample
 *
 * By Michael Teeuw https://michaelteeuw.nl
 * MIT Licensed.
 *
 * For more information on how you can configure this file
 * See https://github.com/MichMich/MagicMirror#configuration
 *
 */

var config = {
	address: "localhost", 	// Address to listen on, can be:
							// - "localhost", "127.0.0.1", "::1" to listen on loopback interface
							// - another specific IPv4/6 to listen on a specific interface
							// - "0.0.0.0", "::" to listen on any interface
							// Default, when address config is left out or empty, is "localhost"
	port: 8080,
	basePath: "/", 	// The URL path where MagicMirror is hosted. If you are using a Reverse proxy
					// you must set the sub path here. basePath must end with a /
	ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], 	// Set [] to allow all IP addresses
															// or add a specific IPv4 of 192.168.1.5 :
															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.1.5"],
															// or IPv4 range of 192.168.3.0 --> 192.168.3.15 use CIDR format :
															// ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.3.0/28"],

	useHttps: false, 		// Support HTTPS or not, default "false" will use HTTP
	httpsPrivateKey: "", 	// HTTPS private key path, only require when useHttps is true
	httpsCertificate: "", 	// HTTPS Certificate path, only require when useHttps is true

	language: "en",
	logLevel: ["INFO", "LOG", "WARN", "ERROR"],
	timeFormat: 24,
	units: "metric",
	// serverOnly:  true/false/"local" ,
	// local for armv6l processors, default
	//   starts serveronly and then starts chrome browser
	// false, default for all NON-armv6l devices
	// true, force serveronly mode, because you want to.. no UI on this device

	modules: [
		{
			module: "alert",
		},
		{
			module: "updatenotification",
			position: "top_bar"
		},
		{
			module: "clock",
			position: "top_left"
		},
		{
			disabled: true,
                	module: 'mmm-moon-phases',
                	position: 'bottom_left',
        	},
		{
			disabled: true,
			module: 'MMM-PIR-Sensor', 
				position: "top_center", // Remove this line to avoid having an visible indicator
				config: {
					sensorPin: 4,
					powerSavingDelay: 30, // Turn HDMI OFF after 60 seconds of no motion, until motion is detected again
					preventHDMITimeout: 4, // Turn HDMI ON and OFF again every 4 minutes when power saving, to avoid LCD/TV timeout
					supportCEC: true, 
					presenceIndicator: "fa-eye", // Customizing the indicator
					presenceOffIndicator: "fa-eye", // Customizing the indicator
					presenceIndicatorColor: "#f51d16", // Customizing the indicator
					presenceOffIndicatorColor: "#2b271c" // Customizing the indicator
				}
		},
		{
			// disabled: true,
			module: "MMM-Wallpaper",
			position: "fullscreen_below",
			config: {
				source: "/r/EarthPorn",
				slideInterval: 15 * 1000,
				maximumEntries: 30,
			}
		},
		// {
			// disabled: "true",
			// module: "MMM-PoemOfTheDay",
			// position: "Top_right",
			// config: {
				// textLimit: 1000,
				// lineLimit: 10,
				// languageSet: ["en"],
				// updateInterval: 30 * 1000
			// }
		// },
		{
			module: 'MMM-MWWordOfTheDay',
			position: 'top_right',
			config: {
				updateInterval: 120000,
				headerText: "Word of the day"
			}
		},

		{
  		module: 'MMM-Reddito',
  		position: 'top_right',
  		config: {
    			updateInterval: 3600000,
    			headerText: "Reddito",
    			subreddit: "news",
    			sortby: "hot", //hot, new, or top
    			showCount: "25", //Max 25
    			width: "300px",
    			height: "20em",
    			marquee: true,
    			marqueeSpeed: "30000",
  			}
		},
{
    disabled: true,
    module: "MMM-HTMLSnippet",
    position: "top_left",
        config: {
	html: '',
        width: "800px",
        height: "1024px",
        backgroundColor: "#000",
        updateInterval: 3600000, // in milli seconds
    },
},

		{
			disabled: true, 
			module: 'MMM-ImageSlideshow',
			position: 'bottom_right',
			config: {
				fixedImageWidth: '400',
				randomizeImageOrder: 'true',
				imagePaths: ['modules/MMM-ImageSlideshow/XPIX']
				}
		},
	{
		//disabled: true,
		module: "currentweather",
		position: "top_left",
		config: {
			location: "Pasadena",
			locationID: "5381396", 
			units: 'imperial',
			updateInterval: '3600000',
			appid: "616d28e9ad2143ac01c8f27387d0eff9"
		}
	},
	{	//disabled: true,
		module: "weatherforecast",
		position: "top_left",
		header: "5-Day Weather Forecast",
		config: {
			maxHeight: "100%",
			location: "Pasadena",
			locationID: "5381396", 
			appid: "616d28e9ad2143ac01c8f27387d0eff9",
			units: 'imperial',
			updateInterval: '3600000',
			colored:'true',
			roundTemp:'true',
			maxNumberOfDays:'14',
			initialLoadDelay: '500',
			iconTable: {
				    '01d': 'wi-day-sunny',
				    '02d': 'wi-day-cloudy',
				    '03d': 'wi-cloudy',
				    '04d': 'wi-cloudy-windy',
				    '09d': 'wi-showers',
				    '10d': 'wi-rain',
				    '11d': 'wi-thunderstorm',
				    '13d': 'wi-snow',
				    '50d': 'wi-fog',
				    '01n': 'wi-night-clear',
				    '02n': 'wi-night-cloudy',
				    '03n': 'wi-night-cloudy',
				    '04n': 'wi-night-cloudy',
				    '09n': 'wi-night-showers',
				    '10n': 'wi-night-rain',
				    '11n': 'wi-night-thunderstorm',
				    '13n': 'wi-night-snow',
				    '50n': 'wi-night-alt-cloudy-windy'
				}
		}
	},



		{
		disabled: true,
    		module: "MMM-EyeCandy",
    		position: "top_center",
    				config: {
        				maxWidth: "75%",       // Sizes the images. Retains aspect ratio.
        				style: '49',            // Style number or use ownImagePath to override style
        				ownImagePath: 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjROZQ9eQCQos08jeaO64X72WQs1CdugKu8wNJyTupoqxsbyM9veLIVpgczHH68YHBrjNEYx1WuLpZ7MgCS1kNCmmvQqpB-yhB8Q6Pe2WpfEnXMvULz2FmI34q8zEtQJzr_SlYM9vI6d00/s1600/Franchesca+Del+Carpio+with+Py+-+Py25+Studio+%252827%2529.jpg',      // ex: 'modules/MMM-EyeCandy/pix/YOUR_PICTURE_NAME.jpg', or internet url to image
    					}
		},



		{
			module: "calendar",
			header: "US Holidays",
			position: "top_left",
			config: {
				calendars: [
					{
						symbol: "calendar-check",
						url: "webcal://www.calendarlabs.com/ical-calendar/ics/76/US_Holidays.ics"					}
				]
			}
		},
		{
			module: "compliments",
			position: "lower_third"
		},
		{
			disabled: true, 
			module: "currentweather",
			position: "top_right",
			config: {
				location: "New York",
				locationID: "", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
				appid: "YOUR_OPENWEATHER_API_KEY"
			}
		},
		{
			module: "weatherforecast",
			position: "top_right",
			header: "Weather Forecast",
			config: {
				location: "New York",
				locationID: "5128581", //ID from http://bulk.openweathermap.org/sample/city.list.json.gz; unzip the gz file and find your city
				appid: "YOUR_OPENWEATHER_API_KEY"
			}
		},
		{
			module: "newsfeed",
			position: "bottom_right",
			config: {
				feeds: [
					{
						title: "New York Times",
						url: "https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml"
					}
				],
				showSourceTitle: true,
				showPublishDate: true,
				showDescription: true,
				lengthDescription: 500,
				reloadInterval: 3600000,
				broadcastNewsFeeds: true,
				broadcastNewsUpdates: true
			}
		},
			{
				module: 'calendar_monthly',
				position: 'top_left',
				config: {
						// The config property is optional
						// Without a config, a default month view is shown
						// Please see the 'Configuration Options' section for more information
				}
			},
	]
};

/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

Windows 10 powershell batch rename (source.20201118)

Dir *.jpeg | rename-item -newname {  $_.name  -replace ".jpeg",".jpg"  }

Windows FFMPEG splitting and merge videos (source)

# to split vidoes (Windows)
ffmpeg -i INPUTFILE.mp4 -an -c copy -map 0 -segment_time 00:00:02 -f segment -reset_timestamps 1 OUTPUTFILE%03d.mp4
# -i: input file
# -an: no audio
# -c: copy audio and video
# -map: reset to keyframe
# -segment_time: HH:MM:SS spliting time interval
# -reset_timestamps 1: prevent half-way split artifacts?
# OUTPUTFILE03d.mp4: output file name with 3 digit coutner
#
# to concat videos (Windows)
ffmpeg -f concat -i MYLIST.txt -c copy OUTPUTFILE.mp4
#

on RPI Run video split and random merge shell script

#!/bin/bash
# Usage: v.sh input_file seconds
extension=`echo $1 | grep -o '...$'`
ffmpeg -i $1 -an -c copy -map 0 -segment_time 00:00:$2 -f segment -reset_timestamps 1 middle%
03d.$extension
listmid="_list.$1.txt"
ls middle* | sed 's/^/file / ' > $listmid
cat $listmid | shuf -o $listmid
ffmpeg -f concat -i $listmid -c copy output.$1.$2.$extension
mkdir MIDDLES.$1
mv middle* MIDDLES.$1
mv $listmid MIDDLES.$1

Add Javascript to HTML (source)

My First JavaScript

BLOGSPOT RELATED

Soho theme: remove share side bar (source)

# add the following in the THEME/CUSTOMIZE/ADD CUSTOM CSS
@media screen and (min-width: 1024px) {
  .post-sidebar {
    width: 70px;
  }

  body.item-view .widget.Blog .post {
    width: auto;
  }

  body.item-view .widget.PopularPosts,
  body.item-view .post-outer-container .inline-ad,
  #comments {
    margin-left: 70px;
    width: auto;
  }
}

.post-sidebar .post-share-buttons {
  visibility: hidden;
}
#
# Also you can turn off the left side labels or others in the LAYOUT section inside Page Body > Blog Posts box
# 

Post a Comment

0 Comments