Skip to content

Instantly share code, notes, and snippets.

View lpsandaruwan's full-sized avatar
Fortune favors the bold

Lahiru Pathirage lpsandaruwan

Fortune favors the bold
View GitHub Profile
@lpsandaruwan
lpsandaruwan / JVMCPUUsage.java
Last active March 13, 2019 10:16
Calculate JVM CPU Usage Using MXBeans
/* JVMCPUUsage
*
* Calculate JVM CPU usage on older than JDK version 7 using MXBeans.
*
* First initiate MBeanServerConnection using `openMBeanServerConnection` method. Then
* create proxy connections to MXBeans using `getMXBeanProxyConnections` and after that
* poll `getJvmCpuUsage` method periodically.
*
* JVMCPUUsage is a free Java class:
* you can redistribute it and/or modify it under the terms of the GNU General Public License
@lpsandaruwan
lpsandaruwan / windows_font_installer.py
Last active March 3, 2024 22:34
Install a font file in Windows - Python3
""" Python 3 Windows font installer
Script must be run with the privileges in order to access Windows fonts directory. System reboot is not necessary.
This will install the font and will inform programs that a new font has been added.
Python3 Windows font installer is a free python script: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.