Thursday, July 24, 2025

Mengenal fitting/socket lampu mobil & motor

Socket/fitting lampu mobil "H": 

  1. H1: lampu utama, kaki 3 
  2. H3: lampu kabut, kaki 2
  3. H4: lampu utama, kaki 3 
  4. H7: lampu halogen, kaki 2
  5. H11: lampu kabut, kaki 2
  6. H16: lampu kabut, kaki 2 
  7. 9005 (HB3) & 9006 (HB4): lampu halogen, kaki 2 
  8. H13 (9008): lampu utama, kaki ?
  9. HIR1 (9011) dan HIR2 (9012): perbaikan design 9005 (HB3) & 9006 (HB4)

Socket/fitting lampu mobi putar / bayonet:

  1. S25 (Single Contact / Double Contact)
  2. P21W, PY21W, P21/5W
    1. P21W (BA15S): Bohlam 21 watt dengan soket S25 single contact, sering untuk lampu sein atau mundur.
    2. PY21W (BAU15S): Mirip dengan P21W, tapi pin penguncinya tidak sejajar (offset), biasanya untuk lampu sein berwarna oranye.
    3. P21/5W (BAY15D): Bohlam 21/5 watt dengan soket S25 double contact, sangat umum untuk lampu rem/senja. 

Socket/fitting lampu motor "H": 

  1. M4/H6: lampu utama, kaki 2 
  2. HS1: lampu utama kaki 3
  3. H4: lampu utama kaki 3
  4. H7: lampu halogen kaki 2

Socket/fitting lampu motor putar / bayonet: 

  1. P21/5W double contact
  2. P21 single contact 

Socket/fitting lampu mobil & motor T (tancap):

  1. T10: kaki 2 dan 3
  2. T15: kaki 2
  3. T20: kaki 2 dan 3 

 Standar lampu https://dedetoknotes.blogspot.com/2023/02/standar-daya-lampu-mobil.html 

Thursday, July 17, 2025

Debian 12: KVM Virtualization - creating guest (part 3)

To show available os for guest

$ virt-install --osinfo list | grep arch
archlinux

To use bridge add /etc/qemu/bridge.conf if not available and chmod file /usr/lib/qemu/qemu-bridge-helper
# mkdir /etc/qemu
# touch /etc/qemu/bridge.conf
# echo "allow br0" >> /etc/qemu/bridge.conf
# chmod u+s /usr/lib/qemu/qemu-bridge-helper

To create guest with name=guest01, disk size 10GB, Ram 2Gb (2048), virtual processor 2, os variant debian 12 (not available, we use debian11), boot from iso file: 

$ virt-install \
  --name guest01 \
  --memory 2048 \
  --vcpus 2 \
  --disk path=/home/dedetok/guests/guest01.qcoe2,size=10,bus=virtio \
  --cdrom /home/dedetok/Downloads/debian-12.11.0-amd64-netinst.iso \
  --nonetworks \
  --os-variant debian11 \
  --virt-type kvm

Parameters:

  • --name: name to identify guest
  • --ram: guest memory in megabytes
  • --vcpus: number of cpu for guest
  • --disk: path=<path_to_disk_image>,size=<disk_size_in_gb>,bus=virtio
    virtio is standard interface for virtual machines, it improve vm network performance
  • --cdrom: install from iso file or CD/DVD/USB
  • --nonetworks: no update or install from internet 
    or
    --network bridge=br0,model=virtio to use bridge network, see part 2
    For bridge see Network Bridge section

Options:

  1. Graphics option
    • --graphics vnc: Enables VNC for graphical access. If virt-viewer is installed, it will automatically launch. If not, you'll need to manually connect using a VNC client like vinagre or remmina.
    • --graphics spice: Enables SPICE for graphical access. SPICE is generally considered more modern and efficient than VNC.
    • --graphics none: Disables graphical access and forces a text-mode installation using the serial console.
  2. Disk option
    • Default folder for virtual disk /var/lib/libvirt/images/
      qcow2 offers features that raw (or img) doesn't:
      1. Snapshots: qcow2 allows you to create snapshots of your virtual machine's disk, enabling easy rollback to previous states.
      2. Compression: It can compress the disk image, potentially saving storage space.
      3. Sparse files: qcow2 supports sparse files, meaning it only allocates disk space for used portions of the image, which can be more efficient.
    • raw format (or just img when using virt-install) has no special features:
      It simply represents the raw data of the disk, which can be less flexible and potentially wasteful of disk space.

