Skip to content

Instantly share code, notes, and snippets.

View Iranon's full-sized avatar

Matteo Vinci Iranon

  • Catania, Italy
View GitHub Profile
@Iranon
Iranon / ggomma.sh
Created October 11, 2022 15:42
A Gum based Git tool
#!/bin/sh
# GiGomma
# LICENSE: GPL-3.0-or-later [https://spdx.org/licenses/GPL-3.0-or-later.html]
#| Matteo Vinci [Iranon] (c) 2022 |
#NOTE: Gum needed [https://github.com/charmbracelet/gum]
#- Colors
@Iranon
Iranon / rpush.sh
Created July 14, 2022 08:40
A script to ensure the rebase was done before the push.
#!/bin/bash
#Text Colors
GREEN='\033[0;32m';
BLUE='\033[0;34m';
RED='\033[0;31m';
PURPLE='\033[0;35m';
NOCOLOR='\033[0m';
wait_for_resolution() {
@Iranon
Iranon / markdown-custom-style.css
Created April 5, 2022 12:54
A custom style sheet to override the markdown-to-html GitHub style.
/*<link rel="stylesheet" type="text/css" href="./css/markdown-custom-style.css">*/
* {
color: rgb(24, 8, 12);
}
hr {
background-image: linear-gradient( to right, #91FF46, #AAD852 ) !important;
}
@Iranon
Iranon / generateNoiseValue.ts
Created April 5, 2022 12:22
A function to generate random noise values between -1.0 and 1.0
export const generateNoiseValue = (x: number) => {
const rand = (x: number) => (Math.sin(x) * 1.0) % 1;
const hermineCurve = (n: number) => n*n*(3.0-2.0*n);
const mix = (a: number, b: number, t: number) => (1 - t)*a + t*b; //linear interpolation
let i = Math.floor(x); //integer
let f = x % 1; //fraction
return mix(rand(i), rand(i + 1.0), hermineCurve(f));
};
@Iranon
Iranon / mdeskf.sh
Created January 22, 2022 22:21
A bash script to generate .desktop files
#!/bin/bash
# MakeDesktopFile
#| Matteo Vinci [Iranon] (c) 2022 |
help_message=\
"Usage: $0 [option] FILENAME\n\n\
Valid options are:\n\
'-h': print this message\n\
'-c': create the .desktop file in the current folder\n\
@Iranon
Iranon / perlinNoise.js
Created December 2, 2021 08:40
Perlin Noise from p5.js with an example that feed the function with a value incremented each second.
/*==============================================================================
|| From Perlin Noise implementation in p5.js ||
|| @'https://github.com/processing/p5.js/blob/v1.4.0/src/math/noise.js#L36' ||
==============================================================================*/
//--- The resulting value will always be between 0.0 and 1.0 ---
const PERLIN_YWRAPB = 4;
const PERLIN_YWRAP = 1 << PERLIN_YWRAPB;
const PERLIN_ZWRAPB = 8;
@Iranon
Iranon / cthttpd.sh
Created September 26, 2021 14:00
A shell script to copy your php scripts (file or folder) into the www/html directory (httpd.service)
#!/bin/bash
#- CopyToHTTPD
#|-- Matteo Vinci [Iranon] (c) 2021 --|
#Text Colors
RED='\033[0;31m';
NOCOLOR='\033[0m';
#File
if [[ -f $1 ]]; then
@Iranon
Iranon / Garden.java
Last active April 2, 2021 09:14
A Java exercise that aims to reproduce the classic snake game
import java.util.Random;
public class Garden {
private Unit[][] grid; //The grid represents the game field
private int[] gridSize = new int[2];
private boolean isGameOver = false;
private String lastMove = "0";
//Create a new Snake instance defining initial length and coordinates
private Snake snakePlayer = new Snake(3, 7, 2);