Check Linux mint Resource

$ inxi -Fxz
System:
  Kernel: 5.15.0-105-generic x86_64 bits: 64 compiler: gcc v: 11.4.0
    Desktop: Xfce 4.18.1 Distro: Linux Mint 21.3 Virginia
    base: Ubuntu 22.04 jammy
Machine:
  Type: Desktop System: LENOVO product: 90LU0011TA v: ideacentre 510-15ICK
    serial: <superuser required>
  Mobo: LENOVO model: 3714 v: SDK0Q55756 WIN 3273587434641
    serial: <superuser required> UEFI-[Legacy]: LENOVO v: O4KKT0DA
    date: 08/14/2019
CPU:
  Info: 8-core model: Intel Core i7-9700 bits: 64 type: MCP arch: Coffee Lake
    rev: D cache: L1: 512 KiB L2: 2 MiB L3: 12 MiB
  Speed (MHz): avg: 2067 high: 2840 min/max: 800/4700 cores: 1: 2098
    2: 1559 3: 2269 4: 2435 5: 1419 6: 2203 7: 2840 8: 1717 bogomips: 48000
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
Graphics:
  Device-1: Intel CoffeeLake-S GT2 [UHD Graphics 630] vendor: Lenovo
    driver: i915 v: kernel bus-ID: 00:02.0
  Device-2: Generalplus GENERAL WEBCAM type: USB
    driver: snd-usb-audio,uvcvideo bus-ID: 1-3:3
  Display: x11 server: X.Org v: 1.21.1.4 driver: X: loaded: modesetting
    unloaded: fbdev,vesa gpu: i915 resolution: 1920x1080~75Hz
  OpenGL: renderer: Mesa Intel UHD Graphics 630 (CFL GT2)
    v: 4.6 Mesa 23.2.1-1ubuntu3.1~22.04.2 direct render: Yes
Audio:
  Device-1: Intel 200 Series PCH HD Audio vendor: Lenovo
    driver: snd_hda_intel v: kernel bus-ID: 00:1f.3
  Device-2: Generalplus GENERAL WEBCAM type: USB
    driver: snd-usb-audio,uvcvideo bus-ID: 1-3:3
  Sound Server-1: ALSA v: k5.15.0-105-generic running: yes
  Sound Server-2: PulseAudio v: 15.99.1 running: yes
  Sound Server-3: PipeWire v: 0.3.48 running: yes
Network:
  Device-1: Intel Ethernet I219-V vendor: Lenovo driver: e1000e v: kernel
    port: N/A bus-ID: 00:1f.6
  IF: eth0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Intel Dual Band Wireless-AC 3165 Plus Bluetooth driver: iwlwifi
    v: kernel bus-ID: 02:00.0
  IF: wlan0 state: up mac: <filter>
  Device-3: Realtek RTL8153 Gigabit Ethernet Adapter type: USB
    driver: r8152 bus-ID: 1-1:2
  IF: eth1 state: up speed: 10 Mbps duplex: full mac: <filter>
  Device-4: Ralink RT5370 Wireless Adapter type: USB driver: rt2800usb
    bus-ID: 1-8:47
  IF: wlan1 state: down mac: <filter>
  IF-ID-1: docker0 state: down mac: <filter>
  IF-ID-2: lxcbr0 state: down mac: <filter>
Bluetooth:
  Device-1: Intel Bluetooth wireless interface type: USB driver: btusb v: 0.8
    bus-ID: 1-14:10
  Report: hciconfig ID: hci0 rfk-id: 1 state: up address: <filter>
    bt-v: 2.1 lmp-v: 4.2
Drives:
  Local Storage: total: 4.53 TiB used: 3.69 TiB (81.4%)
  ID-1: /dev/nvme0n1 vendor: Apacer model: AS2280P4 1TB size: 953.87 GiB
    temp: 30.9 C
  ID-2: /dev/sda vendor: Toshiba model: DT01ACA200 LENOVO size: 1.82 TiB
  ID-3: /dev/sdb vendor: Hikvision model: HS-SSD-C100 960G size: 894.25 GiB
  ID-4: /dev/sdc type: USB vendor: Western Digital model: WD10EZEX-22MFCA0
    size: 931.51 GiB
