Skip to content

Instantly share code, notes, and snippets.

View manoelcampos's full-sized avatar
🙃
Finding a balance in the middle of chaos

Manoel Campos manoelcampos

🙃
Finding a balance in the middle of chaos
View GitHub Profile
@manoelcampos
manoelcampos / Movimentacao.java
Created April 12, 2024 18:50
Mostra como implementar o método clone (type-unsafe) em uma classe Java simplesmente incluindo um implements Cloneable
public class Movimentacao implements Cloneable {
private int id;
private String descricao;
public Movimentacao(int id, String descricao) {
this.descricao = descricao;
this.id = id;
}
@Override
@manoelcampos
manoelcampos / fly.log
Created December 12, 2023 19:37
fly.logs
# Logs after deploy with min_machines_running = 0
2023-12-12 15:55:44.753 [competeaqui_fly_io_logs] [INFO] gru 8522 6e82d2e7c020e8 competeaqui-staging 2023-12-12T18:55:44.753Z INFO 314 --- [ main] b.c.competeaqui.CompeteAquiApplication : Started CompeteAquiApplication in 15.256 seconds (process running for 16.305)
2023-12-12 16:03:21.036 [competeaqui_fly_io_logs] [INFO] gru 8522 6e82d2e7c020e8 competeaqui-staging Downscaling app competeaqui-staging from 1 machines to 0 machines, stopping machine 6e82d2e7c020e8 (region=gru, process group=app)
2023-12-12 16:03:21.036 [competeaqui_fly_io_logs] [INFO] gru 8522 6e82d2e7c020e8 competeaqui-staging Downscaling app competeaqui-staging from 1 machines to 0 machines, stopping machine 6e82d2e7c020e8 (region=gru, process group=app)
2023-12-12 16:03:21.039 [competeaqui_fly_io_logs] [INFO] gru 8522 6e82d2e7c020e8 competeaqui-staging INFO Sending signal SIGINT to main child process w/ PID 314
2023-12-12 16:03:21.039 [competeaqui_fly_io_logs] [INFO] gru 8522 6
@manoelcampos
manoelcampos / valid.lua
Created January 4, 2023 20:56
Módulo para validação de dados em Lua
local _G, table, string, math, tonumber, tostring, type, print = _G, table, string, math, tonumber, tostring, type, print
---Módulo para validação de dados
--@author Manoel Campos da Silva Filho - http://manoelcampos.com
--@version 0.2
module "valid"
---Divide uma string utilizando um determinado separador existente nela.
--Fonte: http://lua-users.org/wiki/SplitJoin
--@param self String a ser dividida
@manoelcampos
manoelcampos / CloudSimExampleToCompareWithCloudSimPlus.java
Last active May 18, 2023 22:04
Examples comparing CloudSim and CloudSim Plus simulation frameworks
import org.cloudbus.cloudsim.Cloudlet;
import org.cloudbus.cloudsim.CloudletSchedulerTimeShared;
import org.cloudbus.cloudsim.Datacenter;
import org.cloudbus.cloudsim.DatacenterBroker;
import org.cloudbus.cloudsim.DatacenterCharacteristics;
import org.cloudbus.cloudsim.Host;
import org.cloudbus.cloudsim.Log;
import org.cloudbus.cloudsim.Pe;
import org.cloudbus.cloudsim.UtilizationModel;
import org.cloudbus.cloudsim.UtilizationModelFull;
@manoelcampos
manoelcampos / DataFrameRowColRemoval.java
Created October 17, 2020 13:51
d3x-morpheus DataFrame row/column removal issue
import com.d3x.morpheus.array.Array;
import com.d3x.morpheus.frame.DataFrame;
import com.d3x.morpheus.frame.DataFrameValue;
import java.util.List;
public class DataFrameRowColRemoval {
public static void main(String[] args) {
new DataFrameRowColRemoval();
}
@manoelcampos
manoelcampos / apt-get
Last active March 27, 2020 12:33
A shell script to run macOS homebrew as if it was the Debian/Ubuntu's apt-get command, just because "why not?" 😂
#!/bin/bash
# Runs macOS homebrew as if it was the Debian/Ubuntu's apt-get command,
# just because "why not?"
# Usage:
# sudo apt-get parameters
# or apt-get parameters
# Example: sudo apt-get install git
#
# Move the script to /usr/local/bin
@manoelcampos
manoelcampos / netbeans-macos-app-packager.sh
Last active June 4, 2019 00:08
A shell script to create a NetBeans.app package for macOS from the NetBeans binaries
#!/bin/bash
clear
if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then
echo "
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a dir.
Usage: `basename "$0"` netbeans_dir
- netbeans_dir: The directory containing all the files for a specific NetBeans release.
@manoelcampos
manoelcampos / bot.sh
Last active January 25, 2019 16:58
Sends a key and mouse click repeatedly, at a defined time interval
#!/bin/bash
# Sends a key and mouse click repeatedly, at a defined time interval.
# Author - Manoel Campos
clear
#Checks if xdotool command is installed. If not, installs it
xdotool -v 2>/dev/null || echo 'Installing required tools...' && sudo apt-get install xdotool -y > /dev/null
echo ''
@manoelcampos
manoelcampos / Option3.java
Last active February 17, 2018 22:43
A functional, generic class to show how to get String values from an array and return such values converted to the generic type. This class provides default implementations for converting from String to classes representing primitive types.
import java.util.Arrays;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.function.Function;
import java.lang.reflect.Array;
public class Option3<T>{
private int length;
private String defaultValue;
private final Class<T> klass;
@manoelcampos
manoelcampos / Option2.java
Last active February 17, 2018 22:46
A functional, generic class to show how to get String values from an array and return such values converted to the generic type.
import java.util.Arrays;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.function.Function;
import java.lang.reflect.Array;
public class Option2<T>{
private int length;
private String defaultValue;
private final Function<String, T> conversionFunction;