Skip to content

Instantly share code, notes, and snippets.

View massahud's full-sized avatar

Geraldo Massahud massahud

View GitHub Profile
@massahud
massahud / Remove date from jupyter exported pdf.md
Created December 2, 2022 14:31
Remove date from jupyter exported pdf

Remove date from jupyter exported pdf

Add \date{} to share/jupyter/nbconvert/templates/latex/base.text.j2 anywhere before /maketitle (e.g. before the title block)

If you want to control it using the notebook metadata, add this instead:

    ((* if nb.metadata.get('nodate', false) *))
    \date{}
    ((* endif *))
@massahud
massahud / CODE PUNS.md
Last active November 29, 2022 13:19
Code Puns

Code Puns

echo "export GPG_TTY=$(tty)" >> ~/.zshrc
echo "pinentry-program $(which pinentry-curses)" >> ~/.gnupg/gpg-agent.conf
killall gpg-agent
source ~/.zshrc
echo test | gpg --clearsign
@massahud
massahud / ChunkSpliterator.java
Created June 2, 2022 14:28
Chunk spliterator - transforms Stream<X> into Stream<List<X>>
import java.util.ArrayList;
import java.util.List;
import java.util.Spliterator;
import java.util.function.Consumer;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
public class ChunkSpliterator<T> implements Spliterator<List<T>>
{
@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;