Partition:
  ID-1: / size: 908.49 GiB used: 691.83 GiB (76.2%) fs: ext4
    dev: /dev/nvme0n1p2
  ID-2: /home size: 879.12 GiB used: 789.83 GiB (89.8%) fs: ext4
    dev: /dev/sdb1
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 41.0 C mobo: N/A
  Fan Speeds (RPM): N/A
Info:
  Processes: 480 Uptime: 21d 30m Memory: 15.39 GiB used: 13.03 GiB (84.7%)
  Init: systemd runlevel: 5 Compilers: gcc: 11.4.0 clang: 15.0.7
  Packages: 4721 Shell: Bash v: 5.1.16 inxi: 3.3.13
Posted in Application, Debian, Linux Mint | Leave a comment

Set Win11 to Wireless Screen for Mobile and Other Windows

Install Wireless Display App


System Add an optional feature
Search Wireless Display

Install Wireless Display

Search for Run

Waiting for connect

Posted in Network, Application | Leave a comment

Mikrotik Set Current Firmware to Upgrade Firmware

Reboot

Posted in Embedded System, Linux Mint, Mikrotik, Network | Leave a comment

netinstall-cli upgrade firmware

Check Hardware Architecture

Download netinstall-cli and firmware Stable Version
https://mikrotik.com/download

Connect Cable PC Ethernet (LAN) to Mikrotik Boot Port (Ethernet 8) (CCR1009-7G-1C-1S+)
Fix IP Address PC to 192.168.88.2/24

and

Fix IP Mikrotik

Test Ping
$ $ ping 192.168.88.1
PING 192.168.88.1 (192.168.88.1) 56(84) bytes of data.
64 bytes from 192.168.88.1: icmp_seq=1 ttl=64 time=1.47 ms
64 bytes from 192.168.88.1: icmp_seq=2 ttl=64 time=0.762 ms
^C
--- 192.168.88.1 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1002ms
rtt min/avg/max/mdev = 0.762/1.117/1.473/0.355 ms
$ tar -xf netinstall-7.14.2.tar.gz
$ sudo ./netinstall-cli  -a 192.168.88.1 routeros-7.14.2-tile.npk 
[sudo] password for adull:    
Version: 7.14.2(2024-03-27 08:33:46)
Interface Mask: 255.255.255.0
Using Client IP: 192.168.88.1
Using Server IP: 192.168.88.2
Starting PXE server
Waiting for RouterBOARD...
client: 74:4D:28:C1:53:AF
Detected client architecture: tile
Sending and starting Netinstall boot image ... 
Installed branding package detected
Discovered RouterBOARD...
Formatting...
Sending package routeros-7.14.2-tile.npk ...
Ready for reboot...
Sent reboot command

If Waiting for RouterBOARD…
you must set Mikrotik to boot via ethernet and restart

After Upgrade Complete Mikrotik Route reboot
If it loop reboot
press reset button reset and mode
When Green LED Blink
Press Mode Button only 3-5 sec

Posted in Embedded System, Linux Mint, Mikrotik, Network | Leave a comment

ModuleNotFoundError: No module named ‘pymysql’

Error!


    import pymysql
ModuleNotFoundError: No module named 'pymysql'
sudo apt install python3-pymysql
Posted in Language, Linux Mint | Leave a comment

Meeting Room Booking via Google Form, LINE Notify and Google Calendar

Create Google Form

Code Google Form to LINE Notify

// Presented by BrilliantPy.com
 
