Monday, March 11, 2024

VSCode as default git diff and merge tool VS Code

SETUP DIFFTOOL TO VS CODE

git config --global diff.tool --default-difftool

git config --global -e

will open up vs code (or default editor)

put these lines

[diff]
    tool = default-difftool
[difftool "default-difftool"]
    cmd =  code --wait --diff $LOCAL $REMOTE

save and close the editor 

to test : 
to show difference between 2 commits
- git difftool HEAD HEAD~1 or git difftool commit1 commit2

to show difference between current local state and a commit
- git difftool HEAD or git difftool commit_id

should show the difference of the 2 states side by side, per file. 

TURN OFF THE PROMPT

if you don't want it asking if you want to open the editor when command git difftool is used, then:
git config --global difftool.prompt false

SETUP MERGE TOOL TO VS CODE

- git config --global -e
- add the following lines, save and close. 

[merge]
    tool = code
[mergetool "code"]
    cmd = "code --wait $MERGED"
[mergetool]
    prompt = false
    keepbackup = false


Sunday, January 22, 2023

Migrating VMWare server vmdk to IBM Cloud qcow

 Basics:


1) IBM Cloud uses qcow2 format of virtualization files, which is used by the KVM "brand" of open-source virtualization.
    Source: https://cloud.ibm.com/docs/cloud-infrastructure?topic=cloud-infrastructure-migrating-images-vpc
    Among other IBM VPC requirements are:

  •       VMware virtual machine should be created with BIOS firmware type

  •      Understand IBM Cloud VPC custom image requirements:

    • Is in qcow2 format
    • The boot volume (primary vHDD) doesn't exceed 99 GB (conflicting - in another document it states 250GB limit)
    • If cloud-init is enabled, then remove all custom config files
    • Virtio drivers should be enabled
    • The operating system is supported as a stock image. For a list of supported stock images, see Images.
         -> Standard Linux, Ubuntu, Windows are all supported.

    2) VMWare uses a different format, i.e. vmdk.
        We therefore need to convert the vmdk file to qcow2, using the program qemu-img.
        Example command:
        qemu-img convert -p -f vmdk -O qcow2 centos6.9.vmdk centos6.9.qcow2
        Source: https://support.huaweicloud.com/intl/en-us/bestpractice-ims/ims_bp_0030.html
        This can take a long time depending on your computer power and size of the vmdk.

        Sample file used: ova 13GB -> converted to qcow2 became 26GB.
       
        I uploaded the file to an IBM VSI Linux machine and run the conversion there.
        It took more than 30 minutes on an IBM Linux machine 8GB     RAM 2vcpu.  

    3) After conversion, we will upload the qcow2 file to IBM COS - Cloud Object Storage.
        What we need:
        a.) Object Storage bucket. Make sure that the bucket you create is "Regional" and not cross Region.
        It is not necessary to be in the SAME data center as your Virtual Private Cloud (VPC) where you want to run the VM on an IBM VSI - virtual server instance. But, if it is in the same data center, the import Might possibly run faster. 
    In the example below, our VPC is in Frankfurt, Germany, then our IBM COS should also be in eu-de (Europe - Deustchland/Germany)



        b) Properly configured rclone on the computer where the qcow2 file is, with a connection to the bucket.
        c) For rclone setup, please see another ticket with the setup instructions. If you are using the IBM linux machine,
        make sure to type in the "Direct endpoint" in rclone config. Reason: Faster, and so that there will be no additional charges for data egress since the data will just "flow" within the IBM network.
           rclone config allows one to input a value that is not in the selection, so just go ahead. 





        rclone config shown above.
        Upload can take a long time depending on the size and Internet connection speed.
        28 GB took ~1 hour approx though I did not really monitor it, can't be sure. 
        
    4) Next is the setting of access.
    After uploading the qcow2 file to the bucket, we need to make sure that the Image Service for VPC has the authority to access the target service IBM CloudObject Storage. UNder source service, select VPC Infrastructure Services. Scope of access: Resources based on selected attributes. Resource type: Image service for VPC. Target service = Cloud Object Storage. 



    5) Import as custom image.
     Next, we can now import the qcow2 file from the bucket into our VPC as a custom image.
    Under VPC, select "Custom images". Click "Create" button.
    Fill up the form, then under Source select Cloud Object Storage -> select the qcow2 image you made.
    Under OS, select the correct OS you used for that image be it Windows or Ubuntu, our most common images.
    Example: I had MintLinux -> I selected "Linux / Debian"
    Complete the fields and click on IMport Custom Image.

    This will take a long time again. More than a few minutes to hours approximately.


    6) Create a virtual instance
    After the import completes, you can now create a virtual machine (VSI) using this image.

    To create a server, go to: Create virtual server for VPC.
    Under Operating system -> Image, select "Custom Image"
    Find the image you created.

    For the SSH keys, select an existing key that you have on your machine.
    Else, create a new one using PuttyGen (download Putty from the official site to also get PuttyGen along with it by default).
    Copy the Public key to the textbox on IBM Cloud. Make sure to save the private key on your computer.
    You will need this for ssh access to this server from your computer.

    Complete all the fields and click on "Create Virtual Server Instance" on the right hand side.



    7) Voila! We now have our server. You may connect using SSH or console.

    Note that the IP address of the server will automatically be assigned by IBM (it will not get its old IP).

    The username and password though will still be the old username and password you already have on the source VM.

    8) Optional ->
    Below instructions might not apply (it might only apply to newly created servers - those that did not use a custom image.
    For ssh, use putty. You might need to load the private key in the Connection-> Auth-> "Private key file for authentication"


    Tuesday, August 10, 2021

    How to delete files older than x days in a network drive

    When using the forfiles command on network shares, 

    the forfiles command can be used to delete files older than x days in a folder 

    however, direct use of UNC path may result in the ff error: 

     

    "ERROR: UNC Paths <\\machine\share> are not supported."

     

     A solution to this would be to map the network drive (force map)

    NET USE O: /delete /y
    NET USE O: \\192.168.0.1\yourfolder

    forfiles /p "O:\testdelete" /s /m *.* /c "cmd /c Del @path" /d -7 


    Friday, January 22, 2021

    ITIL training providers Manila

    ITIL Foundation v.3 Training Providers as of 2018

    The exam costs about $200 so I would advise taking a seminar with exam included in the package.

    A few (non-exhaustive list of training providers below).

    1) MITC (Makati)
        - no exam, seminar only
        - Location: Buendia Makati at Mapua school

    2) Phoenix One (Makati)
        - ?
        - Makati office

    3) Active Learning (Greenhills)
        - with exam, online proctored exam to be scheduled at your convenience,
          can be taken at home or at office
        - location: Annapolis St. San Juan training center

    4) ECCI (Makati)
        - with exam, but needs to be scheduled on site, paper exam
        - location of training: Holiday Inn Makati
        - location of exam: Makati office of ECCI


     

    How to Install DB2 Web Query IBM i 7

    Here are the instructions on how to install using EZ install on IBM i.
    First step is get in touch with IBM Web Query Team: Please refer any questions to QU2@us.ibm.com

     

    Just as a reference, here are the instructions as of Jan 202 I got.

    Please read the following important information:

    The installation assumes you do not already have Version 2.2.1 of DB2 Web Query installed.
    - If you have Version 2.2.1 installed, it will not overwrite your currently installed version.

    - If you have a previous Version 2 level installed you will be prompted to install or not. If you choose to install Version 2.2.1, it will upgrade your Version 2 code (but will not replace any current reports or meta data). Having a good backup of the previous level is ALWAYS a good idea. Refer to the backup guide on our wiki: http://ibm.biz/db2wqwiki.

    KNOWN INSTALLATION or STARTUP ISSUES that you may run into:


      - CCSID 65535. The webquery startup will fail with this message when running under CCSID 65535: "REPLACE has invalid operators and the reason code is 12: the CCSID of the operators are not compatibles." For example, if user profile starting webquery has a CCSID value of *SYSVAL, and your QCCSID value is set to 65535.

        SOLUTION: Before running the QWQINSTALL/SETUP command, enter this command CHGJOB CCSID(xxx), where xxx is the default CCSID for primary language. For example, on an English system, before running SETUP, enter the command CHGJOB CCSID(37).

      - LOCALE errors. If you get an error referencing an issue with LOCALE, it most likely implies that the user profile you are using to run SETUP - or the System Value for QLOCALE - is not set. If you are running Web Query under English CCSID 37, then set the locale value to /QSYS.LIB/EN_US.LOCALE. The locale for a profile should match the CCSID. For other CCSIDs, you can review the table here for the appropriate setting: https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzahz/rzahznls.htm.

      - Security user exit blockers. Programs in place called “user exits” that block things like ODBC and SQL calls can cause the installation to fail because the QWQADMIN user profile is blocked

      - Missing or downlevel pre-reqs. Note that the ez-install process does run a pre-req checker, and that this is also available standalone in the box if you want to run it before you try to install. Most common issues will be:


    For i7.2 and up:
    PREREQ MISSING: 5770JV1 FEATURE 0016
    PREREQ MISSING: 5770SS1 FEATURE 0013

    For i7.1
    PREREQ MISSING: 5761JV1 FEATURE 0016
    PREREQ MISSING: 5770SS1 FEATURE 0013

    If you are missing the JV1 feature, you can read about how to acquire it here:

    http://www-01.ibm.com/support/docview.wss?uid=nas8N1020692

        Note: After installing the JV1 feature, if you have the Java group PTF applied then you must reapply the Java group PTF to pick up missing PTFs for the feature.

        Do not run the ezinstall SETUP command until the Java group is reapplied.

        The Java group PTF numbers are:


    7.4 - SF99665
    7.3 - SF99725
    7.2 - SF99716
    7.1 - SF99572


    ddf

    s

    f

    k