January 15

IT Snippet: VS code tab color

VS Code is my current editor of choice in the workplace as it is already pre-approved by the client and I dont need to jump through IT exception hoops to get PsPad allowed to be used. Its a bit bloated for my taste but it is starting to grow on me as I get used to the keybindings.

One thing that I am having problems is tracking which tab I am currently using. I normally have a dozen files open at any given time, and that number increases when I do file-by-file comparison within the VS Code editor. A quick search and the flow and configuration snippet allows me to change the color of the active file tab to the color of my choice.

  • control+shift+P , then select the “Open User Settings (JSON)” option
  • Add (or update) the following snippet in the outermost/parent brace.
           "workbench.colorCustomizations": {
               "tab.activeBackground": "#00AA00"  #for green 
           }

Save and it automatically gets applied!

Category: Tipjar | LEAVE A COMMENT
October 15

Scoped VS Code Powershell profile

As of writing, I am working on a very controlled client environment (i.e. Citrix session) where the home drive is in a network share, and the machine session has a locked policy of only allowing signed poweshell scripts to execute.

I have my scripts in the Powershell folder which then gets this error because they are not digitally signed.

A solution presented is to run a new powershell session with the execution policy for the current user set to Bypass. Normally this needs to be done as an admin but it should be doable using the normal user. I wanted this to be part of my VS Code setup and this is how I configured it:

  • Go to File->Preferences->Settings dialog (or press Ctrl+,)
  • In the search box, type in “@feature:terminal integrated.profiles.windows”
  • Click on the “Edit in settings.json” link to open the correct settings file.
  • Locate the Powershell entry and add the following argument stanza to the “terminal.integrated.profiles.windows” section.
    "args": [        
                "-noexit",      
                "-ExecutionPolicy",
                "Bypass",
                "-file",        
                "H:\\PowerShell\\functions.ps1"      
            ]  

  • Save the changes. This will now take effect in new terminal sessions started by VS Code using that profile.
October 22

Houston we have a failure!

I was working on my trusty and crusty (15 year old!) desktop Pyg which just got a recent Manjaro reinstall, when suddenly the LVM partitions disappeared. The only clue I had is that the 3 directories that I use to access the logical volumes started throwing Input/Output error. I rebooted and it went straight to the recovery console (which is not a good place to be). I tried manually mounting the LVM partitions and it gave this error:

This was a bit of a shock and no reboot or safe mode can restore the directories. I put it off for the night and took it up again today. I was thinking maybe it was a recent Manjaro system in-place upgrade so I tried booting to the latest Ubuntu livecd (using Ventoy, which is very good for creating a multi-system bootable drive) hoping it will show up my lost LVM partitions.

I booted up to the Ubuntu live desktop and I didnt see any LVM mapper entries either. I see the same 800++GB unallocated space at the tail end of the SSD. I launched a filesystem check which didn’t reveal anything and started searching on how to manually input the the LVM sectors in the GPT metadata.

I searched my Google keep for Pyg’s partition layout and then it hit me that all I am seeing is the SSD. There is a WD Blue mechanical drive in this machine before I upgraded to SSD and I used that for storage for files before they are backed up to either DVD or BlueRay. I checked the BIOS of the desktop and it confimred that the HDD is not showing up. Opening up Pyg seems to be my next weekend project.