function sendLineNotify() {
   
    // Editable
    var form = FormApp.openById('xxxx Google Form ID xxxx'); 
    var tokens = ['xxxx LINE Token xxxx']; // For 1 line group
    //var tokens = ['WNFKVX1uXhfAqwLCIPxHiAWNFKVX1uXhfAqwLCIPxHiA','WNFKVX1uXhfAqwLCIPxHiAWNFKVX1uXhfAqwLCIPxHiA']; // For multiple line groups
     
    // Init
    var form_res = form.getResponses()
    var formResponse = form_res[form_res.length - 1];
    var itemResponses = formResponse.getItemResponses();
     
    // Gets an array of all items in the form.
    var items = form.getItems();
    var all_message = form.getTitle() + '\n';
    var all_message_resend = '';
    var all_message_send = '';
    var image_id = [];
    var IMAGE_URL = [];
    var imgThumbnail = [];
    var imgFullsize =  [];
    var file_upload_num = 0;
     
    for (var i = 0; i < itemResponses.length; i++) 
    {
      if (itemResponses[i].getItem().getType() == "GRID") 
      {
        var mrow = items[i].asGridItem().getRows();
        var mcol = items[i].asGridItem().getColumns();
        var itemResponse_val = itemResponses[i].getResponse().toString().split(",")
         
        all_message += (i+1) + ') ' + itemResponses[i].getItem().getTitle() + ' : ' + '\n';
         
        for (var j = 0; j < mrow.length; j++)
        {
          all_message += '   - ' + mrow[j] + ' : ' + itemResponse_val[j] + '\n';
        }
      }
      else if (itemResponses[i].getItem().getType() == "FILE_UPLOAD")
      {
        image_id[file_upload_num] = itemResponses[i].getResponse()
        IMAGE_URL[file_upload_num] = 'https://drive.google.com/uc?export=view&id='+ image_id[file_upload_num];
        imgThumbnail[file_upload_num] = IMAGE_URL[file_upload_num]; // 240×240px JPEG
        imgFullsize[file_upload_num] = IMAGE_URL[file_upload_num]; //1024×1024px JPEG
        //all_message += (i+1) + ') ' + itemResponses[i].getItem().getTitle() + ' : ' + 'As below' + '\n';
        all_message += (i+1) + ') ' + itemResponses[i].getItem().getTitle() + ' : ' + IMAGE_URL[file_upload_num] + '\n';
        file_upload_num += 1;
      }
      else
      {
        all_message += (i+1) + ') ' + itemResponses[i].getItem().getTitle() + ' : ' + itemResponses[i].getResponse() + '\n';
      }
    }
     
    all_message_send = all_message;
    
    for (var k = 0; k < tokens.length; k++) {
      if ( file_upload_num > 0 ) 
      {
        for (var m = 0; m < file_upload_num; m++ )
        {
          if ( m == 0 )
          {
            all_message_send = all_message;
          }
          else if ( m > 0 ) 
          {
            all_message_resend = 'Picture: ' + (m+1);
            all_message_send = all_message_resend;
          }
          var formData = {
            'message' : all_message_send,
            'imageThumbnail': imgThumbnail[m],'imageFullsize' : imgFullsize[m],   
          }
           
          var options = {
            "method" : "post",
            "payload" : formData,
            "headers" : {"Authorization" : "Bearer " + tokens[k]}
          };
          UrlFetchApp.fetch("https://notify-api.line.me/api/notify", options);
        }
      }
      else {
        var formData = {
          'message' : all_message_send,  
        }
         
        var options = {
          "method" : "post",
          "payload" : formData,
          "headers" : {"Authorization" : "Bearer " + tokens[k]}
        };
        UrlFetchApp.fetch("https://notify-api.line.me/api/notify", options);
      }
    }
  }

Code Google Sheet to Google Calendar

function meetingRoomBooking() {

  //Set data from Spread Sheet
  var spreadSheetID = "xxx Google Sheet ID xxx";
  var ss = SpreadsheetApp.openById(spreadSheetID);
  var sheet = ss.getActiveSheet();
  var lastRow = sheet.getLastRow();
  var lastColumn = sheet.getLastColumn();
  
  /*
  Logger.log(lastRow);
  Logger.log(lastColumn);
  */
  
  //Set data for Google Calendar
  var topic = sheet.getRange(lastRow, 5).getValue();
  var roomNumber = sheet.getRange(lastRow, 6).getValue();
  var startDate = new Date(sheet.getRange(lastRow, 7).getValue());
  var endDate = new Date(sheet.getRange(lastRow, 8).getValue());
  
  /*
  Logger.log("name:" + name);
  Logger.log("Phone Number:" + phoneNumber);
  Logger.log("Room Number:" + roomNumber);
  Logger.log("Start Date:" + startDate);
  Logger.log("End Date:" + endDate);
  */
  
  //Creates a calendar event using the submitted data
  var calendar = CalendarApp.getCalendarById("xxx Google Calendar ID xxx");
  var titles = (topic + ' ' + '' + roomNumber);
  var descriptions = roomNumber;
  calendar.createEvent(titles, startDate, endDate, {description: descriptions});
}
Posted in Application, Google, Language | Leave a comment