To show version
$ virsh version
Compiled against library: libvirt 9.0.0
Using library: libvirt 9.0.0
Using API: QEMU 9.0.0
Running hypervisor: QEMU 7.2.17

Managing VM

To List guest cm
$ virsh list --all

Connect to vm
$ virsh console [vm_name]
or using virt-viewer
$ virt-viewer [vm_name]

To edit vm
$ virsh edit [vm_name]

To start vm
$ virsh start [vm_name]

to restart vm
$ virsh reboot [vm_name] --mode initctl

to force stoping vm
$ virsh destroy [vm_name]

to force shutdown vm
$ virsh shutdown [vm_name] --mode acpi

to suspend vm
$ virsh suspend [vm_name]

to resume vm after suspend
$ virsh resume [vm_name]

to reset vm (similiar to pressing reset button on physical PC)
$ virsh reset [vm_name]

Restarting KVM Daemon
# systemctl restart libvirtd

to remove vm and its storage permanently
$ virsh undefine --managed-save --remove-all-storage [vm_name]

To make vm auto run after host restart (run once)
$ virsh autostart [vm_name]

Network bridge

Network configuration file:

  1. /etc/libvirt/qemu/networks/default.xmlfir active configuration
  2. /usr/share/libvirt/networks/default.xml for template

To enable network bridge for guest:

  1. turn up bridge interface
  2. list all network using virsh net-list
  3. if list is empty, define default network and edit default network to use existing bridge
  4. start network bridge

To turn up bridge interface
# ifup br0

To show bridge interface
# brctl show
bridge name    bridge id        STP enabled    interfaces
br0        8000.9aa237b1bcc8    no        enp2s0

To show network bridge (if list empty, see define default network)
$ virsh net-list --all

To define default network
$ virsh net-define /usr/share/libvirt/networks/default.xml

To undefined default network
$ virsh net-undefine default

To edit default network
$ virsh net-edit default

Change default network using edit default netowrk
<network>
  <name>default</name>
  <uuid>84b29e1f-b2c3-4230-bc21-fba0143c026c</uuid>
  <forward mode='bridge'/>
  <bridge name='br0'/>
</network>

To start network bridge
$ virsh net-start default

To auto start network bridge
$ virsh net-autostart default

To add manually bridge network into vm edit vm and add
<domain type='kvm'>
...
 <devices>
    <interface type='bridge'>
      <mac address='52:54:00:87:65:f6'/>
      <source bridge='br0'/>
      <model type='virtio'/>
      <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
...

References:

  • wiki.debian.org/KVM
  • wiki.debian.org/DebianInstaller/Preseed
  • wiki.debian.org/BridgeNetworkConnections


Sunday, June 29, 2025

Debian: repair micro SD card command line

Detect your micro SD card

# dmesg
[  482.261836] scsi 1:0:0:0: Direct-Access     Multiple Card  Reader     1.00 PQ: 0 ANSI: 0
[  482.265756] sd 1:0:0:0: Attached scsi generic sg1 type 0
[  483.034812] sd 1:0:0:0: [sdb] 3911680 512-byte logical blocks: (2.00 GB/1.87 GiB)
[  483.036904] sd 1:0:0:0: [sdb] Write Protect is off
[  483.036931] sd 1:0:0:0: [sdb] Mode Sense: 03 00 00 00
[  483.038288] sd 1:0:0:0: [sdb] No Caching mode page found
[  483.038321] sd 1:0:0:0: [sdb] Assuming drive cache: write through
[  483.058653]  sdb: sdb1
[  483.066093] sd 1:0:0:0: [sdb] Attached SCSI removable disk
# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 298.1G  0 disk
├─sda1   8:1    0 103.6G  0 part
├─sda2   8:2    0   450M  0 part
├─sda3   8:3    0     1K  0 part
├─sda5   8:5    0 120.2G  0 part
├─sda6   8:6    0     2G  0 part [SWAP]
└─sda7   8:7    0  71.8G  0 part /
sdb      8:16   1   1.9G  0 disk
└─sdb1   8:17   1   1.9G  0 part 

