How to inspect RPM packages

While working with RPM packages I had to compare the ones I created with old ones to check if my pipeline produces the same output. I found a few command that helped me to do that.

To list the contents and their timestamps, you can use: rpm -qlpv package.rpm

To extract all contents you can use: rpm2cpio package.rpm | cpio -idmv -D extract_folder

To get the scripts use: rpm -qp --scripts package.rpm > package.spec

Kill processes on Windows via Command Line

Since working with Java, sometimes my services crash and the IDE does not recognize it. To kill the remaining Java processes, I use:

wmic process where "commandline like '%%java%%'" delete

That’s it. Interestingly, it does not kill IntelliJ IDEA, only the services. I guess, IntelliJ uses a different JVM name.

Print runtime dependencies in Golang

Getting a list of dependencies in Go is easy, but third-party libs have their dependencies, and it might not be obvious which ones get into the binary.

Go does provide a way by using runtmime.debug.ReadBuildInfo().Deps. Just add this to your application and it will print all dependencies:

buildInfo, ok := debug.ReadBuildInfo()
if !ok {
  panic("Can't read BuildInfo")
}
fmt.Println("Dependencies:")
for _, dep := range buildInfo.Deps {
  fmt.Printf("  %s %s\n", dep.Path, dep.Version)
}

This is not my code, I found it on StackOverflow: https://stackoverflow.com/a/59276408/12550134

Thanks to Mark A for sharing it.