Skip to content

Instantly share code, notes, and snippets.

View massahud's full-sized avatar

Geraldo Massahud massahud

View GitHub Profile
@massahud
massahud / bitmask.go
Last active May 3, 2021 10:17
Bitmask using iota in go. Playground link: https://play.golang.org/p/jKuDcNVt-iK
package main
import "fmt"
const (
A int8 = 1 << iota
B
C
)
@massahud
massahud / README.MD
Last active September 22, 2020 21:05
Minecraft bedrock server on aws lightsail
  1. create an lightsail OS Only Ubuntu instance
  2. turn on port forwarding of UDP
  3. set static ip
  4. ssh into the instance
  5. create and cd to /minecraft directory
  6. wget and unzip the latest bedrock server for ubuntu (https://www.minecraft.net/en-us/download/server/bedrock)
  7. create a run.sh (chmod 755) script with the following code:
#!/bin/bash
LD_LIBRARY_PATH=. ./bedrock_server
@massahud
massahud / main.go
Created May 12, 2020 22:26
Replace accentuated characters in go
package main
import (
"fmt"
"unicode"
"golang.org/x/text/runes"
"golang.org/x/text/transform"
"golang.org/x/text/unicode/norm"
)
@massahud
massahud / FutureValue.java
Created May 22, 2019 01:15
Simple future value holder for async await
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Phaser;
public class FutureValue<T> {
private T value = null;
private Exception ex = null;
private Phaser phaser = new Phaser(1);
/**
@massahud
massahud / NQueens.java
Last active September 21, 2024 07:07
N-Queens problem implementation with backtracking
/**
* N-Queens is the problem to plane N chess queens into a NxN board without
* in a way that no queen threats another one.
* This implementation uses recursion and backtracking to find the solution.
*/
public class NQueens {
/**
* Tries to place N queens into an NxN chess board
*
@massahud
massahud / JerseyConfiguration.java
Last active November 3, 2017 10:09
Swagger jackson jersey springboot java
import javax.inject.Inject;
import javax.ws.rs.ApplicationPath;
import javax.ws.rs.Consumes;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.ext.Provider;
import io.swagger.converter.ModelConverters;
import io.swagger.jackson.ModelResolver;
import io.swagger.jaxrs.config.BeanConfig;
@massahud
massahud / tolocalestring.js
Created December 14, 2016 11:53
Date to locale string in javascript
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleString
let year = 'numeric';
let month = '2-digit';
let day = '2-digit';
let hour = '2-digit';
let minute = '2-digit';
let second = '2-digit';
let hour12 = false;
let weekday = 'short';
let era = 'narrow';
@massahud
massahud / 0_reuse_code.js
Created December 14, 2016 11:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

= under construction =

. git clone https://github.com/apereo/cas-overlay-template.git . copy etc/cas/config to /etc/cas/config . edit /etc/cas/config to point to your domain . mvn clean package . java -jar cas.war

@massahud
massahud / eclipselink.md
Last active October 28, 2021 13:16
Wildfly 10.1.0