Saturday, October 14, 2023

Linux Cheat sheet

1) CLI Equivalent of "Safely Remove Drive"?
fdisk -l | grep Disk | egrep '/sd'

Tested on Ubuntu 20.04

Using udisks2: Detach a disk with udisks2:

udisksctl unmount -b /dev/sdXY
udisksctl power-off -b /dev/sdX
Example if my drive is /dev/sdb1:
udisksctl unmount -b /dev/sdb1
udisksctl power-off -b /dev/sdb
Similarly to above, power-off can be used to detach the drive even if there are no partitions mounted, or no partition was ever mounted:
udisksctl power-off -b /dev/sdb
2)

Saturday, July 29, 2023

Youtube-dl examples

Install

To install it right away for all UNIX users (Linux, OS X, etc.), type:
sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
sudo chmod a+rx /usr/local/bin/youtube-dl

Ffmpeg vIdeo edit example for FB reels

ffmpeg

1. Go to directory.

cd ~/Videos/20230816-imsa

2. Generate cut/trim script.

ls V*.mp4 | sed 's/^/ffmpeg -i /; s/$/ -ss 00 -to 05 -c copy o.mp4/'

3. Edit the cut/trim script.

ffmpeg -i VID_20230816_060307.mp4 -ss  0 -to  6 -c copy o1.mp4
ffmpeg -i VID_20230816_060551.mp4 -ss 15 -to 22 -c copy o2.mp4
ffmpeg -i VID_20230816_060635.mp4 -ss  3 -to 23 -c copy o3.mp4
ffmpeg -i VID_20230816_060635.mp4 -ss  6 -to 10 -c copy o0.mp4 #fb reels thumbnail
ffmpeg -i VID_20230816_060758.mp4 -ss  8 -to 20 -c copy o4.mp4
ffmpeg -i VID_20230816_061349.mp4 -ss 1:44 -to 2:0 -c copy o5.mp4
ffmpeg -i VID_20230816_061821.mp4 -ss  0 -to 25 -c copy o7.mp4

4. Generate the concat list.

ls o*.mp4 | sed 's/^/file /' > list.txt

5. Edit concat list.

file o0.mp4
file o1.mp4
file o2.mp4
file o3.mp4
file o4.mp4
file o5.mp4
file o7.mp4

6. Execute concat.

ffmpeg -f concat -i list.txt -c copy o.mp4

7. Create title file.

cat << EOF > title.txt
2023/08/16
Bagong pisa
EOF

8. Generate the final script.

vid-vlog-reels.sh o.mp4  title.txt  reels.mp4

9. Final cript.

ffmpeg -t 90 -i o.mp4 \
  -filter_complex "
    [0:v]scale=-2:1920
      ,drawtext=enable='between(t,1,6)' \
        :fontsize=96 \
        :fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf :fontcolor=white@0.99 \
        :textfile=title.txt :x=(w-text_w)/2 :y=h/100 \
        :shadowcolor=black :shadowx=4 :shadowy=4  \
      ,drawtext=enable='between(t,1,89)'   \
        :fontsize=76 \
        :fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf :fontcolor=white@1.0 \
        :text='©TotsPo' \
        :box=1 :boxcolor=black@0.5 :x=(w-text_w)-text_h/2: y=(h-1.5*text_h)  \
      [v]    
" -map [v] \
  -map 0:a -c:a copy \
  -preset veryfast \
  -movflags faststart \
-y reels.mp4
echo
ls -lh reels.mp4
See output video.

Thursday, July 20, 2023

LTO Motorcycle Registration 2023 for less than a year old

 Last November 2022, I bought a new motorcycle. It was registered by the dealer two weeks after then got my certificate of registration(CR) and official receipt(OR) on mid January. My plate number ends with 7 (e.g 127ABC). 

As per LTO FAQ on Motor Vehicle Registration registration schedule :

1 - January
2 - February
3 - March
4 - April
5 - May
6 - June
7 - July
8 - August
9 - September
0 - October

Which means that I should make my renewal by July and not November. I such cases LTO will only extend the validity of the registration for another year. 

Requirements :

For smooth transaction, prepare the following :

PHP   5 : 2 photocopy of OR and CR (1 for CTPL and 1 for LTO)
PHP 302 : Insurance(CTPL) I got from Cebuana which is the cheapest that I know
PHP 202 : LTO fee
====================
PHP 509.00 : Total expense

Not Required :

It  will be a waste of time and money for the following as they are not needed.

Emission test (which cost at least PHP450)
Stencil of engine and body number

Steps : 1st try (Failed due to No CTPL)

You can skip this if you have the mentioned requirements earlier.

1) Reception 

Present OR/CR photocopy then consolidate it with the given queue/number and noted that it is for adjustment. Below is my copy of my first queue number.

 

Was advise to go to window 5

2) Window 5

Was advise to go to acquire CTPL first. My queue number was also discarded.

3) Cebuana

Purchased CTPL 



Steps : 2nd try OK (with complete requirements)

 1) Reception

With my CTPL and OR/CR photocopy I was advise to go to motor vehicle inspector for inspection

2)  Motor vehicle inspector

Visual inspection of motorcycle then consolidate my documents with his form.

It is located in a "kubo" just outside LTO Ligao. If I'm not mistaken this is Window 4 in queue number.

3) Reception (around 10:30AM)

Go back to get my new queue/number

4) Window 5

 Pass the documents and form.

5) Window 10 (Cashier)

Paid PHP202.

6) Window 3 (Releasing)(About 10:50AM)

I've got my OR :










 

 

With complete requirements, It can be done in less than hour in LTO Ligao


Let me know your thoughts on this.

Monday, April 25, 2022

Wiki Template 3

Main

test 

Main Optional Required PostgreSQL Barman Replication

Ubuntu 20.04 Reformat



Table of Contents

1 Hardware

  • root@asus-u20:~# lshw -short | egrep 'Description|==|system|Wireless|disk|processor|SODIMM|sba' | grep -v PnP
    H/W path         Device     Class          Description
    ======================================================
                                system         X202EP (ASUS-NotebookSKU)
    /0/b/0                      memory         4GiB SODIMM DDR3 Synchronous 1333 MHz (0.8 ns)
    /0/c                        processor      Intel(R) Celeron(R) CPU 847 @ 1.10GHz
    /0/100/1c.1/0    wlp2s0     network        AR9485 Wireless Network Adapter
    /0/11/0.0.0      /dev/sda   disk           500GB ST500LT012-9WS14
    /0/12/0.0.0      /dev/sdb   disk           15GB Ultra
    /0/12/0.0.0/0    /dev/sdb   disk           15GB
    

2 Keyboard

  • Keyboard installed does not have an insert key. To add insert key

    xev | grep -i key     # then press insert key, take note of the keycode for the below command
    xmodmap -e "keycode 248 = Insert"
    
    Add to ~/.bashrc to persist upon reboot.

3 Install

  • apt-get update
    apt-get install gparted
    apt-get install sysstat
    apt-get install nethogs
    apt-get install mplayer
    apt-get install xournal   # pdf filler editor
    apt-get install openssh-server
    

Saturday, September 26, 2020

Grafting Carabao Mango (Guimaras - Tanaleon)





 
 
 
Bud shows 11-days after leaves removed

Cut the Scion

Cut the Rootstock




 
Mango graft is done. Cover with platic to trap moisture then place in shaded area for a few days.