Raspberry pi - Hoi-Jeon/Wiki GitHub Wiki

Install Korean font

# Install fonts and Hangul input
sudo apt-get install fonts-unfonts-core ibus-hangul

# Check the wrong permission on the folder
ls -ld .config/ibus

# Delete ~/.config/ibus/
sudo rm -rf .config/ibus

# Run ibus daemon when booting
im-config -n ibus

해볼까?: ibus 실행 안될 때

Print Server

Raspberry Pi Print Server: Setup a Network Printer

# How to add Samsung printer drivers
sudo apt install printer-driver-splix

Samba

Set up a Raspberry Pi as a File Server for your local network

# Where to set up samba configuration
sudo geany /etc/samba/smb.conf

#[share]
#Comment = Pi shared folder
#Path = /share
#Browseable = yes
#Writeable = Yes
#only guest = no
#create mask = 0777
#directory mask = 0777
#Public = yes
#Guest ok = yes

youtube-dl

# Download the mp3 file without upload ID
# Reduce the volume by 12 dB
# Remove the original mp3 file

#!/bin/bash

fileout=$(youtube-dl --get-filename -o %\(title\)s.%\(ext\)s $1)
echo $fileout
youtube-dl --extract-audio --audio-format mp3 -o "%(title)s.%(ext)s" $1
sox "${fileout%.*}".mp3 "${fileout%.*}"_12dB.mp3 gain -n -12
rm "${fileout%.*}".mp3

youtube-dl Download page

Rpi Desktop background change with time

A bash shellcript (bgChange.sh) for changing Desktop background

#!/bin/bash
export DISPLAY=:0
export XAUTHORITY=/home/$USER/.Xauthority
export XDG_RUNTIME_DIR=/run/user/1000
pcmanfm --set-wallpaper=$1 --wallpaper-mode=crop

Edit in crontab

# Launch crontab in nano 
crontab -e

# Example of launching the above shellcript with a wished picture (example.jpg) at 12:00 in every day
0 12 * * * /home/pi/bin/bgChange.sh /usr/share/rpd-wallpaper/example.jpg

Streaming - Video (motion)

# Install
sudo apt-get install motion

# Get the address (e.g. 192.168.xxx.xxx)
ifconfig

# Set for the webcam streaming
sudo geany /etc/motion/motion.conf
# daemon off -> daemon on
# setup_mode on -> setup_mode off: to solve the color quality issue with certain webcams
# stream_localhost on -> stream_localhost off
# webcontrol_localhost on -> webcontrol_localhost off

# Change start_motion_daemon=no to start_motion_daemon=yes
sudo geany /etc/default/motion

# Next enable motion by entering the following at the command line:
sudo systemctl enable motion

# You can confirm motion is running by checking the output from the following command:
sudo service motion status

[Motion Reference] (https://www.instructables.com/How-to-Make-Raspberry-Pi-Webcam-Server-and-Stream-/)

Streaming - Audio (cvlc)

Streaming of ALSA Record device

# Check the card number of ALSA
arecord -L
#**** List of CAPTURE Hardware Devices ****
#card 2: WEBCAM [GENERAL WEBCAM], device 0: USB Audio [USB Audio]
#  Subdevices: 1/1
#  Subdevice #0: subdevice #0

# Launch VLC for streaming in http:\\X.X.X.X:YYYY/out.mp3
cvlc -vvv alsa://plughw:2 --sout '#transcode{acodec=mp3,ab=64,channels=1}:standard{access=http,dst=X.X.X.X:YYYY/out.mp3}'

Streaming of PulseAudio sink

# Check the pulse audio port name
pactl list | grep "Monitor Source" | awk '{print $3}'

#pi@rpifour:~ $ pactl list | grep "Monitor Source" | awk '{print $3}'
#alsa_output.platform-bcm2835_audio.digital-stereo.monitor
#alsa_output.platform-bcm2835_audio.analog-stereo.monitor

# Launch VLC for streaming in http:\\X.X.X.X:YYYY/out.mp3
cvlc -vvv pulse://alsa_output.platform-bcm2835_audio.analog-stereo.monitor --sout '#transcode{acodec=mp3,ab=64,channels=1}:standard{access=http,dst=X.X.X.X:YYYY/out.mp3}'

Bluetooth connection

# How to check the Address of connected devices
bluetoothctl
[NameOfBTDevices]# devices
Device XX:XX:XX:XX:XX:XX NameOfBTDevices

Script for re-pairing Bluetooth devices

#!/bin/bash
bluetoothctl << EOF
power on
connect XX:XX:XX:XX:XX:XX
exit
EOF