Skip to content

Instantly share code, notes, and snippets.

View AndreaNicola's full-sized avatar
😀

Andrea Nicola AndreaNicola

😀
View GitHub Profile
@AndreaNicola
AndreaNicola / compress.go
Created November 11, 2021 16:39
Function useful to compress a variadic of files in a zip file byte slice
package compress
import (
"archive/zip"
"bytes"
"fmt"
)
type SingleCompressError struct {
Index int
@AndreaNicola
AndreaNicola / systems-startup.sh
Last active April 21, 2021 10:23
Things to install in a new fresh ubuntu 20.04 system
sudo apt update
sudo snap install discord
sudo snap install discord --classic
sudo snap install intellij-idea-ultimate --classic
sudo snap install goland --classic
sudo snap install datagrip --classic
sudo snap install google-cloud-sdk --classic
sudo snap install kontena-lens --classic
sudo snap install gitkraken --classic
sudo snap install spotify
@AndreaNicola
AndreaNicola / CorsConfigurers.java
Last active January 28, 2020 13:22
Springboot CORS configurer
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfigurers {
@Bean
public class IntStack {
private final int[] stack;
private int top;
public IntStack() {
this.top = 0;
this.stack = new int[5];
}
public class Merger {
static int[] merge(int[] array1, int[] array2) {
int[] mergedArray = new int[array1.length + array2.length];
int array1Index = 0;
int array2Index = 0;
int mergedArrayIndex = 0;
while (array1Index < array1.length && array2Index < array2.length) {
public class MatrixMultiply {
static void printMatrix(double[][] a) {
for (int i = 0; i < a.length; i++) {
for (int j = 0; j < a[0].length; j++) {
System.out.print(a[i][j] + " ");
}
System.out.println();
}