Skip to content

Instantly share code, notes, and snippets.

View ggdio's full-sized avatar
:octocat:
Learning something new

Guilherme Dio ggdio

:octocat:
Learning something new
View GitHub Profile
@ggdio
ggdio / sample.json
Created September 18, 2022 00:11
vscode-prefs
{
}
@ggdio
ggdio / Game.ini
Created April 21, 2020 04:45
Mordhau Dedicated Server HOST File
[/Script/Mordhau.MordhauGameMode]
MOTDURL=
bIsThirdPersonCameraDisabled=False
ConstrainAspectRatio=0.000000
bIsHitStopOnTeamHitsDisabled=False
bDisableClientMods=False
PlayerRespawnTime=5.000000
AutoKickOnTeamKillAmount=5
BallistaRespawnTime=30.000000
CatapultRespawnTime=30.000000
@ggdio
ggdio / CoordDistance.java
Created March 27, 2020 23:08
Trying to calculate the distance between two coordinates
public class CoordDistance {
public static void main(String[] args) {
System.out.println("Results:");
System.out.println(distance(32.9697, -96.80322, 32.9697, -94.80323, Unit.METERS) + " Meters\n");
}
/**
* Calculates distance between coordinates
@ggdio
ggdio / ConcurrentUUIDGenerator.java
Created July 30, 2019 01:27
A concurrent random UUID generator
public class ConcurrentUUIDGenerator {
public static UUID randomUUID() {
final Random rnd = ThreadLocalRandom.current();
long mostSig = rnd.nextLong();
long leastSig = rnd.nextLong();
// Identify this as a version 4 UUID, that is one based on a random value.
mostSig &= 0xffffffffffff0fffL;
mostSig |= 0x0000000000004000L;
@ggdio
ggdio / eclipse-codetemplate-CLASSBODY.xml
Created July 25, 2019 18:25
Eclipse Code Template for CLASSBODY
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="classbody_context" deleted="false" description="Code in new class type bodies" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.classbody" name="classbody">
public ${type_name}() {
}
</template></templates>
@ggdio
ggdio / eclipse-codetemplate-TYPES.xml
Last active July 25, 2019 18:26
Eclipse Code Template for CLASSBODY
<?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="false" context="typecomment_context" deleted="false" description="Comment for created types" enabled="true" id="org.eclipse.jdt.ui.text.codetemplates.typecomment" name="typecomment">
/**
* Class responsible for somehting very important !
*
* @author {user}
*
* @since 1.0
* ${tags}
*/
</template></templates>
@ggdio
ggdio / ignite.xml
Last active December 12, 2018 18:22
Ignite Configuration XML
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
@ggdio
ggdio / nashorn.sh
Created July 18, 2017 19:21
Sample nashorn script that will run on shell
#!/usr/bin/env jjs
// Import JOptionPane from javax.swing
var JOptionPane = Java.type("javax.swing.JOptionPane");
/**
* Nashorn impl.
*/
(function() {
@ggdio
ggdio / SemaphoreTest.java
Created May 22, 2017 21:17
Testing the Semaphore execution
package br.com.ggdio.util.concurrent.test;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicInteger;
public class SemaphoreTest {
private static Semaphore semaphore = new Semaphore();
private static AtomicInteger count = new AtomicInteger(0);
@ggdio
ggdio / Semaphore.java
Created May 22, 2017 21:16
Semaphore controller - Green vs Red light permission
package br.com.ggdio.util.concurrent;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.locks.ReentrantLock;
/**
* Semaphore controller
*
* Red Signal - Blocks all threads controlled by this Semaphore
* Green Signal - All threads controlled by this Semaphore are allowed to proceed