Posts

List all available versions for a go module

Use the command: go list -m -versions module For e.g.: go list -m -versions  github.com/prometheus/common github.com/prometheus/common v0.1.0 v0.2.0 v0.3.0 v0.4.0 v0.4.1 v0.5.0 v0.6.0 v0.7.0 v0.8.0 v0.9.0 v0.9.1 v0.10.0 v0.11.0 v0.11.1 v0.12.0 v0.13.0 v0.14.0 v0.15.0 v0.16.0 v0.17.0 v0.18.0 v0.19.0 v0.20.0 v0.21.0 v0.22.0 v0.23.0 v0.24.0 v0.25.0 v0.26.0 v0.27.0 v0.28.0 v0.29.0 v0.30.0 v0.30.1 v0.31.0 v0.31.1 v0.32.0 v0.32.1 v0.33.0 v0.34.0 v0.35.0 v0.36.0 v0.37.0 More info here: https://go.dev/doc/modules/version-numbers

Access docker as a normal user from a docker running on a Windows WSL 2 Linux

Run the below command: sudo chmod o+rw /var/run/docker.sock This will enable non privileged users to run all docker commands, 

One liner command to get restart reason for a POD in Kubernetes

Run: kubectl describe pod -n <namespace> <Pod name> | grep -A2 -B2 Reason For e.g.: kubectl describe pod -n myns my-pod-6d9bdcfbfc-k9jqw | grep -A2 -B2 Reason

Get a self contained k8s config for usage in other tools(Use with caution)

Many a times we would like to view/manage the K8s cluster remotely using clients like Lens , k9s etc. I was searching for this information across, and found the below commands: # kubectl config view --flatten > k8s.cfg On the remote system, place the k8s.cfg file under: <user home dir>\.kube For e.g., on a Windows desktop for user abc, place it under: C:\Users\abc\.kube Note: You need to use this with caution as you can access complete K8s cluster with this data.

Merge multiple PDFs in Windows using Linux!!!

Docker on Windows is a boon to the developer community. Apart from the regular Linux based development I got a chance to use it today for something that I could not easily do directly on Windows (without a new third party software) I had to merge a number of PDFs to create a single PDF. Searching the Web gave me a number of options like online tools, ghostscript, pdftk etc. pdftk caught my attention as it was a perfect choice for my needs. But, I did not want to install it on my Windows desktop. I had docker desktop installed on my system. Hence I tried the following to achieve PDF merge: 1. Started a docker container with "ubuntu" image as follows: docker run --name ubuntu -d -it -v C:/temp:/var/mnt/pdf --entrypoint bash ubuntu -c tail -f /dev/null 2. Installed pdftk apt upgrade -y apt install pdftk -y 3. Executed pdftk to merge the pdfs. For e.g.: pdftk Aug2020.pdf Sep2020.pdf Oct2020.pdf Nov2020.pdf Dec2020.pdf Jan2021.pdf cat output  output....

How do I find the number of CPUs in C++11?

Below is the code snippet that helps to get the number CPUs in C++11: ------------------------------------------------------------------------------------------------------- // Get the number of parallel threads possible. Just an hint to create number of threads unsigned int n = std::thread::hardware_concurrency(); std::cout << n << " concurrent threads are supported.\n"; -------------------------------------------------------------------------------------------------------

Graylog - an easy solution for log management

Image
Recently, I was researching for opensource log management tools. I had only two requirements. Log Search and Log analytics. A lot of posts in the internet suggested me to use an ELK stack. But, I wanted to do something different. I found graylog as an alternative to ELK. One can setup and run it in minutes. It uses mongodb, elastic search and graylog server. Here is the login page: grylog provides different options to stream logs into graylog server. I used the simple UDP listener and forwarded logs from multiple devices into this listener. Next step is to create dashboards using the search. Here is the search page: Once search is done, you can add the widgets to a dashboard. The dashboard will help you to get the summary of your devices at one shot. It is also possible to generate alerts on different conditions. More here: https://www.graylog.org/

Comparing C and Go Lang - My first impression

