Skip to content

Instantly share code, notes, and snippets.

View akmsw's full-sized avatar
Programming

Fran Bonino akmsw

Programming
  • Marvell Technology Inc.
  • Códoba Capital, Córdoba, Argentina
  • 13:50 (UTC -03:00)
View GitHub Profile
@akmsw
akmsw / GetActiveMonitor.java
Last active May 14, 2024 00:45
Retrieve the screen on which the majority of a view is displayed (for multi-screen setups)
import java.awt.Dimension;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.IllegalComponentStateException;
import java.awt.Rectangle;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Optional;
import javax.swing.JButton;
import javax.swing.JDialog;
@akmsw
akmsw / strtrim.c
Last active April 3, 2023 02:55
Trim a string in C
/**
* @brief This function removes the blank spaces from a
string that are at the beginning and end of it.
*
* @details The string is traversed from the beginning
* until the first character is found, which
* will be set as the trimmed string beginning.
* Thereafter, the same is done from the end of
* the string until the last character is found,
* which will be set as the trimmed string end.