Curiously enough, I am not feeling as much worry on losing the files as I remember the first time that my WD Green drive malfunctioned. Maybe those files in the LVM partitions (warehouse [files], limbo [multimedia] and arena [game files[) are really not worth that much in the grand scheme of things. If I can still recover them then thats fine but if not then…

February 3

Cautionary Tale for Online Wallet payments

Gist: When paying via your online wallets then make sure to take a screenshot before payment.

My internet provider bill (from PLDT) is nearing its due date and I was paying the last few month’s bills via my Maya.ph wallet to take advantage of the crypto coin “cashback” feature. I logged into my Android app and saw that I still have more than 6000 pesos in the wallet which is sufficient to pay for my internet bill. I proceeded with paying for the bill using the saved template and adjusted the amount to Php1900.

Upon submission, the app encountered an error that it didn’t receive a response from the provider and to try again a few minutes later. When I refreshed the app home page my wallet balance dropped to Php4200 but there is no transaction listed for it. I waited for 5 minutes to refresh the Maya app but everything remained the same.

The Maya chatbot is useless and doesn’t want to connect me to a human helpdesk agent so I called up the Maya hotline. The agent who answered it is helpful enough but she does not have any ability to view my prior day balance to confirm the deduction. She can only confirm that there is no new transaction logged to my account since what she saw is the last payment I made a few days back. She suggested to call the PLDT hotline instead and to email support@maya.ph to do a deeper check and to request for an online receipt if needed. It has been 2 days and yet there is still no response on my request except for the automated ticket number.

I dont have any tangible proof other than this claim so it will be very easy for Maya to say it didn’t happen. This is a very costly lesson in proper documentation, and a very negative experience that will prevent or at least minimize my use of the Maya payment system in the future.

July 22

[TipJar] Quickly wipe a file in a Linux shell

No time to read through contexts? Jump to the TL;DR; section.

There are use cases that require the secure wiping or deletion of files. There are already a lot of available utilities available in most modern distributions such as srm, swipe, etc. These however entail installing an additional package which is fine for work machines. The use case I had is to securely delete a transient file after it was generated and used in a Continuous Integration server. Installing the secure-delete package is trivial but a base Linux system already has the tool that can do the job: dd

Continue reading

August 4

Sync clock with Google

If the Linux VM was running at the time the host OS (Windows) hibernated then the clock in the guest VM will be left at the time of hibernation. If NTP is configured then the clock should resync gradually but most systems do not apply a big chunk of time correction by default.

If the Linux VM was configured with a VPN that implements a system-wide configuration then the DNS resolution might be unable to resolve the NTP server since the DNS of the VPN session will be unavailable. The alternate and work-around presented hinges on two things:

  • The guest VM has internet access at the time it was resumed.
  • The google.com domain name is already resolved and cached.

   sync-clock() {
     echo Current time before sync: `date`
     echo Current time after sync : `sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 \ 
       | grep Date: | cut -d' ' -f5-8)Z"`
    }

The work-around uses the time in the google headers to provide an anchor for the correction.  This is provided as a bash function to provide user feedback if a correction was done.

Snippet execution

July 7

Fix for crashing gnome-control-center

The GNOME control center in my Manjaro system crashed while I was tweaking the details of the mouse settings. After it crashed, I was unable to bring it up again even after a reboot.

The solution was to reset the configuration files for it using the following command:

$ dconf reset -f /org/gnome/control-center/

After that, the control center UI is up and running again. Based on the search hits, visiting the details pane can sometimes caused the state that results to a segmentation fault whenever the control center initializes.

Category: FLOSS | LEAVE A COMMENT
January 25

We welcome our new overlords

I heard in a Technology training that “It is hard to comprehend that there will come a time that Artificial Intelligence (AI) will get smarter than us humans but it may still be about 50 more years.”

I find that preposterous. AI by definition isnt going to be smarter than human intelligence. It doesnt need to be. Humans on the other hand will just grow dumber. Technology helps.

October 13

Docker image cleanup

Running docker frequently can lead to mysteriously disappearing space. I kid, its not mysterious. Each image builds a layer which in turn eats up space. Logical but PITA!

Put this in your .bashrc or run it as cron on your docker host to clean up.


docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f “dangling=true” -q)

or do it in one alias (use at your own discretion)


alias docker_janitor='docker rm -v $(docker ps -a -q -f status=exited);docker rmi $(docker images -f “dangling=true” -q)'

sounds too easy..

ciao!