When you are spending your day in the terminal , you will find that navigating using only the arrows keys although fine at the the start will frustrate you because it’s quite slow.
Bash come with a lot of keyboard shortcuts design to gain precious time.
CTRL+A # will move the cursour to the beginning of the line
CTRL+E # moves to end of line CTRL+C # halts the current command and back to prompt
CTRL+D # deletes one character backward or logs out of current session, similar to exit CTRL+K # deletes all the text forward to the end of the line CTRL+L # clears screen and redisplay the line CTRL+R # searches history entering keyword ,
CTRL+T # transposes two characters CTRL+U # kills backward from point to the beginning of line CTRL+W # kills the word behind the cursor
i’ve put in bold the shortcuts that i use every day , i don’t use CTRL+A and CTRL+E because the keyboard has keys that are foing the same thing.
il you need to run a script unattended and wish to log the output of that script you must already know that you can simply do
the problem with that is you will not log the error messages , only the output messages ,
the error are going to be displayed on the terminal but , not logged
and the error message are often as important as the output message , we do not want to dismiss them from the log ,
the solution to that issue is to run the script using this
With this , both the output will be logged in to the log file.
As you know if you own the orange pi zero, the board run very hot. Running it without an heat sink is not really possible if your board is doing anything other than idling
and even with an heatsink you will encounter throttling if your application is a little intensive.
In an other article I managed to get a fan running controlled by the gpio’s.
A cron check every minute the cpu temperature, if it’s above a set temperature, the fan turn on.
If it’s under, the fan turns off.
The first time I did that project it was on my first orange pi zero. I made some mistakes in my wiring and, because of that, the fan only received 2.5v, it was spinning very slowly, and I was obliged to do some bash trickery to get the fan to start.
My original orangepi zero was lost during an apartment change.
I decided to order a new one and this time, I wanted to do the best work I could to integrate the fan and heatsink.
I found an acrylic case for the orange pi zero on aliexpress.
And after receiving my orange pi zero, I saw the board was a new revision, it was running even hotter than my previous orange pi zero.
Few days after receiving the board, the case arrived. It was very pretty but it was blocking any air circulation. And the heatsink had no medium to dissipate the heat since the air was hot and not circulating around the metal.
The CPU temperature rapidly ascended to 80°c.
I own several old fans disassembled from old graphics card, and one of the small fans was just the perfect size. I cut a circular hole in the top acrylic plate so the air from the fan could enter and go trough the radiator fins. The air should after exit from a void in a face of the case were optional usb port are placed.
How to use that fan?
The problem with gpio’s is that they only push very weak current and volts (3.3v). You cannot run a fan directly from a gpio.
But you can use a gpio to control an electronic switch (a transistor) that will be able to run the fan
You should use a npn transistor. They are the most common and cost next to nothing. You will find them for free when you tear down old broken power supply.
To turn on and off your switch, you just have to send 1 or 0 on it’s base.
A great way to control the gpio’s of the opi zero is with the help of that library called WiringPI
you will find instructions on how to install the library on the github page.
after installation lauch the command gpio readall
i chose the gpio.7 to control my fan ,
conveniently the gpio 7 is placed in the 7th place on the board , and his wPi alias is also 7
as you can see in the attached capture it’s not always the case !
i then solder my fan and transistor following this diagram :
To continue , i must write a script that check for the cpu temperature , and activate the fan if the cpu temperature is above a certain set threshold.
then , using crontab , set this script to launch every minutes.
add the line * * * * * /root/fan-control.sh to your cron jobs , using the command crontab -e
thanks to this script your fan should automatically launch when your Orange is charged , and stop when it’s return to idling.
One of my project with my OrangePI is to setup the device as a basic IP security camera server ,
the OrangePI zero , will connect to RTSP flux of the IP camera , and dump the stream on to an external disk , where it will be kept for 7 days before getting automaticly deleted
At a latter date i will run a motion detection program on these files and send a mail if motion is detected on a specific part of the frame.
after a little research , i found that a lot of people are using a program called openRTSP to record their RTSP stream to disk
But , after connecting on my OrangePi zero and trying to look for the program i found out that it’s not part of the default installation of armbian stable.
I tried to install the package using apt install openRTSP
I went to google and searched , openRTSP package ,and found out , on the debian website that openRTSP is part of the livemedia-utils package,
I went back to my SSH session and typed apt-get install livemedia-utils
There is no man pages associated with the program , you have to rely on the developer website to understand all the different options . The documentation is available here : http://www.live555.com/openRTSP/ or here if the website is down.
but as usual , in the officials repositories you only get dated version
you might want to compile the source code to have the last version available:
Go to /usr/src: cd /usr/src
Get the live555 liveMedia source code: wget http://www.live555.com/liveMedia/public/live555-latest.tar.gz
Unpack it: tar -xzf live555-latest.tar.gz
Go into the unpacked directory: cd live
Generate the make files: ./genMakefiles linux
Build the code: make
Install the latest version: make install
The issue when you download movies online, is that most of the time the file name is going to be complete trash , filled with useless info like the team that made the rip or the website from where the movie was downloaded.
This is very annoying when you sort by name and the website made the idiotic decision to put their name in front of the actual film name.
for example here a typical movie name [ Torrent9.info ] Dont.Think.Twice.2016.FRENCH.WEBRip.XviD-NEWCiNE.avi
the actual useful data that i wish to keep is Dont.Think.Twice.2016.avi
for this purpose i’ve developped a small bash script that will list all the files in a chosen directory then , if necessary , will rename the file.
this is not a very efficient script
but it’s fulfill it’s purpose and very rarely encounter a filename that he is unable to clean.