Repair file system micro SD card

# umount /dev/sdb1
umount: /dev/sdb1: not mounted.
# umount /dev/sdb
umount: /dev/sdb: not mounted.
# fsck.vfat -a -w /dev/sdb1

option:

  • -a : automatic repair filesystem
  • -w : write change immediately

Format if there is no data you can saved and you want fresh storage in micro SD card 

# mkfs.vfat /dev/sdb1
mkfs.fat 4.2 (2021-01-31)


Tuesday, June 24, 2025

Debian 12: KVM Virtualization - configure bridge network in host (part 2)

By default, KVM Guest will able to use host connection to connect to lan and internet, but not vice versa.

To make host, guest and lan accessible each other, on network configuration we can use is bridging.

Install bridge-util 

# apt-get install bridge-utils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
    bridge-utils
...

Configuring bridge

create bridge interface

# brctl addbr br0

show existing infterface

# ip address show
1: lo: ...
2: enp2s0: ... -> this is lan
3: wlo1: ...-> this is wifi and not supported
4: br0: ...

add interface to bridge

# brctl addif br0 enp2s0 

make it persistence, edit /etc/network/interface

...
# The loopback network interface
auto lo
iface lo inet loopback

# set interface manually, avoid conflict with network manager
iface enp2s0 inet manual
iface wlo1 inet manual

# bridge setup
# dhcp
# avoid conflict with network manager
#auto br0
iface br0 inet dhcp
   bridge_ports enp2s0
# for manual ipv4
# iface bro inet static
#   bridge_ports enp2s0
#   address 1192.168.1.2
#   broadcast 192.168.1.255
#   netmask 255.255.255.0
#   gateway 192.169.1.1

restart networking service

# systemctl restart networking

To make NetworkManager manage your network edit  /etc/NetworkManager/NetworkManager.conf, make sure managed=true

[main]
plugins=ifupdown,keyfile

[ifupdown]
#managed=false
managed=true

Reference:
wiki.debian.org/BridgeNetworkConnections

Wednesday, June 18, 2025

Writing math equation in web using mathjax and latex

Add the mathjax javascript library to the head or body of the html

<script async="" id="MathJax-script" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" type="text/javascript">
</script>

To declare math equation use identifier 
\ (...\) for inline or 
\ [...\] for display

Note: no space between \ ( and \ [  

Example to write 1/2 

in latex: \ frac{1}{2}

in mathjax html (e.q. blogspot): \ ( \ frac{1}{2}\) 

Note: no space between characters above

result 

\(\frac{1}{2}\)

 

If you copy paste from word application with math equation support, the code may become messy, e.q word equation will result in many additional custom html tag. 

Wednesday, June 11, 2025

Trigonometric Identities

 

Trigonometric Identities

 Common degree

degree

Sin

Cos

Tg

0

0

1

0

30 or π/6

45 or π/4

1

60 or π/3

90 or π/2

1

0

infinite







 Reciprocal Trigonometric Identities

  ;    ; 

  ;   ;

 

 

Pythagorean Trigonometric Identities

 

Ratio Trigonometric Identities

 

Trigonometric Identities of Opposite Angles

 

Sin (-a) = – Sin a

Cos (-a) = Cos a

Tan (-a) = – Tan a

Cot (-a) = – Cot a

Sec (-a) = Sec a

Csc (-a) = -Csc a

 

Trigonometric Identities of Complementary Angles

 

Sin (90 – a) = Cos a

Cos (90 – a) = Sin a

Tan (90 – a) = Cot a

Cot ( 90 – a) = Tan a

Sec (90 – a) = Csc a

Csc (90 – a) = Sec a

 

Trigonometric Identities of Supplementary Angles

 

sin (180°- a) = sina

cos (180°- a) = -cos a

cosec (180°- a) = cosec a

sec (180°- a) = -sec a

tan (180°- a) = -tan a

cot (180°- a) = -cot a

 

Sum and Difference of Angles Trigonometric Identities

 

 

Double Angle Trigonometric Identities

 

 

Half Angle Identities

 

 

 

Product-Sum Trigonometric Identities

 

 

 

 

Trigonometric Identities of Products

 

 

 

byjus.com/maths/trigonometric-identities/