Of late we are hearing a lot about go lang (https://golang.org/). I was also curious about this. I wanted to run some experiments with go and C. As expected, the experiment was started with "hello world". Here is the C code that I have used: ------------------------------------------------ #include "stdio.h" int main(int argc, char** argv) {    printf("hello, world\n");    return 0; } ------------------------------------------------ Corresponding go code is: ------------------------------------------------ package main import "fmt" func main() {     fmt.Printf("hello, world\n") } ------------------------------------------------ Well, both of them look simple. But I was astonished after creating the exe file. Below are the sizes of exe files created by C ( 51k ) and Go( 2MB ) 06/03/2016  03:41 PM            51,712 hello_c.exe 06/03/2016  03:37 PM         2,434,560 hello...

A roadmap to Software Defined Data Center (SDDC) m... - HP Enterprise Business Community

A roadmap to Software Defined Data Center (SDDC) m... - HP Enterprise Business Community

How to know your prepaid BSNL mobile number

I was informed to dial"*888#" to know my BSNL prepaid number last week in Bangalore for my new SIM. I tried it multiple times for 2-3 days but in vain. After searching in Google, I figured out that it is: " *1# "

New-Relic T-shirt real or gimmick?

I installed and used one of the New Relic products in beginning of 2013. I was promised that a T-Shirt would be shipped to me for trying their product. They asked my size and I  provided them  the same. I waited it for 3 months but the shirt never reached me. I pinged them again to mention that the shirt has not reached me. They promised a delivery again, but it never reached me even after an year. Now I a m really wondering if it is a real gimmick from their side. Note: I live outside U.S.

C++11 Feature Series: 1. Lambdas

Image
Lambdas are simple but powerful anonymous functions in C++11.You can use lambdas wherever a function object or a functor or a std::function is expected. A simple example to explain Lambda functions in C++11. Attached is a sample to demonstrate Lambda.

Getting local socket address, foreign address and the owning process on Linux and Windows

I was searching for ways to get details of local address, foreign address, and the owning process on Linux and Windows. I found multiple commands to achieve the same. Here are the ones I used: On Linux: # ss -atpn | awk '(NR > 1) { print $4, $5, $NF }' This would list all TCP sockets and the owning process. You can redirect the same to a file in case if needed. I used "netstat" on Windows to achieve the same. for /f "tokens=2,3,5" %i in ('netstat -ano ^| findstr /v "Active Proto"') do @echo %i %j %k A sample listing is: ... 192.168.43.94:139 0.0.0.0:0 4 192.168.43.94:1093 74.125.135.125:5222 5172 192.168.43.94:1130 15.201.58.50:443 5876 192.168.43.94:1131 15.201.58.50:443 5876 192.168.43.94:1136 15.201.58.50:443 5876 192.168.43.94:1143 15.201.58.50:443 5876 192.168.43.94:1217 15.201.58.50:443 5876 192.168.43.94:1219 15.201.58.50:443 5876 192.168.43.94:1433 15.201.58.50:443 5876 ... If you want to redirect them ...

How to find out the version of cygwin

Run the command "uname -r" to get the version. For e.g.: > uname -r 1.7.25(0.270/5/3) To get complete details, run: "cygcheck --version" For e.g.: >cygcheck --version cygcheck (cygwin) 1.7.25 System Checker for Cygwin Copyright (C) 1998 - 2013 Red Hat, Inc. This is free software; see the source for copying conditions.  There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Mounting a ISO image on different Unix platforms

1. Mounting ISO images in AIX 6 and 7 # loopmount -i -o "-V cdrfs -o ro" -m e.g.: # loopmount -i cdrom.iso -o "-V cdrfs -o ro" -m /mnt/disk 2. On Linux: #mount -o loop e.g.: #mount -o loop cdrom.iso /mnt/disk 3. On Solaris: mount -F hsfs -o ro `lofiadm -a ` e.g: mount -F hsfs -o ro `lofiadm -a /path/to/image.iso` /mnt 4. To unmount: umount

Interested in a free recharge?

Amulyam is a very nice website that provides you an option to get free mobile recharge. It supports free mobile recharge for both, prepaid and postpaid mobile subscribers on all Indian telecom operators ( Airtel, Aircel, Vodafone, Reliance, BSNL, Loop, MTS, Tata Indicom, Docomo, Aircel, Uninor, Idea, Virgin Mobile). I have utilized it for recharging BSNL prepaid mobile phone. Get more details about Amulyam here

How to set build verbosity in Visual Studio 2010 IDE?

All you need to do is to go into the Tools->Options menu, and go to Projects and Solutions->Build and Run and change the value of the MSBuild project build output verbosity.  You can pick between Quiet, Minimal, Normal, Detailed and Diagnostic .

Changing product key after Installing Windows 8

At the administrator command prompt, type in "slmgr.vbs -ipk " slmgr.vbs -ipk 00000-00000-00000-00000-00000 To activate windows after changing the key, run "slmgr.vbs -ato" More details in the following link: http://tweaks.com/windows/39026/change-windows-product-key-after-install/

Generate a File Listing from a Windows Explorer Context Menu

Please check the link below: http://www.theeldergeek.com/file_list_generator.htm

Listing files by size in UNIX

If you want to have a listing of the files sorted by size, you can use the following command(s), it will list the files in decrease order. if you need to do the same thing recursively,you could use the second one. ls -l | grep ^- | sort -nr -k 5 | more ls -lR | grep ^- | sort -nr -k 5 | more