update nodejs on mint

$ ng --version
Node.js version v12.22.9 detected.
The Angular CLI requires a minimum Node.js version of v18.13.



$ nvm install node
Downloading and installing node v21.5.0...
Downloading https://nodejs.org/dist/v21.5.0/node-v21.5.0-linux-x64.tar.xz...
####################################################################################################################################################################################################################################### 100.0%
Computing checksum with sha256sum
Checksums matched!
Now using node v21.5.0 (npm v10.2.4)
Creating default alias: default -> node (-> v21.5.0)
$ node --version
v21.5.0

Posted in Application, Debian, Language, Linux Mint, Ubuntu | Leave a comment

fix ip address on Ubuntu 22.04

$ sudo nano /etc/netplan/00-installer-config.yaml


network:
ethernets:
eth0:
dhcp4: no
addresses: [192.168.130.2/24]
gateway4: 192.168.130.254
nameservers:
addresses: [8.8.8.8,8.8.8.4]
$ sudo netplan try

** (process:1964): WARNING **: 19:29:00.029: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.

** (process:1964): WARNING **: 19:29:00.029: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.

** (generate:1966): WARNING **: 19:29:00.032: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.

** (generate:1966): WARNING **: 19:29:00.032: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
WARNING:root:Cannot call Open vSwitch: ovsdb-server.service is not running.

** (process:1964): WARNING **: 19:29:00.505: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.

** (process:1964): WARNING **: 19:29:00.505: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.

** (process:1964): WARNING **: 19:29:01.153: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.

** (process:1964): WARNING **: 19:29:01.153: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.

** (process:1964): WARNING **: 19:29:01.153: Permissions for /etc/netplan/00-installer-config.yaml are too open. Netplan configuration should NOT be accessible by others.

** (process:1964): WARNING **: 19:29:01.153: `gateway4` has been deprecated, use default routes instead.
See the 'Default routes' section of the documentation for more details.
Do you want to keep these settings?


Press ENTER before the timeout to accept the new configuration


Changes will revert in 113 seconds
Configuration accepted.
Posted in Network, Ubuntu | Leave a comment

Set Python as Python3

$ python
Python 2.7.18 (default, Jul  1 2022, 10:30:50) 
[GCC 11.2.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> quit();

$ sudo apt install python-is-python3
[sudo] password for nano:    
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-5.15.0-87 linux-headers-5.15.0-87-generic linux-image-5.15.0-87-generic linux-modules-5.15.0-87-generic linux-modules-extra-5.15.0-87-generic
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  python-is-python3
0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded.
Need to get 2,788 B of archives.
After this operation, 13.3 kB of additional disk space will be used.
Get:1 http://mirror1.totbb.net/ubuntu jammy/main amd64 python-is-python3 all 3.9.2-2 [2,788 B]
Fetched 2,788 B in 3s (894 B/s)               
Selecting previously unselected package python-is-python3.
(Reading database ... 670910 files and directories currently installed.)
Preparing to unpack .../python-is-python3_3.9.2-2_all.deb ...
Unpacking python-is-python3 (3.9.2-2) ...
Setting up python-is-python3 (3.9.2-2) ...
Processing triggers for man-db (2.10.2-1) ...

$ python
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
Posted in Application, Debian, Language, Linux Mint, Ubuntu | Leave a comment

Django Hello World

$ nano hello/hello/views.py

# hello/views.py
from django.http import HttpResponse


def home_page_view(request):
    return HttpResponse("Hello, World!")
$ nano hello/hello/urls.py

"""
from django.contrib import admin
from django.urls import path

urlpatterns = [
    path('admin/', admin.site.urls),
]
"""

# hello/urls.py
from django.urls import path

from .views import home_page_view

urlpatterns = [
    path("", home_page_view, name="home"),
]

Ref: https://djangoforbeginners.com/hello-world/
https://djangocentral.com/create-a-hello-world-django-application/

Posted in Framework, Language | Leave a comment